Skip to content
This repository was archived by the owner on Jan 22, 2023. It is now read-only.

Commit 53ba93d

Browse files
author
Lars den Bakker
committed
Added test for inline modules
1 parent 0430148 commit 53ba93d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tests/html/es-module.html

+18
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,24 @@
3535
assert.deepEqual(window.loadedModules, ['es-module-2', 'es-module-1', 'es-module-3']);
3636
}
3737
});
38+
39+
test('inline module', (done) => {
40+
// This test should be executed only on browsers that support native modules but not HTML Imports
41+
if (!window.define && !HTMLImports.useNative) {
42+
const link = document.createElement('link');
43+
link.setAttribute('rel', 'import');
44+
link.setAttribute('href', './imports/es-module-inline.html');
45+
46+
// Catch error thrown by polyfill
47+
window.onerror = () => {
48+
done();
49+
}
50+
51+
document.head.appendChild(link);
52+
} else {
53+
done();
54+
}
55+
});
3856
</script>
3957
</body>
4058

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<script type="module">
2+
// Inline module should throw an error
3+
</script>

0 commit comments

Comments
 (0)