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
58003c44
Commit
58003c44
authored
Jan 08, 2013
by
Corey Frang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding some more test coverage for .finish()
parent
46bbda8d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
1 deletion
+72
-1
effects.js
test/unit/effects.js
+72
-1
No files found.
test/unit/effects.js
View file @
58003c44
...
@@ -1920,7 +1920,7 @@ test( ".finish() completes all queued animations", function() {
...
@@ -1920,7 +1920,7 @@ test( ".finish() completes all queued animations", function() {
anim
[
prop
]
=
value
;
anim
[
prop
]
=
value
;
// the delay shouldn't matter at all!
// the delay shouldn't matter at all!
div
.
css
(
prop
,
1
).
animate
(
anim
,
function
()
{
div
.
css
(
prop
,
1
).
animate
(
anim
,
function
()
{
ok
(
true
,
"Called animation callback
"
);
ok
(
true
,
"Called animation callback
for "
+
prop
);
}).
delay
(
100
);
}).
delay
(
100
);
});
});
equal
(
div
.
queue
().
length
,
8
,
"8 animations in the queue"
);
equal
(
div
.
queue
().
length
,
8
,
"8 animations in the queue"
);
...
@@ -1937,6 +1937,77 @@ test( ".finish() completes all queued animations", function() {
...
@@ -1937,6 +1937,77 @@ test( ".finish() completes all queued animations", function() {
jQuery
.
fx
.
tick
();
jQuery
.
fx
.
tick
();
});
});
test
(
".finish( false ) - unqueued animations"
,
function
()
{
var
animations
=
{
top
:
100
,
left
:
100
,
height
:
100
,
width
:
100
},
div
=
jQuery
(
"<div>"
);
expect
(
10
);
jQuery
.
each
(
animations
,
function
(
prop
,
value
)
{
var
anim
=
{};
anim
[
prop
]
=
value
;
div
.
css
(
prop
,
1
).
animate
(
anim
,
{
queue
:
false
,
complete
:
function
()
{
ok
(
true
,
"Called animation callback for "
+
prop
);
}
});
});
equal
(
div
.
queue
().
length
,
0
,
"0 animations in the queue"
);
div
.
finish
(
false
);
jQuery
.
each
(
animations
,
function
(
prop
,
value
)
{
equal
(
parseFloat
(
div
.
css
(
prop
)
),
value
,
prop
+
" finished at correct value"
);
});
equal
(
div
.
is
(
":animated"
),
false
,
":animated doesn't match"
);
// cleanup
div
.
remove
();
// leaves a "shadow timer" which does nothing around, need to force a tick
jQuery
.
fx
.
tick
();
});
test
(
".finish(
\"
custom
\"
) - custom queue animations"
,
function
()
{
var
animations
=
{
top
:
100
,
left
:
100
,
height
:
100
,
width
:
100
},
div
=
jQuery
(
"<div>"
);
expect
(
11
);
jQuery
.
each
(
animations
,
function
(
prop
,
value
)
{
var
anim
=
{};
anim
[
prop
]
=
value
;
div
.
css
(
prop
,
1
).
animate
(
anim
,
{
queue
:
"custom"
,
complete
:
function
()
{
ok
(
true
,
"Called animation callback for "
+
prop
);
}
});
});
equal
(
div
.
queue
(
"custom"
).
length
,
4
,
"4 animations in the queue"
);
// start the first animation
div
.
dequeue
(
"custom"
);
equal
(
div
.
is
(
":animated"
),
true
,
":animated matches"
);
div
.
finish
(
"custom"
);
jQuery
.
each
(
animations
,
function
(
prop
,
value
)
{
equal
(
parseFloat
(
div
.
css
(
prop
)
),
value
,
prop
+
" finished at correct value"
);
});
equal
(
div
.
is
(
":animated"
),
false
,
":animated doesn't match"
);
// cleanup
div
.
remove
();
// leaves a "shadow timer" which does nothing around, need to force a tick
jQuery
.
fx
.
tick
();
});
test
(
".finish() calls finish of custom queue functions"
,
function
()
{
test
(
".finish() calls finish of custom queue functions"
,
function
()
{
function
queueTester
(
next
)
{
function
queueTester
(
next
)
{
...
...
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