Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
a72d0d6e
Commit
a72d0d6e
authored
11 years ago
by
fat
Browse files
Options
Download
Email Patches
Plain Diff
fix tests
parent
19de2e86
7 merge requests
!8635
ignore Gruntfile.js in jekyll
,
!8339
Fix broken links to navbar component in docs examples
,
!8157
Close Me: Docs "Customize and Download" button fix
,
!7964
commit fixes #7792
,
!8656
Added rel="stylesheet" to CDN-Examples
,
!8527
Inner properties move 1
,
!8245
Interactive color picker - Closed: request against wrong branch
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
js/tests/unit/tab.js
+3
-3
js/tests/unit/tab.js
js/tests/unit/tooltip.js
+14
-14
js/tests/unit/tooltip.js
js/tooltip.js
+13
-11
js/tooltip.js
with
30 additions
and
28 deletions
+30
-28
js/tests/unit/tab.js
+
3
-
3
View file @
a72d0d6e
...
...
@@ -53,12 +53,12 @@ $(function () {
$
.
support
.
transition
=
false
stop
();
$
(
'
<div class="tab"/>
'
)
.
bind
(
'
show
'
,
function
(
e
)
{
.
bind
(
'
bs:tab:
show
'
,
function
(
e
)
{
e
.
preventDefault
();
ok
(
true
);
start
();
})
.
bind
(
'
shown
'
,
function
()
{
.
bind
(
'
bs:tab:
shown
'
,
function
()
{
ok
(
false
);
})
.
tab
(
'
show
'
)
...
...
@@ -78,7 +78,7 @@ $(function () {
$
(
dropHTML
).
find
(
'
ul>li:first a
'
).
tab
(
'
show
'
).
end
()
.
find
(
'
ul>li:last a
'
).
on
(
'
show
'
,
function
(
event
){
equals
(
event
.
relatedTarget
.
hash
,
"
#1-1
"
)
}).
on
(
'
shown
'
,
function
(
event
){
}).
on
(
'
bs:tab:
shown
'
,
function
(
event
){
equals
(
event
.
relatedTarget
.
hash
,
"
#1-1
"
)
}).
tab
(
'
show
'
)
})
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/tooltip.js
+
14
-
14
View file @
a72d0d6e
...
...
@@ -19,7 +19,7 @@ $(function () {
})
test
(
"
should expose default settings
"
,
function
()
{
ok
(
!!
$
.
fn
.
tooltip
.
defaults
,
'
defaults is defined
'
)
ok
(
!!
$
.
fn
.
tooltip
.
Constructor
.
DEFAULTS
,
'
defaults is defined
'
)
})
test
(
"
should empty title attribute
"
,
function
()
{
...
...
@@ -69,7 +69,7 @@ $(function () {
test
(
"
should fire show event
"
,
function
()
{
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
.
bind
(
"
show
"
,
function
()
{
.
bind
(
"
bs:tooltip:
show
"
,
function
()
{
ok
(
true
,
"
show was called
"
)
start
()
})
...
...
@@ -79,7 +79,7 @@ $(function () {
test
(
"
should fire shown event
"
,
function
()
{
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
.
bind
(
"
shown
"
,
function
()
{
.
bind
(
"
bs:tooltip:
shown
"
,
function
()
{
ok
(
true
,
"
shown was called
"
)
start
()
})
...
...
@@ -89,12 +89,12 @@ $(function () {
test
(
"
should not fire shown event when default prevented
"
,
function
()
{
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
.
bind
(
"
show
"
,
function
(
e
)
{
.
bind
(
"
bs:tooltip:
show
"
,
function
(
e
)
{
e
.
preventDefault
()
ok
(
true
,
"
show was called
"
)
start
()
})
.
bind
(
"
shown
"
,
function
()
{
.
bind
(
"
bs:tooltip:
shown
"
,
function
()
{
ok
(
false
,
"
shown was called
"
)
})
.
tooltip
(
'
show
'
)
...
...
@@ -103,10 +103,10 @@ $(function () {
test
(
"
should fire hide event
"
,
function
()
{
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
.
bind
(
"
shown
"
,
function
()
{
.
bind
(
"
bs:tooltip:
shown
"
,
function
()
{
$
(
this
).
tooltip
(
'
hide
'
)
})
.
bind
(
"
hide
"
,
function
()
{
.
bind
(
"
bs:tooltip:
hide
"
,
function
()
{
ok
(
true
,
"
hide was called
"
)
start
()
})
...
...
@@ -116,10 +116,10 @@ $(function () {
test
(
"
should fire hidden event
"
,
function
()
{
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
.
bind
(
"
shown
"
,
function
()
{
.
bind
(
"
bs:tooltip:
shown
"
,
function
()
{
$
(
this
).
tooltip
(
'
hide
'
)
})
.
bind
(
"
hidden
"
,
function
()
{
.
bind
(
"
bs:tooltip:
hidden
"
,
function
()
{
ok
(
true
,
"
hidden was called
"
)
start
()
})
...
...
@@ -129,15 +129,15 @@ $(function () {
test
(
"
should not fire hidden event when default prevented
"
,
function
()
{
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
.
bind
(
"
shown
"
,
function
()
{
.
bind
(
"
bs:tooltip:
shown
"
,
function
()
{
$
(
this
).
tooltip
(
'
hide
'
)
})
.
bind
(
"
hide
"
,
function
(
e
)
{
.
bind
(
"
bs:tooltip:
hide
"
,
function
(
e
)
{
e
.
preventDefault
()
ok
(
true
,
"
hide was called
"
)
start
()
})
.
bind
(
"
hidden
"
,
function
()
{
.
bind
(
"
bs:tooltip:
hidden
"
,
function
()
{
ok
(
false
,
"
hidden was called
"
)
})
.
tooltip
(
'
show
'
)
...
...
@@ -214,13 +214,13 @@ $(function () {
test
(
"
should destroy tooltip
"
,
function
()
{
var
tooltip
=
$
(
'
<div/>
'
).
tooltip
().
on
(
'
click.foo
'
,
function
(){})
ok
(
tooltip
.
data
(
'
tooltip
'
),
'
tooltip has data
'
)
ok
(
tooltip
.
data
(
'
bs-
tooltip
'
),
'
tooltip has data
'
)
ok
(
$
.
_data
(
tooltip
[
0
],
'
events
'
).
mouseover
&&
$
.
_data
(
tooltip
[
0
],
'
events
'
).
mouseout
,
'
tooltip has hover event
'
)
ok
(
$
.
_data
(
tooltip
[
0
],
'
events
'
).
click
[
0
].
namespace
==
'
foo
'
,
'
tooltip has extra click.foo event
'
)
tooltip
.
tooltip
(
'
show
'
)
tooltip
.
tooltip
(
'
destroy
'
)
ok
(
!
tooltip
.
hasClass
(
'
in
'
),
'
tooltip is hidden
'
)
ok
(
!
$
.
_data
(
tooltip
[
0
],
'
tooltip
'
),
'
tooltip does not have data
'
)
ok
(
!
$
.
_data
(
tooltip
[
0
],
'
bs-
tooltip
'
),
'
tooltip does not have data
'
)
ok
(
$
.
_data
(
tooltip
[
0
],
'
events
'
).
click
[
0
].
namespace
==
'
foo
'
,
'
tooltip still has click.foo
'
)
ok
(
!
$
.
_data
(
tooltip
[
0
],
'
events
'
).
mouseover
&&
!
$
.
_data
(
tooltip
[
0
],
'
events
'
).
mouseout
,
'
tooltip does not have any events
'
)
})
...
...
This diff is collapsed.
Click to expand it.
js/tooltip.js
+
13
-
11
View file @
a72d0d6e
...
...
@@ -48,10 +48,10 @@
}
Tooltip
.
prototype
.
init
=
function
(
type
,
element
,
options
)
{
this
.
type
=
type
this
.
options
=
this
.
getOptions
(
options
)
this
.
enabled
=
true
this
.
type
=
type
this
.
$element
=
$
(
element
)
this
.
options
=
this
.
getOptions
(
options
)
var
triggers
=
this
.
options
.
trigger
.
split
(
'
'
)
...
...
@@ -99,7 +99,7 @@
if
(
defaults
[
key
]
!=
value
)
options
[
key
]
=
value
},
this
)
var
self
=
$
(
e
.
currentTarget
)[
this
.
type
](
options
).
data
(
this
.
type
)
var
self
=
$
(
e
.
currentTarget
)[
this
.
type
](
options
).
data
(
'
bs-
'
+
this
.
type
)
if
(
!
self
.
options
.
delay
||
!
self
.
options
.
delay
.
show
)
return
self
.
show
()
...
...
@@ -112,7 +112,7 @@
}
Tooltip
.
prototype
.
leave
=
function
(
e
)
{
var
self
=
$
(
e
.
currentTarget
)[
this
.
type
](
this
.
_options
).
data
(
this
.
type
)
var
self
=
$
(
e
.
currentTarget
)[
this
.
type
](
this
.
_options
).
data
(
'
bs-
'
+
this
.
type
)
if
(
this
.
timeout
)
clearTimeout
(
this
.
timeout
)
if
(
!
self
.
options
.
delay
||
!
self
.
options
.
delay
.
hide
)
return
self
.
hide
()
...
...
@@ -168,10 +168,12 @@
}
this
.
applyPlacement
(
tp
,
placement
)
this
.
$element
.
trigger
(
'
shown
'
)
this
.
$element
.
trigger
(
'
bs:
'
+
this
.
type
+
'
:
shown
'
)
}
}
Tooltip
.
prototype
.
applyPlacement
=
function
(
offset
,
placement
)
{
var
replace
var
$tip
=
this
.
tip
()
var
width
=
$tip
[
0
].
offsetWidth
var
height
=
$tip
[
0
].
offsetHeight
...
...
@@ -185,7 +187,7 @@
var
actualHeight
=
$tip
[
0
].
offsetHeight
if
(
placement
==
'
top
'
&&
actualHeight
!=
height
)
{
var
replace
=
true
replace
=
true
offset
.
top
=
offset
.
top
+
height
-
actualHeight
}
...
...
@@ -210,7 +212,7 @@
if
(
replace
)
$tip
.
offset
(
offset
)
}
Tooltip
.
prototype
.
replaceArrow
=
function
(
delta
,
dimension
,
position
){
Tooltip
.
prototype
.
replaceArrow
=
function
(
delta
,
dimension
,
position
)
{
this
.
arrow
().
css
(
position
,
delta
?
(
50
*
(
1
-
delta
/
dimension
)
+
"
%
"
)
:
''
)
}
...
...
@@ -248,7 +250,7 @@
removeWithAnimation
()
:
$tip
.
detach
()
this
.
$element
.
trigger
(
'
hidden
'
)
this
.
$element
.
trigger
(
'
bs:
'
+
this
.
type
+
'
:
hidden
'
)
return
this
}
...
...
@@ -312,12 +314,12 @@
}
Tooltip
.
prototype
.
toggle
=
function
(
e
)
{
var
self
=
e
?
$
(
e
.
currentTarget
)[
this
.
type
](
this
.
_options
).
data
(
this
.
type
)
:
this
var
self
=
e
?
$
(
e
.
currentTarget
)[
this
.
type
](
this
.
_options
).
data
(
'
bs-
'
+
this
.
type
)
:
this
self
.
tip
().
hasClass
(
'
in
'
)
?
self
.
hide
()
:
self
.
show
()
}
Tooltip
.
prototype
.
destroy
=
function
()
{
this
.
hide
().
$element
.
off
(
'
.
'
+
this
.
type
).
removeData
(
this
.
type
)
this
.
hide
().
$element
.
off
(
'
.
'
+
this
.
type
).
removeData
(
'
bs-
'
+
this
.
type
)
}
...
...
@@ -326,7 +328,7 @@
var
old
=
$
.
fn
.
tooltip
$
.
fn
.
tooltip
=
function
(
option
)
{
$
.
fn
.
tooltip
=
function
(
option
)
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs-tooltip
'
)
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Explore
Projects
Groups
Snippets