Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
bootstrap
Commits
b14455b0
Commit
b14455b0
authored
Apr 14, 2012
by
Jacob Thornton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for mouseout delay in tooltip
parent
c7dc4cc5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
22 deletions
+64
-22
js/bootstrap-tooltip.js
js/bootstrap-tooltip.js
+14
-22
js/tests/unit/bootstrap-tooltip.js
js/tests/unit/bootstrap-tooltip.js
+50
-0
No files found.
js/bootstrap-tooltip.js
View file @
b14455b0
...
...
@@ -72,33 +72,25 @@
,
enter
:
function
(
e
)
{
var
self
=
$
(
e
.
currentTarget
)[
this
.
type
](
this
.
_options
).
data
(
this
.
type
)
if
(
!
self
.
options
.
delay
||
!
self
.
options
.
delay
.
show
)
{
self
.
show
()
}
else
{
clearTimeout
(
this
.
timeout
)
self
.
hoverState
=
'
in
'
this
.
timeout
=
setTimeout
(
function
()
{
if
(
self
.
hoverState
==
'
in
'
)
{
self
.
show
()
}
},
self
.
options
.
delay
.
show
)
}
if
(
!
self
.
options
.
delay
||
!
self
.
options
.
delay
.
show
)
return
self
.
show
()
clearTimeout
(
this
.
timeout
)
self
.
hoverState
=
'
in
'
this
.
timeout
=
setTimeout
(
function
()
{
if
(
self
.
hoverState
==
'
in
'
)
self
.
show
()
},
self
.
options
.
delay
.
show
)
}
,
leave
:
function
(
e
)
{
var
self
=
$
(
e
.
currentTarget
)[
this
.
type
](
this
.
_options
).
data
(
this
.
type
)
if
(
!
self
.
options
.
delay
||
!
self
.
options
.
delay
.
hide
)
{
self
.
hide
()
}
else
{
clearTimeout
(
this
.
timeout
)
self
.
hoverState
=
'
out
'
this
.
timeout
=
setTimeout
(
function
()
{
if
(
self
.
hoverState
==
'
out
'
)
{
self
.
hide
()
}
},
self
.
options
.
delay
.
hide
)
}
if
(
!
self
.
options
.
delay
||
!
self
.
options
.
delay
.
hide
)
return
self
.
hide
()
clearTimeout
(
this
.
timeout
)
self
.
hoverState
=
'
out
'
this
.
timeout
=
setTimeout
(
function
()
{
if
(
self
.
hoverState
==
'
out
'
)
self
.
hide
()
},
self
.
options
.
delay
.
hide
)
}
,
show
:
function
()
{
...
...
js/tests/unit/bootstrap-tooltip.js
View file @
b14455b0
...
...
@@ -59,6 +59,56 @@ $(function () {
ok
(
!
$
(
"
.tooltip
"
).
length
,
'
tooltip removed
'
)
})
test
(
"
should not show tooltip if leave event occurs before delay expires
"
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
tooltip
({
delay
:
200
})
stop
()
tooltip
.
trigger
(
'
mouseenter
'
)
setTimeout
(
function
()
{
ok
(
!
$
(
"
.tooltip
"
).
hasClass
(
'
fade in
'
),
'
tooltip is not faded in
'
)
tooltip
.
trigger
(
'
mouseout
'
)
setTimeout
(
function
()
{
ok
(
!
$
(
"
.tooltip
"
).
hasClass
(
'
fade in
'
),
'
tooltip is not faded in
'
)
start
()
},
200
)
},
100
)
})
test
(
"
should not show tooltip if leave event occurs before delay expires
"
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
tooltip
({
delay
:
100
})
stop
()
tooltip
.
trigger
(
'
mouseenter
'
)
setTimeout
(
function
()
{
ok
(
!
$
(
"
.tooltip
"
).
hasClass
(
'
fade in
'
),
'
tooltip is not faded in
'
)
tooltip
.
trigger
(
'
mouseout
'
)
setTimeout
(
function
()
{
ok
(
!
$
(
"
.tooltip
"
).
hasClass
(
'
fade in
'
),
'
tooltip is not faded in
'
)
start
()
},
100
)
},
50
)
})
test
(
"
should show tooltip if leave event hasn't occured before delay expires
"
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
tooltip
({
delay
:
200
})
stop
()
tooltip
.
trigger
(
'
mouseenter
'
)
setTimeout
(
function
()
{
ok
(
!
$
(
"
.tooltip
"
).
hasClass
(
'
fade in
'
),
'
tooltip is not faded in
'
)
setTimeout
(
function
()
{
ok
(
!
$
(
"
.tooltip
"
).
hasClass
(
'
fade in
'
),
'
tooltip has faded in
'
)
start
()
},
200
)
},
100
)
})
test
(
"
should detect if title string is html or text: foo
"
,
function
()
{
ok
(
!
$
.
fn
.
tooltip
.
Constructor
.
prototype
.
isHTML
(
'
foo
'
),
'
correctly detected html
'
)
})
...
...
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