aboutsummaryrefslogtreecommitdiffstats
path: root/test/data/testinit.js
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-12-09 20:00:44 +0100
committerGitHub <noreply@github.com>2019-12-09 20:00:44 +0100
commitf37c2e51f36c8f8bab3879064a90e86a685feafc (patch)
treeb5a5c406a6550722af65ebf579f0a51d6d8c336e /test/data/testinit.js
parentd5c505e35d8c74ce8e9d99731a1a7eab0e0d911c (diff)
downloadjquery-f37c2e51f36c8f8bab3879064a90e86a685feafc.tar.gz
jquery-f37c2e51f36c8f8bab3879064a90e86a685feafc.zip
Build: Auto-convert sources to AMD
jQuery source has been migrated in gh-4541 from AMD to ES modules. To maintain support for consumers of our AMD modules, this commits adds a task transpiling the ES modules sources in `src/` to AMD in `amd/`. A "Load with AMD" checkbox was also restored to the QUnit setup. Note that, contrary to jQuery 3.x, AMD files need to be generated via `grunt amd` or `grunt` as sources are not authored in ECMAScript modules. To achieve a similar no-compile experience during jQuery 4.x testing, use the new "Load as modules" checkbox which works in all supported browsers except for IE & Edge (the legacy, EdgeHTML-based one). Ref gh-4541 Closes gh-4554
Diffstat (limited to 'test/data/testinit.js')
-rw-r--r--test/data/testinit.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/data/testinit.js b/test/data/testinit.js
index 7a8697189..4088e4671 100644
--- a/test/data/testinit.js
+++ b/test/data/testinit.js
@@ -299,14 +299,16 @@ QUnit.testUnlessIE = QUnit.isIE ? QUnit.skip : QUnit.test;
this.loadTests = function() {
- // Directly load tests that need synchronous evaluation
- if ( !QUnit.urlParams.esmodules || document.readyState === "loading" ) {
+ // QUnit.config is populated from QUnit.urlParams but only at the beginning
+ // of the test run. We need to read both.
+ var amd = QUnit.config.amd || QUnit.urlParams.amd;
+
+ // Directly load tests that need evaluation before DOMContentLoaded.
+ if ( !amd || document.readyState === "loading" ) {
document.write( "<script src='" + parentUrl + "test/unit/ready.js'><\x2Fscript>" );
} else {
QUnit.module( "ready", function() {
- QUnit.test( "jQuery ready", function( assert ) {
- assert.ok( false, "Test should be initialized before DOM ready" );
- } );
+ QUnit.skip( "jQuery ready tests skipped in async mode", function() {} );
} );
}