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
f3a9d308
Commit
f3a9d308
authored
Jul 29, 2011
by
Dave Methvin
Committed by
timmywil
Sep 19, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup for on/off unit test.
parent
5d6a1424
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
event.js
test/unit/event.js
+5
-4
No files found.
test/unit/event.js
View file @
f3a9d308
...
@@ -2208,7 +2208,7 @@ test("custom events with colons (#3533, #8272)", function() {
...
@@ -2208,7 +2208,7 @@ test("custom events with colons (#3533, #8272)", function() {
test
(
".on and .off"
,
function
()
{
test
(
".on and .off"
,
function
()
{
expect
(
9
);
expect
(
9
);
var
counter
;
var
counter
,
mixfn
;
jQuery
(
'<div id="onandoff"><p>on<b>and</b>off</p><div>worked<em>or</em>borked?</div></div>'
).
appendTo
(
'body'
);
jQuery
(
'<div id="onandoff"><p>on<b>and</b>off</p><div>worked<em>or</em>borked?</div></div>'
).
appendTo
(
'body'
);
...
@@ -2222,7 +2222,7 @@ test(".on and .off", function() {
...
@@ -2222,7 +2222,7 @@ test(".on and .off", function() {
// Direct events only
// Direct events only
counter
=
0
;
counter
=
0
;
jQuery
(
"#onandoff
em
"
)
jQuery
(
"#onandoff
b
"
)
.
on
(
"click"
,
5
,
function
(
e
,
trig
)
{
.
on
(
"click"
,
5
,
function
(
e
,
trig
)
{
counter
+=
e
.
data
+
(
trig
||
9
);
// twice, 5+9+5+17=36
counter
+=
e
.
data
+
(
trig
||
9
);
// twice, 5+9+5+17=36
})
})
...
@@ -2273,6 +2273,7 @@ test(".on and .off", function() {
...
@@ -2273,6 +2273,7 @@ test(".on and .off", function() {
.
each
(
function
()
{
.
each
(
function
()
{
equals
(
counter
,
49
,
"after triggering em element"
);
equals
(
counter
,
49
,
"after triggering em element"
);
})
})
.
off
(
"cluck"
,
function
(){}
)
// shouldn't remove anything
.
trigger
(
"cluck"
,
2
)
// 0+2 = 2
.
trigger
(
"cluck"
,
2
)
// 0+2 = 2
.
each
(
function
()
{
.
each
(
function
()
{
equals
(
counter
,
51
,
"after triggering #onandoff cluck"
);
equals
(
counter
,
51
,
"after triggering #onandoff cluck"
);
...
@@ -2288,7 +2289,7 @@ test(".on and .off", function() {
...
@@ -2288,7 +2289,7 @@ test(".on and .off", function() {
equals
(
counter
,
51
,
"after triggering b"
);
equals
(
counter
,
51
,
"after triggering b"
);
})
})
.
trigger
(
"cluck"
,
3
)
// 0+3 = 3
.
trigger
(
"cluck"
,
3
)
// 0+3 = 3
.
off
(
"clack"
,
"em"
)
.
off
(
"clack"
,
"em"
,
mixfn
)
.
find
(
"em"
)
.
find
(
"em"
)
.
trigger
(
"clack"
)
// 0
.
trigger
(
"clack"
)
// 0
.
end
()
.
end
()
...
@@ -2299,7 +2300,7 @@ test(".on and .off", function() {
...
@@ -2299,7 +2300,7 @@ test(".on and .off", function() {
// We should have removed all the event handlers ... kinda hacky way to check this
// We should have removed all the event handlers ... kinda hacky way to check this
var
data
=
jQuery
.
data
[
jQuery
(
"#onandoff"
)[
0
].
expando
]
||
{};
var
data
=
jQuery
.
data
[
jQuery
(
"#onandoff"
)[
0
].
expando
]
||
{};
equals
(
data
.
events
,
null
,
"no events left"
);
equals
(
data
.
events
,
undefined
,
"no events left"
);
jQuery
(
"#onandoff"
).
remove
();
jQuery
(
"#onandoff"
).
remove
();
});
});
...
...
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