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
52394ba9
Commit
52394ba9
authored
Apr 08, 2013
by
Michał Gołębiowski
Committed by
Dave Methvin
Apr 09, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move size() test to deprecated.js and avoid in other tests. Close gh-1237.
parent
bea0d9a4
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
48 additions
and
48 deletions
+48
-48
ajax.js
test/unit/ajax.js
+1
-2
attributes.js
test/unit/attributes.js
+1
-1
core.js
test/unit/core.js
+1
-6
css.js
test/unit/css.js
+1
-1
data.js
test/unit/data.js
+1
-1
deprecated.js
test/unit/deprecated.js
+8
-1
effects.js
test/unit/effects.js
+17
-19
queue.js
test/unit/queue.js
+3
-4
traversing.js
test/unit/traversing.js
+15
-13
No files found.
test/unit/ajax.js
View file @
52394ba9
...
@@ -1799,8 +1799,7 @@ module( "ajax", {
...
@@ -1799,8 +1799,7 @@ module( "ajax", {
});
});
asyncTest
(
"jQuery.fn.load() - callbacks get the correct parameters"
,
8
,
function
()
{
asyncTest
(
"jQuery.fn.load() - callbacks get the correct parameters"
,
8
,
function
()
{
var
slice
=
[].
slice
,
var
completeArgs
=
{};
completeArgs
=
{};
jQuery
.
ajaxSetup
({
jQuery
.
ajaxSetup
({
success
:
function
(
_
,
status
,
jqXHR
)
{
success
:
function
(
_
,
status
,
jqXHR
)
{
...
...
test/unit/attributes.js
View file @
52394ba9
...
@@ -1017,7 +1017,7 @@ var testAddClass = function( valueObj ) {
...
@@ -1017,7 +1017,7 @@ var testAddClass = function( valueObj ) {
var
div
=
jQuery
(
"#qunit-fixture div"
);
var
div
=
jQuery
(
"#qunit-fixture div"
);
div
.
addClass
(
valueObj
(
"test"
)
);
div
.
addClass
(
valueObj
(
"test"
)
);
var
pass
=
true
;
var
pass
=
true
;
for
(
var
i
=
0
;
i
<
div
.
size
()
;
i
++
)
{
for
(
var
i
=
0
;
i
<
div
.
length
;
i
++
)
{
if
(
!~
div
.
get
(
i
).
className
.
indexOf
(
"test"
)
)
{
if
(
!~
div
.
get
(
i
).
className
.
indexOf
(
"test"
)
)
{
pass
=
false
;
pass
=
false
;
}
}
...
...
test/unit/core.js
View file @
52394ba9
...
@@ -677,11 +677,6 @@ test("length", function() {
...
@@ -677,11 +677,6 @@ test("length", function() {
equal
(
jQuery
(
"#qunit-fixture p"
).
length
,
6
,
"Get Number of Elements Found"
);
equal
(
jQuery
(
"#qunit-fixture p"
).
length
,
6
,
"Get Number of Elements Found"
);
});
});
test
(
"size()"
,
function
()
{
expect
(
1
);
equal
(
jQuery
(
"#qunit-fixture p"
).
size
(),
6
,
"Get Number of Elements Found"
);
});
test
(
"get()"
,
function
()
{
test
(
"get()"
,
function
()
{
expect
(
1
);
expect
(
1
);
deepEqual
(
jQuery
(
"#qunit-fixture p"
).
get
(),
q
(
"firstp"
,
"ap"
,
"sndp"
,
"en"
,
"sap"
,
"first"
),
"Get All Elements"
);
deepEqual
(
jQuery
(
"#qunit-fixture p"
).
get
(),
q
(
"firstp"
,
"ap"
,
"sndp"
,
"en"
,
"sap"
,
"first"
),
"Get All Elements"
);
...
@@ -747,7 +742,7 @@ test("each(Function)", function() {
...
@@ -747,7 +742,7 @@ test("each(Function)", function() {
var
div
=
jQuery
(
"div"
);
var
div
=
jQuery
(
"div"
);
div
.
each
(
function
(){
this
.
foo
=
"zoo"
;});
div
.
each
(
function
(){
this
.
foo
=
"zoo"
;});
var
pass
=
true
;
var
pass
=
true
;
for
(
var
i
=
0
;
i
<
div
.
size
()
;
i
++
)
{
for
(
var
i
=
0
;
i
<
div
.
length
;
i
++
)
{
if
(
div
.
get
(
i
).
foo
!=
"zoo"
)
{
if
(
div
.
get
(
i
).
foo
!=
"zoo"
)
{
pass
=
false
;
pass
=
false
;
}
}
...
...
test/unit/css.js
View file @
52394ba9
...
@@ -528,7 +528,7 @@ test( "show() resolves correct default display for detached nodes", function(){
...
@@ -528,7 +528,7 @@ test( "show() resolves correct default display for detached nodes", function(){
equal
(
tr
[
0
].
style
.
display
,
trDisplay
,
"For detached tr elements, display should always be like for attached trs"
);
equal
(
tr
[
0
].
style
.
display
,
trDisplay
,
"For detached tr elements, display should always be like for attached trs"
);
tr
.
remove
();
tr
.
remove
();
span
=
span
=
jQuery
(
"<span/>"
).
hide
().
show
();
span
=
jQuery
(
"<span/>"
).
hide
().
show
();
equal
(
span
[
0
].
style
.
display
,
"inline"
,
"For detached span elements, display should always be inline"
);
equal
(
span
[
0
].
style
.
display
,
"inline"
,
"For detached span elements, display should always be inline"
);
span
.
remove
();
span
.
remove
();
});
});
...
...
test/unit/data.js
View file @
52394ba9
...
@@ -63,7 +63,7 @@ test( "jQuery.hasData no side effects", function() {
...
@@ -63,7 +63,7 @@ test( "jQuery.hasData no side effects", function() {
});
});
function
dataTests
(
elem
)
{
function
dataTests
(
elem
)
{
var
oldCacheLength
,
dataObj
,
internalDataObj
,
expected
,
actual
;
var
dataObj
,
internalDataObj
;
equal
(
jQuery
.
data
(
elem
,
"foo"
),
undefined
,
"No data exists initially"
);
equal
(
jQuery
.
data
(
elem
,
"foo"
),
undefined
,
"No data exists initially"
);
strictEqual
(
jQuery
.
hasData
(
elem
),
false
,
"jQuery.hasData agrees no data exists initially"
);
strictEqual
(
jQuery
.
hasData
(
elem
),
false
,
"jQuery.hasData agrees no data exists initially"
);
...
...
test/unit/deprecated.js
View file @
52394ba9
module
(
"deprecated"
);
module
(
"deprecated"
,
{
teardown
:
moduleTeardown
});
if
(
jQuery
.
fn
.
size
)
{
test
(
"size()"
,
function
()
{
expect
(
1
);
equal
(
jQuery
(
"#qunit-fixture p"
).
size
(),
6
,
"Get Number of Elements Found"
);
});
}
test/unit/effects.js
View file @
52394ba9
...
@@ -51,8 +51,6 @@ test("show()", 27, function () {
...
@@ -51,8 +51,6 @@ test("show()", 27, function () {
hiddendiv
.
css
(
"display"
,
""
);
hiddendiv
.
css
(
"display"
,
""
);
var
displaysActual
=
[],
displaysExpected
=
[];
div
=
jQuery
(
"#fx-queue div"
).
slice
(
0
,
4
);
div
=
jQuery
(
"#fx-queue div"
).
slice
(
0
,
4
);
div
.
show
().
each
(
function
()
{
div
.
show
().
each
(
function
()
{
notEqual
(
this
.
style
.
display
,
"none"
,
"don't change any <div> with display block"
);
notEqual
(
this
.
style
.
display
,
"none"
,
"don't change any <div> with display block"
);
...
@@ -172,7 +170,7 @@ test("Persist correct display value", function() {
...
@@ -172,7 +170,7 @@ test("Persist correct display value", function() {
var
$span
=
jQuery
(
"#show-tests span"
),
var
$span
=
jQuery
(
"#show-tests span"
),
displayNone
=
$span
.
css
(
"display"
),
displayNone
=
$span
.
css
(
"display"
),
display
=
""
,
num
=
0
;
display
=
""
;
$span
.
show
();
$span
.
show
();
...
@@ -609,8 +607,7 @@ test("stop() - several in queue", function() {
...
@@ -609,8 +607,7 @@ test("stop() - several in queue", function() {
expect
(
5
);
expect
(
5
);
var
nw
,
time
,
var
nw
,
time
,
$foo
=
jQuery
(
"#foo"
),
$foo
=
jQuery
(
"#foo"
);
w
=
0
;
// default duration is 400ms, so 800px ensures we aren't 0 or 1 after 1ms
// default duration is 400ms, so 800px ensures we aren't 0 or 1 after 1ms
$foo
.
hide
().
css
(
"width"
,
800
);
$foo
.
hide
().
css
(
"width"
,
800
);
...
@@ -1283,17 +1280,18 @@ test("callbacks should fire in correct order (#9100)", function() {
...
@@ -1283,17 +1280,18 @@ test("callbacks should fire in correct order (#9100)", function() {
stop
();
stop
();
var
a
=
1
,
var
a
=
1
,
cb
=
0
,
cb
=
0
;
$lis
=
jQuery
(
"<p data-operation='*2'></p><p data-operation='^2'></p>"
).
appendTo
(
"#qunit-fixture"
)
// The test will always pass if no properties are animated or if the duration is 0
jQuery
(
"<p data-operation='*2'></p><p data-operation='^2'></p>"
).
appendTo
(
"#qunit-fixture"
)
.
animate
({
fontSize
:
12
},
13
,
function
()
{
// The test will always pass if no properties are animated or if the duration is 0
a
*=
jQuery
(
this
).
data
(
"operation"
)
===
"*2"
?
2
:
a
;
.
animate
({
fontSize
:
12
},
13
,
function
()
{
cb
++
;
a
*=
jQuery
(
this
).
data
(
"operation"
)
===
"*2"
?
2
:
a
;
if
(
cb
===
2
)
{
cb
++
;
equal
(
a
,
4
,
"test value has been *2 and _then_ ^2"
);
if
(
cb
===
2
)
{
start
();
equal
(
a
,
4
,
"test value has been *2 and _then_ ^2"
);
}
start
();
});
}
});
});
});
asyncTest
(
"callbacks that throw exceptions will be removed (#5684)"
,
function
()
{
asyncTest
(
"callbacks that throw exceptions will be removed (#5684)"
,
function
()
{
...
@@ -1301,11 +1299,11 @@ asyncTest( "callbacks that throw exceptions will be removed (#5684)", function()
...
@@ -1301,11 +1299,11 @@ asyncTest( "callbacks that throw exceptions will be removed (#5684)", function()
var
foo
=
jQuery
(
"#foo"
);
var
foo
=
jQuery
(
"#foo"
);
function
t
estException
()
{
function
T
estException
()
{
}
}
foo
.
animate
({
height
:
1
},
1
,
function
()
{
foo
.
animate
({
height
:
1
},
1
,
function
()
{
throw
new
t
estException
();
throw
new
T
estException
();
});
});
// this test thoroughly abuses undocumented methods - please feel free to update
// this test thoroughly abuses undocumented methods - please feel free to update
...
@@ -1317,7 +1315,7 @@ asyncTest( "callbacks that throw exceptions will be removed (#5684)", function()
...
@@ -1317,7 +1315,7 @@ asyncTest( "callbacks that throw exceptions will be removed (#5684)", function()
setTimeout
(
function
()
{
setTimeout
(
function
()
{
// the first call to fx.tick should raise the callback exception
// the first call to fx.tick should raise the callback exception
raises
(
jQuery
.
fx
.
tick
,
t
estException
,
"Exception was thrown"
);
raises
(
jQuery
.
fx
.
tick
,
T
estException
,
"Exception was thrown"
);
// the second call shouldn't
// the second call shouldn't
jQuery
.
fx
.
tick
();
jQuery
.
fx
.
tick
();
...
...
test/unit/queue.js
View file @
52394ba9
...
@@ -27,7 +27,7 @@ test( "queue() with other types", 14, function() {
...
@@ -27,7 +27,7 @@ test( "queue() with other types", 14, function() {
equal
(
++
counter
,
4
,
"Dequeuing"
);
equal
(
++
counter
,
4
,
"Dequeuing"
);
});
});
defer
=
$div
.
promise
(
"foo"
).
done
(
function
()
{
$div
.
promise
(
"foo"
).
done
(
function
()
{
equal
(
counter
,
4
,
"Testing previous call to dequeue in deferred"
);
equal
(
counter
,
4
,
"Testing previous call to dequeue in deferred"
);
start
();
start
();
});
});
...
@@ -81,7 +81,6 @@ test("queue() passes in the next item in the queue as a parameter to fx queues",
...
@@ -81,7 +81,6 @@ test("queue() passes in the next item in the queue as a parameter to fx queues",
div
.
queue
(
function
(
next
)
{
div
.
queue
(
function
(
next
)
{
equal
(
++
counter
,
1
,
"Dequeueing"
);
equal
(
++
counter
,
1
,
"Dequeueing"
);
var
self
=
this
;
setTimeout
(
function
()
{
next
();
},
500
);
setTimeout
(
function
()
{
next
();
},
500
);
}).
queue
(
function
(
next
)
{
}).
queue
(
function
(
next
)
{
equal
(
++
counter
,
2
,
"Next was called"
);
equal
(
++
counter
,
2
,
"Next was called"
);
...
@@ -156,7 +155,7 @@ test("clearQueue(name) clears the queue", function() {
...
@@ -156,7 +155,7 @@ test("clearQueue(name) clears the queue", function() {
counter
++
;
counter
++
;
jQuery
(
this
).
clearQueue
(
"foo"
);
jQuery
(
this
).
clearQueue
(
"foo"
);
next
();
next
();
}).
queue
(
"foo"
,
function
(
next
)
{
}).
queue
(
"foo"
,
function
(
next
)
{
counter
++
;
counter
++
;
});
});
...
@@ -180,7 +179,7 @@ test("clearQueue() clears the fx queue", function() {
...
@@ -180,7 +179,7 @@ test("clearQueue() clears the fx queue", function() {
counter
++
;
counter
++
;
var
self
=
this
;
var
self
=
this
;
setTimeout
(
function
()
{
jQuery
(
self
).
clearQueue
();
next
();
},
50
);
setTimeout
(
function
()
{
jQuery
(
self
).
clearQueue
();
next
();
},
50
);
}).
queue
(
function
(
next
)
{
}).
queue
(
function
(
next
)
{
counter
++
;
counter
++
;
});
});
...
...
test/unit/traversing.js
View file @
52394ba9
...
@@ -143,12 +143,13 @@ test("is() with :has() selectors", function() {
...
@@ -143,12 +143,13 @@ test("is() with :has() selectors", function() {
test
(
"is() with positional selectors"
,
function
()
{
test
(
"is() with positional selectors"
,
function
()
{
expect
(
24
);
expect
(
24
);
var
html
=
jQuery
(
var
isit
=
function
(
sel
,
match
,
expect
)
{
"<p id='posp'><a class='firsta' href='#'><em>first</em></a><a class='seconda' href='#'><b>test</b></a><em></em></p>"
equal
(
jQuery
(
sel
).
is
(
match
),
expect
,
"jQuery('"
+
sel
+
"').is('"
+
match
+
"')"
);
).
appendTo
(
"#qunit-fixture"
),
};
isit
=
function
(
sel
,
match
,
expect
)
{
equal
(
jQuery
(
sel
).
is
(
match
),
expect
,
"jQuery('"
+
sel
+
"').is('"
+
match
+
"')"
);
jQuery
(
};
"<p id='posp'><a class='firsta' href='#'><em>first</em></a><a class='seconda' href='#'><b>test</b></a><em></em></p>"
).
appendTo
(
"#qunit-fixture"
);
isit
(
"#posp"
,
"#posp:first"
,
true
);
isit
(
"#posp"
,
"#posp:first"
,
true
);
isit
(
"#posp"
,
"#posp:eq(2)"
,
false
);
isit
(
"#posp"
,
"#posp:eq(2)"
,
false
);
...
@@ -271,7 +272,11 @@ test("filter(jQuery)", function() {
...
@@ -271,7 +272,11 @@ test("filter(jQuery)", function() {
test
(
"filter() with positional selectors"
,
function
()
{
test
(
"filter() with positional selectors"
,
function
()
{
expect
(
19
);
expect
(
19
);
var
html
=
jQuery
(
""
+
var
filterit
=
function
(
sel
,
filter
,
length
)
{
equal
(
jQuery
(
sel
).
filter
(
filter
).
length
,
length
,
"jQuery( "
+
sel
+
" ).filter( "
+
filter
+
" )"
);
};
jQuery
(
""
+
"<p id='posp'>"
+
"<p id='posp'>"
+
"<a class='firsta' href='#'>"
+
"<a class='firsta' href='#'>"
+
"<em>first</em>"
+
"<em>first</em>"
+
...
@@ -280,10 +285,7 @@ test("filter() with positional selectors", function() {
...
@@ -280,10 +285,7 @@ test("filter() with positional selectors", function() {
"<b>test</b>"
+
"<b>test</b>"
+
"</a>"
+
"</a>"
+
"<em></em>"
+
"<em></em>"
+
"</p>"
).
appendTo
(
"#qunit-fixture"
),
"</p>"
).
appendTo
(
"#qunit-fixture"
);
filterit
=
function
(
sel
,
filter
,
length
)
{
equal
(
jQuery
(
sel
).
filter
(
filter
).
length
,
length
,
"jQuery( "
+
sel
+
" ).filter( "
+
filter
+
" )"
);
};
filterit
(
"#posp"
,
"#posp:first"
,
1
);
filterit
(
"#posp"
,
"#posp:first"
,
1
);
filterit
(
"#posp"
,
"#posp:eq(2)"
,
0
);
filterit
(
"#posp"
,
"#posp:eq(2)"
,
0
);
...
@@ -424,7 +426,7 @@ test("has(Element)", function() {
...
@@ -424,7 +426,7 @@ test("has(Element)", function() {
deepEqual
(
detached
.
has
(
detached
.
find
(
"i"
)[
0
]
).
get
(),
detached
.
get
(),
"...Even when detached"
);
deepEqual
(
detached
.
has
(
detached
.
find
(
"i"
)[
0
]
).
get
(),
detached
.
get
(),
"...Even when detached"
);
var
multipleParent
=
jQuery
(
"#qunit-fixture, #header"
).
has
(
jQuery
(
"#sndp"
)[
0
]);
var
multipleParent
=
jQuery
(
"#qunit-fixture, #header"
).
has
(
jQuery
(
"#sndp"
)[
0
]);
deepEqual
(
obj
.
get
(),
q
(
"qunit-fixture"
),
"Does not include elements that do not have the element as a descendant"
);
deepEqual
(
multipleParent
.
get
(),
q
(
"qunit-fixture"
),
"Does not include elements that do not have the element as a descendant"
);
});
});
test
(
"has(Selector)"
,
function
()
{
test
(
"has(Selector)"
,
function
()
{
...
@@ -459,7 +461,7 @@ test("has(Arrayish)", function() {
...
@@ -459,7 +461,7 @@ test("has(Arrayish)", function() {
deepEqual
(
multipleParent
.
get
(),
q
(
"qunit-fixture"
),
"Does not include elements that do not have an element in the jQuery list as a descendant"
);
deepEqual
(
multipleParent
.
get
(),
q
(
"qunit-fixture"
),
"Does not include elements that do not have an element in the jQuery list as a descendant"
);
var
multipleHas
=
jQuery
(
"#qunit-fixture"
).
has
(
jQuery
(
"#sndp, #first"
));
var
multipleHas
=
jQuery
(
"#qunit-fixture"
).
has
(
jQuery
(
"#sndp, #first"
));
deepEqual
(
simple
.
get
(),
q
(
"qunit-fixture"
),
"Only adds elements once"
);
deepEqual
(
multipleHas
.
get
(),
q
(
"qunit-fixture"
),
"Only adds elements once"
);
});
});
test
(
"addBack()"
,
function
()
{
test
(
"addBack()"
,
function
()
{
...
...
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