Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with supporting multiple contextual modules of one type #1222

Merged
merged 3 commits into from Jul 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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 change: 1 addition & 0 deletions test/ext-steal-clone/multiple/first.js
@@ -0,0 +1 @@
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 change: 1 addition & 0 deletions test/ext-steal-clone/multiple/second.js
@@ -0,0 +1 @@
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);
});