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
d822c0c2
Commit
d822c0c2
authored
Apr 29, 2008
by
Ariel Flesler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test runner: adding a test case for $.fn._toggle with more than 2 functions.
parent
aaff17be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
event.js
test/unit/event.js
+32
-2
No files found.
test/unit/event.js
View file @
d822c0c2
...
...
@@ -271,8 +271,9 @@ test("trigger(event, [data], [fn])", function() {
equals
(
$
(
"#firstp"
).
triggerHandler
(
"click"
,
[
1
,
"2"
,
"abc"
],
handler4
),
"test"
,
"Verify triggerHandler return is not overwritten by extra function"
);
});
test
(
"toggle(Function, Function)"
,
function
()
{
expect
(
5
);
test
(
"toggle(Function, Function, ...)"
,
function
()
{
expect
(
11
);
var
count
=
0
,
fn1
=
function
(
e
)
{
count
++
;
},
fn2
=
function
(
e
)
{
count
--
;
},
...
...
@@ -295,6 +296,35 @@ test("toggle(Function, Function)", function() {
});
return
false
;
}).
click
().
click
().
click
();
var
turn
=
0
;
var
fns
=
[
function
(){
turn
=
1
;
},
function
(){
turn
=
2
;
},
function
(){
turn
=
3
;
}
];
var
$div
=
$
(
"<div> </div>"
).
toggle
(
fns
[
0
],
fns
[
1
],
fns
[
2
]
);
$div
.
click
();
ok
(
turn
==
1
,
"Trying toggle with 3 functions, attempt 1 yields 1"
);
$div
.
click
();
ok
(
turn
==
2
,
"Trying toggle with 3 functions, attempt 2 yields 2"
);
$div
.
click
();
ok
(
turn
==
3
,
"Trying toggle with 3 functions, attempt 3 yields 3"
);
$div
.
click
();
ok
(
turn
==
1
,
"Trying toggle with 3 functions, attempt 4 yields 1"
);
$div
.
click
();
ok
(
turn
==
2
,
"Trying toggle with 3 functions, attempt 5 yields 2"
);
$div
.
unbind
(
'click'
,
fns
[
0
]);
var
data
=
$
.
data
(
$div
[
0
],
'events'
);
ok
(
!
data
,
"Unbinding one function from toggle unbinds them all"
);
});
test
(
"jQuery(function($) {})"
,
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