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
f6f8848f
Commit
f6f8848f
authored
Dec 05, 2014
by
Richard Gibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests: Minor updates for QUnit 1.16 compatibility
More to come later.
parent
b6e31a88
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
24 deletions
+25
-24
testrunner.js
test/data/testrunner.js
+3
-4
attributes.js
test/unit/attributes.js
+1
-1
data.js
test/unit/data.js
+3
-3
dimensions.js
test/unit/dimensions.js
+6
-6
effects.js
test/unit/effects.js
+12
-10
No files found.
test/data/testrunner.js
View file @
f6f8848f
...
...
@@ -43,14 +43,13 @@ function keys( o ) {
* @param {jQuery|HTMLElement|Object|Array} elems Target (or array of targets) for jQuery.data.
* @param {string} key
*/
QUnit
.
expectJqData
=
function
(
elems
,
key
)
{
var
i
,
elem
,
expando
,
currentEnv
=
"current_testEnvironment"
;
QUnit
.
expectJqData
=
function
(
env
,
elems
,
key
)
{
var
i
,
elem
,
expando
;
// As of jQuery 2.0, there will be no "cache"-data is
// stored and managed completely below the API surface
if
(
jQuery
.
cache
)
{
QUnit
[
currentEnv
]
.
checkJqData
=
true
;
env
.
checkJqData
=
true
;
if
(
elems
.
jquery
&&
elems
.
toArray
)
{
elems
=
elems
.
toArray
();
...
...
test/unit/attributes.js
View file @
f6f8848f
...
...
@@ -1269,7 +1269,7 @@ var testToggleClass = function(valueObj) {
// Cleanup
e
.
removeClass
(
"testD"
);
QUnit
.
expectJqData
(
e
[
0
],
"__className__"
);
QUnit
.
expectJqData
(
this
,
e
[
0
],
"__className__"
);
};
test
(
"toggleClass(String|boolean|undefined[, boolean])"
,
function
()
{
...
...
test/unit/data.js
View file @
f6f8848f
...
...
@@ -78,7 +78,7 @@ test("jQuery.data(div)", 25, function() {
// We stored one key in the private data
// assert that nothing else was put in there, and that that
// one stayed there.
QUnit
.
expectJqData
(
div
,
"foo"
);
QUnit
.
expectJqData
(
this
,
div
,
"foo"
);
});
test
(
"jQuery.data({})"
,
25
,
function
()
{
...
...
@@ -96,7 +96,7 @@ test("jQuery.data(window)", 25, function() {
test
(
"jQuery.data(document)"
,
25
,
function
()
{
dataTests
(
document
);
QUnit
.
expectJqData
(
document
,
"foo"
);
QUnit
.
expectJqData
(
this
,
document
,
"foo"
);
});
test
(
"Expando cleanup"
,
4
,
function
()
{
...
...
@@ -682,4 +682,4 @@ testIframeWithCallback( "enumerate data attrs on body (#14894)", "data/dataAttrs
expect
(
1
);
equal
(
result
,
"ok"
,
"enumeration of data- attrs on body"
);
});
\ No newline at end of file
});
test/unit/dimensions.js
View file @
f6f8848f
...
...
@@ -57,7 +57,7 @@ function testWidth( val ) {
equal
(
jQuery
(
window
).
width
(),
document
.
documentElement
.
clientWidth
,
"Window width is equal to width reported by window/document."
);
QUnit
.
expectJqData
(
$div
[
0
],
"olddisplay"
);
QUnit
.
expectJqData
(
this
,
$div
[
0
],
"olddisplay"
);
}
test
(
"width()"
,
function
()
{
...
...
@@ -110,7 +110,7 @@ function testHeight( val ) {
equal
(
jQuery
(
window
).
height
(),
document
.
documentElement
.
clientHeight
,
"Window width is equal to width reported by window/document."
);
QUnit
.
expectJqData
(
$div
[
0
],
"olddisplay"
);
QUnit
.
expectJqData
(
this
,
$div
[
0
],
"olddisplay"
);
}
test
(
"height()"
,
function
()
{
...
...
@@ -166,7 +166,7 @@ test("innerWidth()", function() {
equal
(
div
.
innerWidth
(),
0
,
"Make sure that disconnected nodes are handled."
);
div
.
remove
();
QUnit
.
expectJqData
(
$div
[
0
],
"olddisplay"
);
QUnit
.
expectJqData
(
this
,
$div
[
0
],
"olddisplay"
);
});
test
(
"innerHeight()"
,
function
()
{
...
...
@@ -202,7 +202,7 @@ test("innerHeight()", function() {
equal
(
div
.
innerHeight
(),
0
,
"Make sure that disconnected nodes are handled."
);
div
.
remove
();
QUnit
.
expectJqData
(
$div
[
0
],
"olddisplay"
);
QUnit
.
expectJqData
(
this
,
$div
[
0
],
"olddisplay"
);
});
test
(
"outerWidth()"
,
function
()
{
...
...
@@ -241,7 +241,7 @@ test("outerWidth()", function() {
equal
(
div
.
outerWidth
(),
0
,
"Make sure that disconnected nodes are handled."
);
div
.
remove
();
QUnit
.
expectJqData
(
$div
[
0
],
"olddisplay"
);
QUnit
.
expectJqData
(
this
,
$div
[
0
],
"olddisplay"
);
});
test
(
"child of a hidden elem (or unconnected node) has accurate inner/outer/Width()/Height() see #9441 #9300"
,
function
()
{
...
...
@@ -388,7 +388,7 @@ test("outerHeight()", function() {
equal
(
div
.
outerHeight
(),
0
,
"Make sure that disconnected nodes are handled."
);
div
.
remove
();
QUnit
.
expectJqData
(
$div
[
0
],
"olddisplay"
);
QUnit
.
expectJqData
(
this
,
$div
[
0
],
"olddisplay"
);
});
test
(
"passing undefined is a setter #5571"
,
function
()
{
...
...
test/unit/effects.js
View file @
f6f8848f
...
...
@@ -43,7 +43,7 @@ test("show() basic", 2, function() {
// Clean up the detached node
div
.
remove
();
QUnit
.
expectJqData
(
hiddendiv
,
"olddisplay"
);
QUnit
.
expectJqData
(
this
,
hiddendiv
,
"olddisplay"
);
});
test
(
"show()"
,
27
,
function
()
{
...
...
@@ -94,7 +94,7 @@ test("show()", 27, function () {
});
// Tolerate data from show()/hide()
QUnit
.
expectJqData
(
div
,
"olddisplay"
);
QUnit
.
expectJqData
(
this
,
div
,
"olddisplay"
);
// #show-tests * is set display: none in CSS
jQuery
(
"#qunit-fixture"
).
append
(
"<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id='test-table'></table>"
);
...
...
@@ -203,7 +203,7 @@ test("Persist correct display value", function() {
clock
.
tick
(
300
);
QUnit
.
expectJqData
(
$span
,
"olddisplay"
);
QUnit
.
expectJqData
(
this
,
$span
,
"olddisplay"
);
});
test
(
"animate(Hash, Object, Function)"
,
function
()
{
...
...
@@ -1127,7 +1127,8 @@ test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function ()
test
(
"interrupt toggle"
,
function
()
{
expect
(
24
);
var
longDuration
=
2000
,
var
env
=
this
,
longDuration
=
2000
,
shortDuration
=
500
,
remaining
=
0
,
$elems
=
jQuery
(
".chain-test"
),
...
...
@@ -1144,7 +1145,7 @@ test( "interrupt toggle", function() {
jQuery
.
data
(
this
,
"startVal"
,
jQuery
(
this
).
css
(
prop
)
);
// Expect olddisplay data from our .hide() call below
QUnit
.
expectJqData
(
this
,
"olddisplay"
);
QUnit
.
expectJqData
(
env
,
this
,
"olddisplay"
);
});
// Interrupt a hiding toggle
...
...
@@ -1551,7 +1552,8 @@ test( "User supplied callback called after show when fx off (#8892)", 2, functio
test
(
"animate should set display for disconnected nodes"
,
function
()
{
expect
(
18
);
var
methods
=
{
var
env
=
this
,
methods
=
{
toggle
:
[
1
],
slideToggle
:
[],
fadeIn
:
[],
...
...
@@ -1572,9 +1574,9 @@ test( "animate should set display for disconnected nodes", function() {
strictEqual
(
$divNone
.
show
()[
0
].
style
.
display
,
"block"
,
"show() should change display if it already set to none"
);
strictEqual
(
$divInline
.
show
()[
0
].
style
.
display
,
"inline"
,
"show() should not change display if it already set"
);
QUnit
.
expectJqData
(
$divTest
[
0
],
"olddisplay"
);
QUnit
.
expectJqData
(
$divEmpty
[
0
],
"olddisplay"
);
QUnit
.
expectJqData
(
$divNone
[
0
],
"olddisplay"
);
QUnit
.
expectJqData
(
env
,
$divTest
[
0
],
"olddisplay"
);
QUnit
.
expectJqData
(
env
,
$divEmpty
[
0
],
"olddisplay"
);
QUnit
.
expectJqData
(
env
,
$divNone
[
0
],
"olddisplay"
);
jQuery
.
each
(
methods
,
function
(
name
,
opt
)
{
jQuery
.
each
([
...
...
@@ -1589,7 +1591,7 @@ test( "animate should set display for disconnected nodes", function() {
var
callback
=
[
function
()
{
strictEqual
(
this
.
style
.
display
,
"block"
,
"set display to block with "
+
name
);
QUnit
.
expectJqData
(
this
,
"olddisplay"
);
QUnit
.
expectJqData
(
env
,
this
,
"olddisplay"
);
}];
jQuery
.
fn
[
name
].
apply
(
this
,
opt
.
concat
(
callback
)
);
...
...
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