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
ab756cea
Commit
ab756cea
authored
Apr 28, 2008
by
Jörn Zaefferer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jquery core: tests for #2616
parent
b84b997e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1619 additions
and
1593 deletions
+1619
-1593
core.js
test/unit/core.js
+1619
-1593
No files found.
test/unit/core.js
View file @
ab756cea
...
@@ -1511,7 +1511,7 @@ test("slice()", function() {
...
@@ -1511,7 +1511,7 @@ test("slice()", function() {
});
});
test
(
"map()"
,
function
()
{
test
(
"map()"
,
function
()
{
expect
(
2
);
expect
(
6
);
isSet
(
isSet
(
$
(
"#ap"
).
map
(
function
(){
$
(
"#ap"
).
map
(
function
(){
...
@@ -1528,6 +1528,32 @@ test("map()", function() {
...
@@ -1528,6 +1528,32 @@ test("map()", function() {
q
(
"ap"
,
"ap"
,
"ap"
),
q
(
"ap"
,
"ap"
,
"ap"
),
"Single Map"
"Single Map"
);
);
//for #2616
var
keys
=
$
.
map
(
{
a
:
1
,
b
:
2
},
function
(
v
,
k
){
return
k
;
},
[
]
);
equals
(
keys
.
join
(
""
),
"ab"
,
"Map the keys from a hash to an array"
);
var
values
=
$
.
map
(
{
a
:
1
,
b
:
2
},
function
(
v
,
k
){
return
v
;
},
[
]
);
equals
(
values
.
join
(
""
),
"12"
,
"Map the values from a hash to an array"
);
var
scripts
=
document
.
getElementsByTagName
(
"script"
);
var
mapped
=
$
.
map
(
scripts
,
function
(
v
,
k
){
return
v
;
},
{
length
:
0
}
);
equals
(
mapped
.
length
,
scripts
.
length
,
"Map an array(-like) to a hash"
);
var
flat
=
$
.
map
(
Array
(
4
),
function
(
v
,
k
){
return
k
%
2
?
k
:
[
k
,
k
,
k
];
//try mixing array and regular returns
});
equals
(
flat
.
join
(
""
),
"00012223"
,
"try the new flatten technique(#2616)"
);
});
});
test
(
"contents()"
,
function
()
{
test
(
"contents()"
,
function
()
{
...
...
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