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
2b6a7b1c
Commit
2b6a7b1c
authored
Aug 26, 2013
by
Richard Gibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No ticket: improve line-height animation test robustness
parent
0f03378b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
+26
-11
effects.js
test/unit/effects.js
+26
-11
No files found.
test/unit/effects.js
View file @
2b6a7b1c
...
@@ -1446,7 +1446,8 @@ test("Do not append px to 'fill-opacity' #9548", 1, function() {
...
@@ -1446,7 +1446,8 @@ test("Do not append px to 'fill-opacity' #9548", 1, function() {
});
});
asyncTest
(
"line-height animates correctly (#13855)"
,
12
,
function
()
{
asyncTest
(
"line-height animates correctly (#13855)"
,
12
,
function
()
{
var
var
longDuration
=
2000
,
shortDuration
=
500
,
animated
=
jQuery
(
animated
=
jQuery
(
"<p style='line-height: 100;'>unitless</p>"
+
"<p style='line-height: 100;'>unitless</p>"
+
"<p style='line-height: 5000px;'>px</p>"
+
"<p style='line-height: 5000px;'>px</p>"
+
...
@@ -1455,29 +1456,43 @@ asyncTest("line-height animates correctly (#13855)", 12, function() {
...
@@ -1455,29 +1456,43 @@ asyncTest("line-height animates correctly (#13855)", 12, function() {
).
appendTo
(
"#qunit-fixture"
),
).
appendTo
(
"#qunit-fixture"
),
initialHeight
=
jQuery
.
map
(
animated
,
function
(
el
)
{
initialHeight
=
jQuery
.
map
(
animated
,
function
(
el
)
{
return
jQuery
(
el
).
height
();
return
jQuery
(
el
).
height
();
});
}),
tolerance
=
1.5
,
t0
=
+
(
new
Date
());
animated
.
animate
(
{
"line-height"
:
"hide"
},
1500
);
animated
.
animate
(
{
"line-height"
:
"hide"
},
longDuration
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
var
progress
=
(
(
new
Date
())
-
t0
)
/
longDuration
;
animated
.
each
(
function
(
i
)
{
animated
.
each
(
function
(
i
)
{
var
label
=
jQuery
.
text
(
this
),
var
label
=
jQuery
.
text
(
this
),
initial
=
initialHeight
[
i
],
initial
=
initialHeight
[
i
],
height
=
jQuery
(
this
).
height
();
height
=
jQuery
(
this
).
height
(),
ok
(
height
<
initial
,
"hide "
+
label
+
": upper bound; height: "
+
height
+
"; intitial: "
+
initial
);
lower
=
initial
*
(
1
-
progress
)
/
tolerance
;
ok
(
height
>
initial
/
2
,
"hide "
+
label
+
": lower bound; height: "
+
height
+
"; intitial/2: "
+
initial
/
2
);
ok
(
height
<
initial
,
"hide "
+
label
+
": upper bound; "
+
height
+
" < "
+
initial
+
" @ "
+
(
progress
*
100
)
+
"%"
);
ok
(
height
>
lower
,
"hide "
+
label
+
": lower bound; "
+
height
+
" > "
+
lower
+
" @ "
+
(
progress
*
100
)
+
"%"
);
});
});
animated
.
stop
(
true
,
true
).
hide
().
animate
(
{
"line-height"
:
"show"
},
1500
);
t0
=
+
(
new
Date
());
animated
.
stop
(
true
,
true
).
hide
().
animate
(
{
"line-height"
:
"show"
},
longDuration
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
var
progress
=
(
(
new
Date
())
-
t0
)
/
longDuration
;
animated
.
each
(
function
(
i
)
{
animated
.
each
(
function
(
i
)
{
var
label
=
jQuery
.
text
(
this
),
var
label
=
jQuery
.
text
(
this
),
initial
=
initialHeight
[
i
],
initial
=
initialHeight
[
i
],
height
=
jQuery
(
this
).
height
();
height
=
jQuery
(
this
).
height
(),
ok
(
height
<
initial
/
2
,
"show "
+
label
+
": upper bound; height: "
+
height
+
"; intitial/2: "
+
initial
/
2
);
upper
=
initial
*
progress
*
tolerance
;
ok
(
height
<
upper
,
"show "
+
label
+
": upper bound; "
+
height
+
" < "
+
upper
+
" @ "
+
(
progress
*
100
)
+
"%"
);
});
});
animated
.
stop
(
true
,
true
);
animated
.
stop
(
true
,
true
);
start
();
start
();
},
400
);
},
shortDuration
);
},
400
);
},
shortDuration
);
});
});
// Start 1.8 Animation tests
// Start 1.8 Animation 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