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
30168722
Commit
30168722
authored
Jul 20, 2012
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let subproject tests use their own test fixture. Closes gh-867.
parent
f70a6965
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
2 deletions
+79
-2
testrunner.js
test/data/testrunner.js
+74
-0
index.html
test/index.html
+5
-2
No files found.
test/data/testrunner.js
View file @
30168722
...
@@ -7,6 +7,80 @@ jQuery.noConflict();
...
@@ -7,6 +7,80 @@ jQuery.noConflict();
// We remove Sizzle's globalization in jQuery
// We remove Sizzle's globalization in jQuery
var
Sizzle
=
Sizzle
||
jQuery
.
find
;
var
Sizzle
=
Sizzle
||
jQuery
.
find
;
// Allow subprojects to test against their own fixtures
var
qunitModule
=
QUnit
.
module
;
function
testSubproject
(
label
,
url
,
risTests
)
{
module
(
"Subproject: "
+
label
);
module
=
QUnit
.
module
=
function
(
name
)
{
return
qunitModule
.
apply
(
this
,
[
label
+
": "
+
name
].
concat
(
[].
slice
.
call
(
arguments
,
1
)
)
);
};
test
(
"Copy test fixture"
,
function
()
{
expect
(
3
);
// Don't let subproject tests jump the gun
QUnit
.
config
.
reorder
=
false
;
stop
();
jQuery
.
ajax
(
url
,
{
dataType
:
"html"
,
error
:
function
(
jqXHR
,
status
)
{
ok
(
false
,
"Retrieved test page: "
+
status
);
},
success
:
function
(
data
)
{
var
page
,
fixture
,
fixtureHTML
,
oldFixture
=
jQuery
(
"#qunit-fixture"
);
ok
(
data
,
"Retrieved test page"
);
try
{
page
=
jQuery
(
jQuery
.
parseHTML
(
data
.
replace
(
/
(
<
\/?)(?:
html|head
)\b
/g
,
"$1div"
),
document
,
true
)
);
// 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
()
);
ok
(
fixture
.
html
(),
"Found test fixture"
);
// Replace the current fixture, again including content outside of #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
;
QUnit
.
reset
();
equal
(
jQuery
(
"#qunit-fixture"
).
html
(),
fixtureHTML
,
"Copied test fixture"
);
// Include subproject tests
page
.
find
(
"script[src]"
).
add
(
page
.
filter
(
"script[src]"
)
).
filter
(
function
()
{
var
src
=
jQuery
(
this
).
attr
(
"src"
);
if
(
risTests
.
test
(
src
)
)
{
this
.
src
=
url
+
src
;
return
true
;
}
}).
appendTo
(
"head:first"
);
}
catch
(
x
)
{
ok
(
false
,
"Failed to copy test fixture: "
+
(
x
.
message
||
x
)
);
}
},
complete
:
function
()
{
start
();
}
});
});
}
/**
/**
* QUnit hooks
* QUnit hooks
*/
*/
...
...
test/index.html
View file @
30168722
...
@@ -40,8 +40,6 @@
...
@@ -40,8 +40,6 @@
<script
src=
"unit/queue.js"
></script>
<script
src=
"unit/queue.js"
></script>
<script
src=
"unit/attributes.js"
></script>
<script
src=
"unit/attributes.js"
></script>
<script
src=
"unit/event.js"
></script>
<script
src=
"unit/event.js"
></script>
<script
src=
"../src/sizzle/test/unit/selector.js"
></script>
<script
src=
"../src/sizzle/test/unit/utilities.js"
></script>
<script
src=
"unit/selector.js"
></script>
<script
src=
"unit/selector.js"
></script>
<script
src=
"unit/traversing.js"
></script>
<script
src=
"unit/traversing.js"
></script>
<script
src=
"unit/manipulation.js"
></script>
<script
src=
"unit/manipulation.js"
></script>
...
@@ -54,6 +52,11 @@
...
@@ -54,6 +52,11 @@
<script
src=
"unit/deprecated.js"
></script>
<script
src=
"unit/deprecated.js"
></script>
<script
src=
"unit/exports.js"
></script>
<script
src=
"unit/exports.js"
></script>
<!-- Subproject tests must be last because they replace our test fixture -->
<script>
testSubproject
(
"Sizzle"
,
"../src/sizzle/test/"
,
/^unit
\/
.*
\.
js$/
);
</script>
<script>
<script>
// html5shiv, enabling HTML5 elements to be used with jQuery
// html5shiv, enabling HTML5 elements to be used with jQuery
(
"abbr article aside audio bdi canvas data details figcaption figure footer header hgroup "
+
(
"abbr article aside audio bdi canvas data details figcaption figure footer header hgroup "
+
...
...
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