Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
92cff8b1
Commit
92cff8b1
authored
Feb 18, 2014
by
Oleg Gaidarenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests: Remove Sizzle intergration tests
Fixes #14818
parent
a7c9facc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
174 deletions
+27
-174
testinit.js
test/data/testinit.js
+27
-40
testrunner.js
test/data/testrunner.js
+0
-134
No files found.
test/data/testinit.js
View file @
92cff8b1
...
...
@@ -131,8 +131,8 @@ fireNative = document.createEvent ?
* @result "data/test.php?foo=bar&10538358345554"
*/
function
url
(
value
)
{
return
baseURL
+
value
+
(
/
\?
/
.
test
(
value
)
?
"&"
:
"?"
)
+
new
Date
().
getTime
()
+
""
+
parseInt
(
Math
.
random
()
*
100000
,
10
);
return
baseURL
+
value
+
(
/
\?
/
.
test
(
value
)
?
"&"
:
"?"
)
+
new
Date
().
getTime
()
+
""
+
parseInt
(
Math
.
random
()
*
100000
,
10
);
}
// Ajax testing helper
...
...
@@ -203,19 +203,17 @@ this.ajaxTest = function( title, expect, options ) {
this
.
testIframe
=
function
(
fileName
,
name
,
fn
)
{
test
(
name
,
function
()
{
// pause execution for now
stop
();
asyncTest
(
name
,
function
()
{
// load fixture in iframe
var
iframe
=
loadFixture
(),
win
=
iframe
.
contentWindow
,
interval
=
setInterval
(
function
()
{
interval
=
setInterval
(
function
()
{
if
(
win
&&
win
.
jQuery
&&
win
.
jQuery
.
isReady
)
{
clearInterval
(
interval
);
// continue
start
();
// call actual tests passing the correct jQuery instance to use
fn
.
call
(
this
,
win
.
jQuery
,
win
,
win
.
document
);
document
.
body
.
removeChild
(
iframe
);
...
...
@@ -225,9 +223,10 @@ this.testIframe = function( fileName, name, fn ) {
});
function
loadFixture
()
{
var
src
=
url
(
"./data/"
+
fileName
+
".html"
),
iframe
=
jQuery
(
"<iframe />"
).
appendTo
(
"body"
)[
0
];
var
src
=
url
(
"./data/"
+
fileName
+
".html"
),
iframe
=
jQuery
(
"<iframe />"
).
appendTo
(
"body"
)[
0
];
iframe
.
style
.
cssText
=
"width: 500px; height: 500px; position: absolute; top: -600px; left: -600px; visibility: hidden;"
;
iframe
.
contentWindow
.
location
=
src
;
return
iframe
;
}
...
...
@@ -265,11 +264,12 @@ QUnit.config.autostart = false;
this
.
loadTests
=
function
()
{
var
loadSwarm
,
url
=
window
.
location
.
search
;
url
=
decodeURIComponent
(
url
.
slice
(
url
.
indexOf
(
"swarmURL="
)
+
"swarmURL="
.
length
)
);
loadSwarm
=
url
&&
url
.
indexOf
(
"http"
)
===
0
;
url
=
decodeURIComponent
(
url
.
slice
(
url
.
indexOf
(
"swarmURL="
)
+
"swarmURL="
.
length
)
);
loadSwarm
=
url
&&
url
.
indexOf
(
"http"
)
===
0
;
// Get testSubproject from testrunner first
require
([
"data/testrunner.js"
],
function
(
testSubproject
)
{
require
([
"data/testrunner.js"
],
function
()
{
var
tests
=
[
"unit/core.js"
,
"unit/callbacks.js"
,
...
...
@@ -294,39 +294,26 @@ this.loadTests = function() {
// Ensure load order (to preserve test numbers)
(
function
loadDep
()
{
var
dep
=
tests
.
shift
();
if
(
dep
)
{
require
(
[
dep
],
loadDep
);
}
else
{
// Subproject tests must be last because they replace our test fixture
testSubproject
(
"Sizzle"
,
"../src/sizzle/test/"
,
/^unit
\/
.*
\.
js$/
,
function
()
{
// Call load to build module filter select element
QUnit
.
load
();
/**
* Run in noConflict mode
*/
jQuery
.
noConflict
();
// Expose Sizzle for Sizzle's selector tests
// We remove Sizzle's globalization in jQuery
window
.
Sizzle
=
window
.
Sizzle
||
jQuery
.
find
;
}
else
{
QUnit
.
load
();
// For checking globals pollution despite auto-created globals in various environments
supportjQuery
.
each
(
[
jQuery
.
expando
,
"getInterface"
,
"Packages"
,
"java"
,
"netscape"
],
function
(
i
,
name
)
{
window
[
name
]
=
window
[
name
];
}
);
/**
* Run in noConflict mode
*/
jQuery
.
noConflict
(
);
// Load the TestSwarm listener if swarmURL is in the address.
if
(
loadSwarm
)
{
require
(
[
"http://swarm.jquery.org/js/inject.js?"
+
(
new
Date
()).
getTime
()
],
function
()
{
QUnit
.
start
();
});
}
else
{
// Load the TestSwarm listener if swarmURL is in the address.
if
(
loadSwarm
)
{
require
(
[
"http://swarm.jquery.org/js/inject.js?"
+
(
new
Date
()).
getTime
()
],
function
()
{
QUnit
.
start
();
}
});
});
}
else
{
QUnit
.
start
();
}
}
})();
});
...
...
test/data/testrunner.js
View file @
92cff8b1
...
...
@@ -192,138 +192,4 @@ window.Globals = (function() {
};
})();
/**
* Test a subproject with its own fixture
* @param {String} label Project name
* @param {String} url Test folder location
* @param {RegExp} risTests To filter script sources
*/
function
testSubproject
(
label
,
subProjectURL
,
risTests
,
complete
)
{
var
sub
,
fixture
,
fixtureHTML
,
fixtureReplaced
=
false
;
// Don't let subproject tests jump the gun
QUnit
.
config
.
reorder
=
false
;
// Create module
module
(
label
);
// Duckpunch QUnit
// TODO restore parent fixture on teardown to support reordering
module
=
QUnit
.
module
=
function
(
name
)
{
var
args
=
arguments
;
// Remember subproject-scoped module name
sub
=
name
;
// Override
args
[
0
]
=
label
;
return
qunitModule
.
apply
(
this
,
args
);
};
test
=
function
(
name
)
{
var
args
=
arguments
,
i
=
args
.
length
-
1
;
// Prepend subproject-scoped module name to test name
args
[
0
]
=
sub
+
": "
+
name
;
// Find test function and wrap to require subproject fixture
for
(
;
i
>=
0
;
i
--
)
{
if
(
supportjQuery
.
isFunction
(
args
[
i
]
)
)
{
args
[
i
]
=
requireFixture
(
args
[
i
]
);
break
;
}
}
return
qunitTest
.
apply
(
this
,
args
);
};
// Load tests and fixture from subproject
// Test order matters, so we must be synchronous and throw an error on load failure
supportjQuery
.
ajax
(
subProjectURL
,
{
async
:
false
,
dataType
:
"html"
,
error
:
function
(
jqXHR
,
status
)
{
throw
new
Error
(
"Could not load: "
+
subProjectURL
+
" ("
+
status
+
")"
);
},
success
:
function
(
data
,
status
,
jqXHR
)
{
var
sources
=
[],
page
=
supportjQuery
.
parseHTML
(
// replace html/head with dummy elements so they are represented in the DOM
(
data
||
""
).
replace
(
/<
\/?((
!DOCTYPE|html|head
)\b
.*
?)
>/gi
,
"[$1]"
),
document
,
true
);
if
(
!
page
||
!
page
.
length
)
{
this
.
error
(
jqXHR
,
"no data"
);
}
page
=
supportjQuery
(
page
);
// Include subproject tests
page
.
filter
(
"script[src]"
).
add
(
page
.
find
(
"script[src]"
)
).
map
(
function
()
{
var
src
=
supportjQuery
(
this
).
attr
(
"src"
);
if
(
risTests
.
test
(
src
)
)
{
sources
.
push
(
src
);
}
});
// Ensure load order
(
function
loadDep
()
{
var
dep
=
sources
.
shift
();
if
(
dep
)
{
require
(
[
subProjectURL
+
dep
],
loadDep
);
}
else
if
(
complete
)
{
complete
();
}
})();
// Get the fixture, including content outside of #qunit-fixture
fixture
=
page
.
find
(
"[id='qunit-fixture']"
);
fixtureHTML
=
fixture
.
html
();
fixture
.
empty
();
while
(
fixture
.
length
&&
!
fixture
.
prevAll
(
"[id='qunit']"
).
length
)
{
fixture
=
fixture
.
parent
();
}
fixture
=
fixture
.
add
(
fixture
.
nextAll
()
);
}
});
function
requireFixture
(
fn
)
{
return
function
()
{
if
(
!
fixtureReplaced
)
{
// Make sure that we retrieved a fixture for the subproject
if
(
!
fixture
.
length
)
{
ok
(
false
,
"Found subproject fixture"
);
return
;
}
// Update helper function behavior
baseURL
=
subProjectURL
;
// Replace the current fixture, including content outside of #qunit-fixture
var
oldFixture
=
supportjQuery
(
"#qunit-fixture"
);
while
(
oldFixture
.
length
&&
!
oldFixture
.
prevAll
(
"[id='qunit']"
).
length
)
{
oldFixture
=
oldFixture
.
parent
();
}
oldFixture
.
nextAll
().
remove
();
oldFixture
.
replaceWith
(
fixture
);
// WARNING: UNDOCUMENTED INTERFACE
QUnit
.
config
.
fixture
=
fixtureHTML
;
reset
();
if
(
supportjQuery
(
"#qunit-fixture"
).
html
()
!==
fixtureHTML
)
{
ok
(
false
,
"Copied subproject fixture"
);
return
;
}
fixtureReplaced
=
true
;
}
fn
.
apply
(
this
,
arguments
);
};
}
}
return
testSubproject
;
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment