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
3dc55042
Commit
3dc55042
authored
Apr 05, 2014
by
Oleg Gaidarenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests: Comply the style guide
parent
d89c278a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
testrunner.js
test/data/testrunner.js
+16
-16
No files found.
test/data/testrunner.js
View file @
3dc55042
...
@@ -25,7 +25,7 @@ QUnit.config.requireExpects = true;
...
@@ -25,7 +25,7 @@ QUnit.config.requireExpects = true;
* QUnit hooks
* QUnit hooks
*/
*/
function
keys
(
o
)
{
function
keys
(
o
)
{
var
ret
,
key
;
var
ret
,
key
;
if
(
Object
.
keys
)
{
if
(
Object
.
keys
)
{
ret
=
Object
.
keys
(
o
);
ret
=
Object
.
keys
(
o
);
...
@@ -59,7 +59,7 @@ QUnit.expectJqData = function( elems, key ) {
...
@@ -59,7 +59,7 @@ QUnit.expectJqData = function( elems, key ) {
}
}
for
(
i
=
0
;
i
<
elems
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
elems
.
length
;
i
++
)
{
elem
=
elems
[
i
];
elem
=
elems
[
i
];
// jQuery.data only stores data for nodes in jQuery.cache,
// jQuery.data only stores data for nodes in jQuery.cache,
// for other data targets the data is stored in the object itself,
// for other data targets the data is stored in the object itself,
...
@@ -83,10 +83,10 @@ QUnit.expectJqData = function( elems, key ) {
...
@@ -83,10 +83,10 @@ QUnit.expectJqData = function( elems, key ) {
// (instead of in teardown).
// (instead of in teardown).
notStrictEqual
(
expando
,
undefined
,
"Target for expectJqData must have an expando, for else there can be no data to expect."
);
notStrictEqual
(
expando
,
undefined
,
"Target for expectJqData must have an expando, for else there can be no data to expect."
);
}
else
{
}
else
{
if
(
expectedDataKeys
[
expando
]
)
{
if
(
expectedDataKeys
[
expando
]
)
{
expectedDataKeys
[
expando
].
push
(
key
);
expectedDataKeys
[
expando
].
push
(
key
);
}
else
{
}
else
{
expectedDataKeys
[
expando
]
=
[
key
];
expectedDataKeys
[
expando
]
=
[
key
];
}
}
}
}
}
}
...
@@ -112,18 +112,18 @@ window.moduleTeardown = function() {
...
@@ -112,18 +112,18 @@ window.moduleTeardown = function() {
// provided some information to compare against.
// provided some information to compare against.
if
(
QUnit
.
urlParams
.
jqdata
||
this
.
checkJqData
)
{
if
(
QUnit
.
urlParams
.
jqdata
||
this
.
checkJqData
)
{
for
(
i
in
jQuery
.
cache
)
{
for
(
i
in
jQuery
.
cache
)
{
expectedKeys
=
expectedDataKeys
[
i
];
expectedKeys
=
expectedDataKeys
[
i
];
actualKeys
=
jQuery
.
cache
[
i
]
?
keys
(
jQuery
.
cache
[
i
]
)
:
jQuery
.
cache
[
i
];
actualKeys
=
jQuery
.
cache
[
i
]
?
keys
(
jQuery
.
cache
[
i
]
)
:
jQuery
.
cache
[
i
];
if
(
!
QUnit
.
equiv
(
expectedKeys
,
actualKeys
)
)
{
if
(
!
QUnit
.
equiv
(
expectedKeys
,
actualKeys
)
)
{
deepEqual
(
actualKeys
,
expectedKeys
,
"Expected keys exist in jQuery.cache"
);
deepEqual
(
actualKeys
,
expectedKeys
,
"Expected keys exist in jQuery.cache"
);
}
}
delete
jQuery
.
cache
[
i
];
delete
jQuery
.
cache
[
i
];
delete
expectedDataKeys
[
i
];
delete
expectedDataKeys
[
i
];
}
}
// In case it was removed from cache before (or never there in the first place)
// In case it was removed from cache before (or never there in the first place)
for
(
i
in
expectedDataKeys
)
{
for
(
i
in
expectedDataKeys
)
{
deepEqual
(
expectedDataKeys
[
i
],
undefined
,
"No unexpected keys were left in jQuery.cache (#"
+
i
+
"
)"
);
deepEqual
(
expectedDataKeys
[
i
],
undefined
,
"No unexpected keys were left in jQuery.cache (#"
+
i
+
"
)"
);
delete
expectedDataKeys
[
i
];
delete
expectedDataKeys
[
i
];
}
}
}
}
...
@@ -139,7 +139,7 @@ window.moduleTeardown = function() {
...
@@ -139,7 +139,7 @@ window.moduleTeardown = function() {
if
(
jQuery
.
active
!==
undefined
&&
jQuery
.
active
!==
oldActive
)
{
if
(
jQuery
.
active
!==
undefined
&&
jQuery
.
active
!==
oldActive
)
{
equal
(
jQuery
.
active
,
oldActive
,
"No AJAX requests are still active"
);
equal
(
jQuery
.
active
,
oldActive
,
"No AJAX requests are still active"
);
if
(
ajaxTest
.
abort
)
{
if
(
ajaxTest
.
abort
)
{
ajaxTest
.
abort
(
"active requests"
);
ajaxTest
.
abort
(
"active requests"
);
}
}
oldActive
=
jQuery
.
active
;
oldActive
=
jQuery
.
active
;
}
}
...
@@ -160,16 +160,16 @@ window.moduleTeardown = function() {
...
@@ -160,16 +160,16 @@ window.moduleTeardown = function() {
QUnit
.
done
(
function
()
{
QUnit
.
done
(
function
()
{
// Remove our own fixtures outside #qunit-fixture
// Remove our own fixtures outside #qunit-fixture
supportjQuery
(
"#qunit ~ *"
).
remove
();
supportjQuery
(
"#qunit ~ *"
).
remove
();
});
});
// jQuery-specific post-test cleanup
// jQuery-specific post-test cleanup
reset
=
function
()
{
reset
=
function
()
{
// Ensure jQuery events and data on the fixture are properly removed
// Ensure jQuery events and data on the fixture are properly removed
jQuery
(
"#qunit-fixture"
).
empty
();
jQuery
(
"#qunit-fixture"
).
empty
();
// ...even if the jQuery under test has a broken .empty()
// ...even if the jQuery under test has a broken .empty()
supportjQuery
(
"#qunit-fixture"
).
empty
();
supportjQuery
(
"#qunit-fixture"
).
empty
();
// Reset internal jQuery state
// Reset internal jQuery state
jQuery
.
event
.
global
=
{};
jQuery
.
event
.
global
=
{};
...
@@ -183,7 +183,7 @@ reset = function() {
...
@@ -183,7 +183,7 @@ reset = function() {
Globals
.
cleanup
();
Globals
.
cleanup
();
};
};
QUnit
.
testDone
(
reset
);
QUnit
.
testDone
(
reset
);
// Register globals for cleanup and the cleanup code itself
// Register globals for cleanup and the cleanup code itself
// Explanation at http://perfectionkills.com/understanding-delete/#ie_bugs
// Explanation at http://perfectionkills.com/understanding-delete/#ie_bugs
...
...
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