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
291f071e
Commit
291f071e
authored
Apr 22, 2008
by
Ariel Flesler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- adding the tests for the changes to $.makeArray, proposed at #2619
parent
f861c88b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
core.js
test/unit/core.js
+27
-0
No files found.
test/unit/core.js
View file @
291f071e
...
...
@@ -1561,3 +1561,30 @@ test("contents()", function() {
equals
(
c
.
length
,
1
,
"Check node,textnode,comment contents is just one"
);
equals
(
c
[
0
].
nodeValue
,
"hi"
,
"Check node,textnode,comment contents is just the one from span"
);
});
test
(
"makeArray(#2619)"
,
function
(){
expect
(
11
);
equals
(
$
.
makeArray
(
document
.
getElementsByName
(
"PWD"
)).
slice
(
0
,
1
)[
0
].
name
,
"PWD"
,
"Pass makeArray a nodelist"
);
equals
(
(
function
(){
return
$
.
makeArray
(
arguments
);
})(
1
,
2
).
join
(
""
),
"12"
,
"Pass makeArray an arguments array"
);
equals
(
$
.
makeArray
([
1
,
2
,
3
]).
join
(
""
),
"123"
,
"Pass makeArray a real array"
);
equals
(
$
.
makeArray
().
length
,
0
,
"Pass nothing to makeArray and expect an empty array"
);
equals
(
$
.
makeArray
(
0
)[
0
],
0
,
"Pass makeArray a number"
);
equals
(
$
.
makeArray
(
"foo"
)[
0
],
"foo"
,
"Pass makeArray a string"
);
equals
(
typeof
$
.
makeArray
(
true
)[
0
],
"boolean"
,
"Pass makeArray a boolean"
);
equals
(
$
.
makeArray
(
document
.
createElement
(
"div"
)
)[
0
].
nodeName
,
"DIV"
,
"Pass makeArray a single node"
);
equals
(
$
.
makeArray
(
{
length
:
2
,
0
:
"a"
,
1
:
"b"
}
).
join
(
""
),
"ab"
,
"Pass makeArray an array like map (with length)"
);
equals
(
$
.
makeArray
(
document
.
documentElement
.
childNodes
).
slice
(
0
,
1
)[
0
].
nodeName
,
"HEAD"
,
"Pass makeArray a childNodeson array"
);
//function (tricky, they have length)
equals
(
$
.
makeArray
(
function
(){
return
1
;}
)[
0
](),
1
,
"Pass makeArray a function"
);
});
\ No newline at end of file
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