mirror of
https://github.com/systemjs/systemjs.git
synced 2026-01-25 14:57:38 +00:00
94 lines
2.6 KiB
HTML
94 lines
2.6 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<script>
|
|
// window.Promise = null
|
|
</script>
|
|
<script src="../../es6-module-loader/lib/es6-module-loader.js" type="text/javascript"></script>
|
|
<script src="../dist/system-production.js" type="text/javascript"></script>
|
|
<!-- <script src="../dist/system-production.min.js" type="text/javascript"></script> -->
|
|
|
|
<script>
|
|
System.import('test-runner').then(function(runner) {
|
|
runner.execute([
|
|
{
|
|
name: 'Loading an AMD module',
|
|
run: function(complete, err) {
|
|
System.import('tests/amd-module').then(complete, err);
|
|
},
|
|
confirm: function(m) {
|
|
if (m.amd != true)
|
|
return 'Incorrect module';
|
|
if (m.dep.amd != 'dep')
|
|
return 'Dependency not defined';
|
|
}
|
|
},
|
|
{
|
|
name: 'Loading an AMD named define',
|
|
run: function(complete, err) {
|
|
System.import('tests/nameddefine').then(function() {
|
|
System.import('showdown').then(complete, err);
|
|
}, err);
|
|
},
|
|
confirm: function(m) {
|
|
if (!m.converter)
|
|
return 'Showdown not loaded!';
|
|
}
|
|
},
|
|
{
|
|
name: 'Loading a UMD module',
|
|
run: function(complete, err) {
|
|
System.import('tests/umd').then(complete, err);
|
|
},
|
|
confirm: function(m) {
|
|
if (m.d != 'hi')
|
|
return 'module value not defined';
|
|
}
|
|
},
|
|
{
|
|
name: 'Loading a bundle',
|
|
run: function(complete, err) {
|
|
var b1, b2;
|
|
System.import('tests/bundle').then(function() {
|
|
return System.import('bundle-define1');
|
|
})
|
|
.then(function(_b1) {
|
|
b1 = _b1;
|
|
return System.import('bundle-define2');
|
|
})
|
|
.then(function(_b2) {
|
|
b2 = _b2;
|
|
complete(b1, b2);
|
|
})
|
|
.catch(err);
|
|
},
|
|
confirm: function(b1, b2) {
|
|
if (b1.name != 'bundle1')
|
|
return 'bundle 1 not loaded';
|
|
if (b2.name != 'bundle2')
|
|
return 'bundle 2 not loaded';
|
|
}
|
|
},
|
|
{
|
|
name: 'Loading a bundle on demand',
|
|
run: function(complete, err) {
|
|
// our main bundle defines jquery
|
|
System.bundles = {
|
|
'tests/main-bundle': ['jquery']
|
|
};
|
|
|
|
// we import jquery, but should get the version from the bundle
|
|
System.import('jquery').then(complete, err);
|
|
},
|
|
confirm: function(m) {
|
|
if (m.name != 'jquery-bundled')
|
|
return 'jquery not loaded from bundle';
|
|
}
|
|
}
|
|
]);
|
|
}, function(err) {
|
|
setTimeout(function() {
|
|
throw err;
|
|
}, 1);
|
|
});
|
|
</script>
|