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
ed0e2d1e
Commit
ed0e2d1e
authored
Feb 03, 2013
by
Rick Waldron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds test for jQuery.extend deep copy with array, followed by object. Refutes and Closes #1154
parent
d12b26ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
core.js
test/unit/core.js
+21
-0
No files found.
test/unit/core.js
View file @
ed0e2d1e
...
...
@@ -1019,6 +1019,27 @@ test("jQuery.extend(Object, Object)", function() {
deepEqual
(
options2
,
options2Copy
,
"Check if not modified: options2 must not be modified"
);
});
test
(
"jQuery.extend(true,{},{a:[], o:{}}); deep copy with array, followed by object"
,
function
()
{
expect
(
2
);
var
result
,
initial
=
{
// This will make "copyIsArray" true
array
:
[
1
,
2
,
3
,
4
],
// If "copyIsArray" doesn't get reset to false, the check
// will evaluate true and enter the array copy block
// instead of the object copy block. Since the ternary in the
// "copyIsArray" block will will evaluate to false
// (check if operating on an array with ), this will be
// replaced by an empty array.
object
:
{}
};
result
=
jQuery
.
extend
(
true
,
{},
initial
);
deepEqual
(
result
,
initial
,
"The [result] and [initial] have equal shape and values"
);
ok
(
!
jQuery
.
isArray
(
result
.
object
),
"result.object wasn't paved with an empty array"
);
});
test
(
"jQuery.each(Object,Function)"
,
function
()
{
expect
(
23
);
...
...
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