systemjs/test/test-jsextensions.html

79 lines
1.9 KiB
HTML

<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../bower_components/qunit/qunit/qunit.css"/>
<script src="../bower_components/qunit/qunit/qunit.js"></script>
</head>
<body>
<h1 id="qunit-header">SystemJS Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-test-area"></div>
<script>
// test polyfill loading
// window.URL = undefined;
</script>
<script src="../dist/system.src.js" type="text/javascript"></script>
<script>
System.traceurOptions = { asyncFunctions: true };
System.paths.traceur = '../node_modules/traceur/bin/traceur.js';
QUnit.config.testTimeout = 2000;
QUnit.module("SystemJS JS Extensions");
System.defaultJSExtensions = true;
asyncTest('Error handling', function() {
System['import']('tests/main').then(function(m) {
ok(m.dep == 'value');
start();
});
});
asyncTest('Pathing extension handling', function() {
System.config({
paths: {
'path': 'tests/main'
},
packages: {
'tests/testpkg': {
defaultExtension: 'ts',
map: {
'./asdf': './test.ts'
}
},
'tests/subcontextual-map': {
main: 'submodule',
map: {
dep: 'path'
}
}
}
});
Promise.all([
System['import']('path'),
System['import']('tests/testpkg/asdf'),
System['import']('tests/subcontextual-map'),
System['import']('tests/main-dep'),
System['import']('tests/main-dep.js')
])
.then(function(mods) {
ok(mods[0].dep == 'value');
ok(mods[1] == 'ts');
ok(mods[2].dep == 'value');
ok(mods[3] == mods[2]);
ok(mods[3] == mods[4]);
start();
})
});
</script>
</body>
</html>