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
d14904d0
Commit
d14904d0
authored
Sep 06, 2013
by
Timmy Willison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move test loader to testinit.js. Fix race condition with dependency loading.
parent
b99972de
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
69 deletions
+68
-69
testinit.js
test/data/testinit.js
+67
-0
testrunner.js
test/data/testrunner.js
+0
-15
index.html
test/index.html
+1
-54
No files found.
test/data/testinit.js
View file @
d14904d0
...
@@ -254,3 +254,70 @@ this.testIframeWithCallback = function( title, fileName, func ) {
...
@@ -254,3 +254,70 @@ this.testIframeWithCallback = function( title, fileName, func ) {
});
});
};
};
this
.
iframeCallback
=
undefined
;
this
.
iframeCallback
=
undefined
;
// Tests are always loaded async
QUnit
.
config
.
autostart
=
false
;
this
.
loadTests
=
function
()
{
var
loadSwarm
,
url
=
window
.
location
.
search
,
tests
=
[
"data/testrunner.js"
,
"unit/core.js"
,
"unit/callbacks.js"
,
"unit/deferred.js"
,
"unit/support.js"
,
"unit/data.js"
,
"unit/queue.js"
,
"unit/attributes.js"
,
"unit/event.js"
,
"unit/selector.js"
,
"unit/traversing.js"
,
"unit/manipulation.js"
,
"unit/wrap.js"
,
"unit/css.js"
,
"unit/serialize.js"
,
"unit/ajax.js"
,
"unit/effects.js"
,
"unit/offset.js"
,
"unit/dimensions.js"
];
url
=
decodeURIComponent
(
url
.
slice
(
url
.
indexOf
(
"swarmURL="
)
+
"swarmURL="
.
length
)
);
loadSwarm
=
url
&&
url
.
indexOf
(
"http"
)
===
0
;
// 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"
,
"../bower_components/sizzle/test/"
,
/^unit
\/
.*
\.
js$/
,
function
()
{
// Call load to build module filter select element
QUnit
.
load
();
// 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
();
}
/**
* 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
;
// 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
];
});
});
}
})();
};
test/data/testrunner.js
View file @
d14904d0
if
(
typeof
jQuery
!==
"undefined"
)
{
/**
* Allow the test suite to run with other libs or jQuery's.
*/
jQuery
.
noConflict
();
// Expose Sizzle for Sizzle's selector tests
// We remove Sizzle's globalization in jQuery
this
.
Sizzle
=
this
.
Sizzle
||
jQuery
.
find
;
}
// 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
];
});
// Allow subprojects to test against their own fixtures
// Allow subprojects to test against their own fixtures
var
qunitModule
=
QUnit
.
module
,
var
qunitModule
=
QUnit
.
module
,
...
...
test/index.html
View file @
d14904d0
...
@@ -13,62 +13,9 @@
...
@@ -13,62 +13,9 @@
<script
src=
"../bower_components/qunit/qunit/qunit.js"
></script>
<script
src=
"../bower_components/qunit/qunit/qunit.js"
></script>
<script
src=
"../bower_components/requirejs/require.js"
></script>
<script
src=
"../bower_components/requirejs/require.js"
></script>
<!-- See testinit for the list of tests -->
<script
src=
"data/testinit.js"
></script>
<script
src=
"data/testinit.js"
></script>
<script>
// Tests are always loaded async
QUnit
.
config
.
autostart
=
false
;
function
loadTests
()
{
var
loadSwarm
,
url
=
window
.
location
.
search
,
tests
=
[
"data/testrunner.js"
,
"unit/core.js"
,
"unit/callbacks.js"
,
"unit/deferred.js"
,
"unit/support.js"
,
"unit/data.js"
,
"unit/queue.js"
,
"unit/attributes.js"
,
"unit/event.js"
,
"unit/selector.js"
,
"unit/traversing.js"
,
"unit/manipulation.js"
,
"unit/wrap.js"
,
"unit/css.js"
,
"unit/serialize.js"
,
"unit/ajax.js"
,
"unit/effects.js"
,
"unit/offset.js"
,
"unit/dimensions.js"
];
url
=
decodeURIComponent
(
url
.
slice
(
url
.
indexOf
(
"swarmURL="
)
+
"swarmURL="
.
length
)
);
loadSwarm
=
url
&&
url
.
indexOf
(
"http"
)
===
0
;
// 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"
,
"../bower_components/sizzle/test/"
,
/^unit
\/
.*
\.
js$/
,
function
()
{
// Call load to build module filter select element
QUnit
.
load
();
// 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
();
}
});
}
})();
}
</script>
<!-- A script that includes jQuery min, dev, or AMD -->
<!-- A script that includes jQuery min, dev, or AMD -->
<!-- Adds "basic" URL option, even to iframes -->
<!-- Adds "basic" URL option, even to iframes -->
<!-- iframes will not load AMD as loading needs to be synchronous for some tests -->
<!-- iframes will not load AMD as loading needs to be synchronous for some tests -->
...
...
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