Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 4f024c5

Browse files
committed
test: add script type module test
1 parent 301ceb7 commit 4f024c5

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

karma.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module.exports = function (config) {
3838
+ '.src.js',
3939

4040
'test/_browser.js',
41+
'test/browser-script-type-module.js',
4142
'test/custom-loader.js',
4243

4344
[!options.ie8 ? 'test/*.spec.js' : 'test/*.normalize.spec.js'],

test/browser-script-type-module.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
(function (__global){
3+
'use strict';
4+
5+
if (!__global){
6+
return;
7+
}
8+
9+
document.write('<script type="module"> window.anon = class { constructor() { } } </script>');
10+
11+
}(typeof window != 'undefined' && window ));
12+
13+

test/system.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,4 +406,16 @@ describe('System', function () {
406406
});
407407

408408
});
409+
410+
describeIf(
411+
typeof window != 'undefined',
412+
'with script type "module"', function () {
413+
it('should load the module on the document "load" event', function (done) {
414+
setTimeout(function(){ // wait for script processing first
415+
expect(window.anon).to.be.a('function');
416+
done();
417+
}, 0);
418+
});
419+
420+
});
409421
});

0 commit comments

Comments
 (0)