QUnit.isSwarm = ( QUnit.urlParams.swarmURL + "" ).indexOf( "http" ) === 0;
QUnit.basicTests = ( QUnit.urlParams.module + "" ) === "basic";
+// Async test for module script type support
+function moduleTypeSupported() {
+ var script = document.createElement( "script" );
+ script.type = "module";
+ script.text = "QUnit.moduleTypeSupported = true";
+ document.head.appendChild( script ).parentNode.removeChild( script );
+}
+moduleTypeSupported();
+
this.loadTests = function() {
+
// Get testSubproject from testrunner first
require( [ "data/testrunner.js" ], function() {
var i = 0,
testHtml( manipulationFunctionReturningObj, assert );
} );
-QUnit.test( "html(script type module)", function( assert ) {
- assert.expect( 1 );
- var fixture = jQuery( "#qunit-fixture" ),
- tmp = fixture.html(
+QUnit[ QUnit.moduleTypeSupported ? "test" : "skip" ]( "html(script type module)", function( assert ) {
+ assert.expect( 4 );
+ var done = assert.async(),
+ $fixture = jQuery( "#qunit-fixture" );
+
+ $fixture.html(
[
"<script type='module'>ok( true, 'evaluated: module' );</script>",
- "<script type='module' src='./data/module.js'></script>",
+ "<script type='module' src='" + url( "module.js" ) + "'></script>",
"<div>",
"<script type='module'>ok( true, 'evaluated: inner module' );</script>",
- "<script type='module' src='./data/inner_module.js'></script>",
+ "<script type='module' src='" + url( "inner_module.js" ) + "'></script>",
"</div>"
].join( "" )
- ).find( "script" );
- assert.equal( tmp.length, 4, "All script tags remain." );
+ );
+
+ // Allow asynchronous script execution to generate assertions
+ setTimeout( function() {
+ done();
+ }, 1000 );
} );
QUnit.test( "html(Function) with incoming value -- direct selection", function( assert ) {