Skip to content

Commit a8365cf

Browse files
authored
Tests: Fix test setup so that TestSwarm works again
The test setup broke because of gh-450. Tested on various setups locally. Closes gh-466 Ref gh-450
1 parent 817e66d commit a8365cf

File tree

2 files changed

+27
-24
lines changed

2 files changed

+27
-24
lines changed

test/data/testinit.js

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@ TestManager = {
2525
// Order is important
2626
file = [
2727
"version",
28-
"data/test-utils",
29-
"unit/migrate",
30-
"unit/jquery/core",
31-
"unit/jquery/ajax",
32-
"unit/jquery/attributes",
33-
"unit/jquery/css",
34-
"unit/jquery/data",
35-
"unit/jquery/effects",
36-
"unit/jquery/event",
37-
"unit/jquery/offset",
38-
"unit/jquery/serialize",
39-
"unit/jquery/traversing",
40-
"unit/jquery/deferred"
28+
"compareVersions",
29+
"main",
30+
"jquery/core",
31+
"jquery/ajax",
32+
"jquery/attributes",
33+
"jquery/css",
34+
"jquery/data",
35+
"jquery/effects",
36+
"jquery/event",
37+
"jquery/manipulation",
38+
"jquery/offset",
39+
"jquery/serialize",
40+
"jquery/traversing",
41+
"jquery/deferred"
4142
];
4243

4344
for ( i = 0; i < file.length; i++ ) {
@@ -81,19 +82,19 @@ TestManager = {
8182
* as appropriate (for example by calling TestManager.loadProject)
8283
*/
8384
runIframeTest: function( title, url, func ) {
84-
var self = this;
85+
var that = this;
8586
QUnit.test( title, function( assert ) {
8687
var iframe,
8788
query = window.location.search.slice( 1 ),
8889
done = assert.async();
8990

90-
self.iframeCallback = function() {
91+
that.iframeCallback = function() {
9192
var args = Array.prototype.slice.call( arguments );
9293

9394
args.unshift( assert );
9495

9596
setTimeout( function() {
96-
self.iframeCallback = undefined;
97+
that.iframeCallback = undefined;
9798

9899
func.apply( this, args );
99100
func = function() {};
@@ -104,22 +105,22 @@ TestManager = {
104105
};
105106
iframe = jQuery( "<div/>" )
106107
.css( { position: "absolute", width: "500px", left: "-600px" } )
107-
.append( jQuery( "<iframe/>" ).attr( "src", self.baseURL + "data/" + url +
108+
.append( jQuery( "<iframe/>" ).attr( "src", that.baseURL + url +
108109
( query && ( /\?/.test( url ) ? "&" : "?" ) ) + query ) )
109110
.appendTo( "#qunit-fixture" );
110111
} );
111112
},
112113
iframeCallback: undefined,
113-
baseURL: window.__karma__ ? "base/test/" : "./",
114114
init: function( projects ) {
115115
var p, project, originalDeduplicateWarnings,
116116
disabledPatches, origMigrateDisablePatches,
117117
FILEPATH = "/test/data/testinit.js",
118118
activeScript = [].slice.call( document.getElementsByTagName( "script" ), -1 )[ 0 ],
119119
parentUrl = activeScript && activeScript.src ?
120120
activeScript.src.replace( /[?#].*/, "" ) + FILEPATH.replace( /[^/]+/g, ".." ) + "/" :
121-
"../",
122-
baseURL = parentUrl + "test/data/";
121+
"../";
122+
123+
this.baseURL = parentUrl + "test/data/";
123124

124125
this.projects = projects;
125126
this.loaded = [];
@@ -154,11 +155,11 @@ TestManager = {
154155
* @example url("index.html")
155156
* @result "data/index.html?10538358428943"
156157
*
157-
* @example url("mock.php?foo=bar")
158-
* @result "data/mock.php?foo=bar&10538358345554"
158+
* @example url("xyz.php?foo=bar")
159+
* @result "data/xyz.php?foo=bar&10538358345554"
159160
*/
160161
window.url = function url( value ) {
161-
return baseURL + value + ( /\?/.test( value ) ? "&" : "?" ) +
162+
return TestManager.baseURL + value + ( /\?/.test( value ) ? "&" : "?" ) +
162163
new Date().getTime() + "" + parseInt( Math.random() * 100000, 10 );
163164
};
164165

test/unit/jquery/css.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ QUnit.test( "jQuery.css with arrays", function( assert ) {
6060
} );
6161
} );
6262

63-
QUnit.test( "jQuery.css with numbers", function( assert ) {
63+
QUnit[
64+
typeof Proxy !== "undefined" ? "test" : "skip"
65+
]( "jQuery.css with numbers", function( assert ) {
6466
var jQuery3OrOlder = compareVersions( jQuery.fn.jquery, "4.0.0" ) < 0,
6567
allowlist = [
6668
"margin",

0 commit comments

Comments
 (0)