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

Commit 4e9550c

Browse files
committed
Merge pull request #289 from douglasduteil/test-add-script-type-module-test
test: add script type module test
2 parents 6e92b19 + 4f024c5 commit 4e9550c

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
@@ -39,6 +39,7 @@ module.exports = function (config) {
3939
+ '.src.js',
4040

4141
'test/_browser.js',
42+
'test/browser-script-type-module.js',
4243
'test/custom-loader.js',
4344

4445
[!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
@@ -385,4 +385,16 @@ describe('System', function () {
385385
});
386386

387387
});
388+
389+
describeIf(
390+
typeof window != 'undefined',
391+
'with script type "module"', function () {
392+
it('should load the module on the document "load" event', function (done) {
393+
setTimeout(function(){ // wait for script processing first
394+
expect(window.anon).to.be.a('function');
395+
done();
396+
}, 0);
397+
});
398+
399+
});
388400
});

0 commit comments

Comments
 (0)