Skip to content

Commit

Permalink
fixes #1221 and adds tests for it
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbmeyer committed Jul 2, 2017
1 parent 5ef2d0d commit 65abac0
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 52 deletions.
2 changes: 1 addition & 1 deletion src/system-extension-contextual.js
Expand Up @@ -17,7 +17,7 @@ addStealExtension(function (loader) {
if (definer) {
var localName = name + '/' + parentName;

if(!loader.has(name)) {
if(!loader.has(localName)) {
// `definer` could be a function or could be a moduleName
if (typeof definer === 'string') {
definer = pluginLoader['import'](definer);
Expand Down
2 changes: 0 additions & 2 deletions test/clone-within-dynamic-imports/first-test.js

This file was deleted.

8 changes: 0 additions & 8 deletions test/clone-within-dynamic-imports/second-runs-tests.js

This file was deleted.

1 change: 0 additions & 1 deletion test/clone-within-dynamic-imports/second-test.js

This file was deleted.

2 changes: 0 additions & 2 deletions test/clone-within-dynamic-imports/test.js

This file was deleted.

36 changes: 0 additions & 36 deletions test/clone-within-dynamic-imports/within-dynamic-imports.html

This file was deleted.

5 changes: 5 additions & 0 deletions test/ext-steal-clone/multiple/first-test.js
@@ -0,0 +1,5 @@
var clone = require("steal-clone");

module.exports = function(){
return clone({}).import("./first")
}
@@ -1,2 +1 @@
console.log("running first");
module.exports = {name: "first"};
18 changes: 18 additions & 0 deletions test/ext-steal-clone/multiple/index.html
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>clone tests</title>
</head>
<body>
<script>
window.done = window.parent.done;
window.assert = window.parent.assert;
</script>
<script type="text/javascript"
src="../../../steal.js"
data-config="../../config.js"
data-main="ext-steal-clone/multiple/test"></script>
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions test/ext-steal-clone/multiple/second-runs-tests.js
@@ -0,0 +1,5 @@
var clone = require("steal-clone");

module.exports = function(){
return clone({}).import('./second')
};
1 change: 1 addition & 0 deletions test/ext-steal-clone/multiple/second-test.js
@@ -0,0 +1 @@
module.exports = require("./second-runs-tests");
@@ -1,2 +1 @@
console.log("running second");
module.exports = {name: "second"};
18 changes: 18 additions & 0 deletions test/ext-steal-clone/multiple/test.js
@@ -0,0 +1,18 @@
var doClone1 = require("./first-test");
var doClone2 = require("./second-test");

Promise.all([doClone1(), doClone2()]).then(function(){
if (typeof window !== "undefined" && window.assert) {
assert.ok(true, "promises resolved");
done();
} else {
console.log("worked");
}
}, function(){
if (typeof window !== "undefined" && window.assert) {
assert.ok(false, "promises failed");
done();
} else {
console.log("promises failed");
}
});
5 changes: 5 additions & 0 deletions test/steal_clone_test.js
Expand Up @@ -49,3 +49,8 @@ QUnit.test("works when using relative overrides", function(assert) {
QUnit.test("what happens within a cloned loader should not leak", function(assert) {
makeIframe("ext-steal-clone/leak/index.html", assert);
});


QUnit.test("multiple clones can work at different paths", function(assert) {
makeIframe("ext-steal-clone/multiple/index.html", assert);
});

0 comments on commit 65abac0

Please sign in to comment.