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
7cfec998
Commit
7cfec998
authored
Jul 13, 2009
by
Yehuda Katz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uses the more stable font-size as a sentinel
parent
c0802e5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
css.js
test/unit/css.js
+14
-12
No files found.
test/unit/css.js
View file @
7cfec998
...
...
@@ -85,7 +85,7 @@ test("css(String, Function)", function() {
try
{
expect
(
3
);
var
colors
=
[
"#ff0000"
,
"#00ff00"
,
"#0000ff
"
];
var
sizes
=
[
"10px"
,
"20px"
,
"30px
"
];
jQuery
(
"<div id='cssFunctionTest'><div class='cssFunction'></div>"
+
"<div class='cssFunction'></div>"
+
...
...
@@ -94,16 +94,18 @@ test("css(String, Function)", function() {
var
index
=
0
;
jQuery
(
"#cssFunctionTest div"
).
css
(
"
color
"
,
function
()
{
var
color
=
color
s
[
index
];
jQuery
(
"#cssFunctionTest div"
).
css
(
"
font-size
"
,
function
()
{
var
size
=
size
s
[
index
];
index
++
;
return
color
;
return
size
;
});
index
=
0
;
jQuery
(
"#cssFunctionTest div"
).
each
(
function
()
{
equals
(
jQuery
(
this
).
css
(
"color"
),
colors
[
index
],
"Div #"
+
index
+
" should be "
+
colors
[
index
]
);
var
computedSize
=
jQuery
(
this
).
css
(
"font-size"
)
var
expectedSize
=
sizes
[
index
]
equals
(
computedSize
,
expectedSize
,
"Div #"
+
index
+
" should be "
+
expectedSize
);
index
++
;
});
...
...
@@ -116,7 +118,7 @@ test("css(Object) where values are Functions", function() {
try
{
expect
(
3
);
var
colors
=
[
"rgb(255, 0, 0)"
,
"rgb(0, 255, 0)"
,
"rgb(0, 0, 255)
"
];
var
sizes
=
[
"10px"
,
"20px"
,
"30px
"
];
jQuery
(
"<div id='cssFunctionTest'><div class='cssFunction'></div>"
+
"<div class='cssFunction'></div>"
+
...
...
@@ -125,18 +127,18 @@ test("css(Object) where values are Functions", function() {
var
index
=
0
;
jQuery
(
"#cssFunctionTest div"
).
css
({
color
:
function
()
{
var
color
=
color
s
[
index
];
jQuery
(
"#cssFunctionTest div"
).
css
({
fontSize
:
function
()
{
var
size
=
size
s
[
index
];
index
++
;
return
color
;
return
size
;
}});
index
=
0
;
jQuery
(
"#cssFunctionTest div"
).
each
(
function
()
{
var
computed
Color
=
jQuery
(
this
).
css
(
"color"
).
replace
(
/ /g
,
''
);
var
expected
Color
=
colors
[
index
].
replace
(
/ /g
,
''
);
equals
(
computed
Color
,
expectedColor
,
"Div #"
+
index
+
" should be "
+
expectedColor
);
var
computed
Size
=
jQuery
(
this
).
css
(
"font-size"
)
var
expected
Size
=
sizes
[
index
]
equals
(
computed
Size
,
expectedSize
,
"Div #"
+
index
+
" should be "
+
expectedSize
);
index
++
;
});
...
...
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