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
0e63c789
Commit
0e63c789
authored
May 24, 2008
by
Ariel Flesler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test runner: adding more tests for attr(). Related to [5574] and [5683].
parent
cff5323a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
128 additions
and
107 deletions
+128
-107
core.js
test/unit/core.js
+128
-107
No files found.
test/unit/core.js
View file @
0e63c789
...
@@ -320,7 +320,7 @@ test("index(Object)", function() {
...
@@ -320,7 +320,7 @@ test("index(Object)", function() {
});
});
test
(
"attr(String)"
,
function
()
{
test
(
"attr(String)"
,
function
()
{
expect
(
2
0
);
expect
(
2
6
);
equals
(
$
(
'#text1'
).
attr
(
'value'
),
"Test"
,
'Check for value attribute'
);
equals
(
$
(
'#text1'
).
attr
(
'value'
),
"Test"
,
'Check for value attribute'
);
equals
(
$
(
'#text1'
).
attr
(
'value'
,
"Test2"
).
attr
(
'defaultValue'
),
"Test"
,
'Check for defaultValue attribute'
);
equals
(
$
(
'#text1'
).
attr
(
'value'
,
"Test2"
).
attr
(
'defaultValue'
),
"Test"
,
'Check for defaultValue attribute'
);
equals
(
$
(
'#text1'
).
attr
(
'type'
),
"text"
,
'Check for type attribute'
);
equals
(
$
(
'#text1'
).
attr
(
'type'
),
"text"
,
'Check for type attribute'
);
...
@@ -343,6 +343,27 @@ test("attr(String)", function() {
...
@@ -343,6 +343,27 @@ test("attr(String)", function() {
$
(
'<a id="tAnchor5"></a>'
).
attr
(
'href'
,
'#5'
).
appendTo
(
'#main'
);
// using innerHTML in IE causes href attribute to be serialized to the full path
$
(
'<a id="tAnchor5"></a>'
).
attr
(
'href'
,
'#5'
).
appendTo
(
'#main'
);
// using innerHTML in IE causes href attribute to be serialized to the full path
equals
(
$
(
'#tAnchor5'
).
attr
(
'href'
),
"#5"
,
'Check for non-absolute href (an anchor)'
);
equals
(
$
(
'#tAnchor5'
).
attr
(
'href'
),
"#5"
,
'Check for non-absolute href (an anchor)'
);
// Related to [5574] and [5683]
var
body
=
document
.
body
,
$body
=
$
(
body
);
ok
(
$body
.
attr
(
'foo'
)
===
undefined
,
'Make sure that a non existent attribute returns undefined'
);
ok
(
$body
.
attr
(
'nextSibling'
)
===
null
,
'Make sure a null expando returns null'
);
body
.
setAttribute
(
'foo'
,
'baz'
);
equals
(
$body
.
attr
(
'foo'
),
'baz'
,
'Make sure the dom attribute is retrieved when no expando is found'
);
body
.
foo
=
'bar'
;
equals
(
$body
.
attr
(
'foo'
),
'bar'
,
'Make sure the expando is preferred over the dom attribute'
);
$body
.
attr
(
'foo'
,
'cool'
);
equals
(
$body
.
attr
(
'foo'
),
'cool'
,
'Make sure that setting works well when both expando and dom attribute are available'
);
body
.
foo
=
undefined
;
ok
(
$body
.
attr
(
'foo'
)
===
undefined
,
'Make sure the expando is preferred over the dom attribute, even if undefined'
);
body
.
removeAttribute
(
'foo'
);
// Cleanup
});
});
if
(
!
isLocal
)
{
if
(
!
isLocal
)
{
...
...
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