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
f20f6660
Commit
f20f6660
authored
Apr 30, 2014
by
Mark Otto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11966 from colllin/noconflict
Fix #11464 - JS noConflict() mode not working in 3.0.x
parents
abc79769
a9f2b6ce
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
415 additions
and
288 deletions
+415
-288
js/affix.js
js/affix.js
+5
-4
js/alert.js
js/alert.js
+4
-3
js/button.js
js/button.js
+5
-4
js/carousel.js
js/carousel.js
+6
-5
js/collapse.js
js/collapse.js
+6
-5
js/dropdown.js
js/dropdown.js
+4
-3
js/modal.js
js/modal.js
+8
-8
js/popover.js
js/popover.js
+4
-3
js/scrollspy.js
js/scrollspy.js
+5
-4
js/tab.js
js/tab.js
+5
-4
js/tests/unit/affix.js
js/tests/unit/affix.js
+19
-10
js/tests/unit/alert.js
js/tests/unit/alert.js
+20
-11
js/tests/unit/button.js
js/tests/unit/button.js
+21
-12
js/tests/unit/carousel.js
js/tests/unit/carousel.js
+25
-16
js/tests/unit/collapse.js
js/tests/unit/collapse.js
+21
-12
js/tests/unit/dropdown.js
js/tests/unit/dropdown.js
+24
-15
js/tests/unit/modal.js
js/tests/unit/modal.js
+32
-23
js/tests/unit/popover.js
js/tests/unit/popover.js
+40
-31
js/tests/unit/scrollspy.js
js/tests/unit/scrollspy.js
+19
-10
js/tests/unit/tab.js
js/tests/unit/tab.js
+24
-15
js/tests/unit/tooltip.js
js/tests/unit/tooltip.js
+93
-84
js/tooltip.js
js/tooltip.js
+25
-6
No files found.
js/affix.js
View file @
f20f6660
...
@@ -90,9 +90,7 @@
...
@@ -90,9 +90,7 @@
// AFFIX PLUGIN DEFINITION
// AFFIX PLUGIN DEFINITION
// =======================
// =======================
var
old
=
$
.
fn
.
affix
function
Plugin
(
option
)
{
$
.
fn
.
affix
=
function
(
option
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs.affix
'
)
var
data
=
$this
.
data
(
'
bs.affix
'
)
...
@@ -103,6 +101,9 @@
...
@@ -103,6 +101,9 @@
})
})
}
}
var
old
=
$
.
fn
.
affix
$
.
fn
.
affix
=
Plugin
$
.
fn
.
affix
.
Constructor
=
Affix
$
.
fn
.
affix
.
Constructor
=
Affix
...
@@ -128,7 +129,7 @@
...
@@ -128,7 +129,7 @@
if
(
data
.
offsetBottom
)
data
.
offset
.
bottom
=
data
.
offsetBottom
if
(
data
.
offsetBottom
)
data
.
offset
.
bottom
=
data
.
offsetBottom
if
(
data
.
offsetTop
)
data
.
offset
.
top
=
data
.
offsetTop
if
(
data
.
offsetTop
)
data
.
offset
.
top
=
data
.
offsetTop
$spy
.
affix
(
data
)
Plugin
.
call
(
$spy
,
data
)
})
})
})
})
...
...
js/alert.js
View file @
f20f6660
...
@@ -56,9 +56,7 @@
...
@@ -56,9 +56,7 @@
// ALERT PLUGIN DEFINITION
// ALERT PLUGIN DEFINITION
// =======================
// =======================
var
old
=
$
.
fn
.
alert
function
Plugin
(
option
)
{
$
.
fn
.
alert
=
function
(
option
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs.alert
'
)
var
data
=
$this
.
data
(
'
bs.alert
'
)
...
@@ -68,6 +66,9 @@
...
@@ -68,6 +66,9 @@
})
})
}
}
var
old
=
$
.
fn
.
alert
$
.
fn
.
alert
=
Plugin
$
.
fn
.
alert
.
Constructor
=
Alert
$
.
fn
.
alert
.
Constructor
=
Alert
...
...
js/button.js
View file @
f20f6660
...
@@ -67,9 +67,7 @@
...
@@ -67,9 +67,7 @@
// BUTTON PLUGIN DEFINITION
// BUTTON PLUGIN DEFINITION
// ========================
// ========================
var
old
=
$
.
fn
.
button
function
Plugin
(
option
)
{
$
.
fn
.
button
=
function
(
option
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs.button
'
)
var
data
=
$this
.
data
(
'
bs.button
'
)
...
@@ -82,6 +80,9 @@
...
@@ -82,6 +80,9 @@
})
})
}
}
var
old
=
$
.
fn
.
button
$
.
fn
.
button
=
Plugin
$
.
fn
.
button
.
Constructor
=
Button
$
.
fn
.
button
.
Constructor
=
Button
...
@@ -100,7 +101,7 @@
...
@@ -100,7 +101,7 @@
$
(
document
).
on
(
'
click.bs.button.data-api
'
,
'
[data-toggle^="button"]
'
,
function
(
e
)
{
$
(
document
).
on
(
'
click.bs.button.data-api
'
,
'
[data-toggle^="button"]
'
,
function
(
e
)
{
var
$btn
=
$
(
e
.
target
)
var
$btn
=
$
(
e
.
target
)
if
(
!
$btn
.
hasClass
(
'
btn
'
))
$btn
=
$btn
.
closest
(
'
.btn
'
)
if
(
!
$btn
.
hasClass
(
'
btn
'
))
$btn
=
$btn
.
closest
(
'
.btn
'
)
$btn
.
button
(
'
toggle
'
)
Plugin
.
call
(
$btn
,
'
toggle
'
)
e
.
preventDefault
()
e
.
preventDefault
()
})
})
...
...
js/carousel.js
View file @
f20f6660
...
@@ -150,9 +150,7 @@
...
@@ -150,9 +150,7 @@
// CAROUSEL PLUGIN DEFINITION
// CAROUSEL PLUGIN DEFINITION
// ==========================
// ==========================
var
old
=
$
.
fn
.
carousel
function
Plugin
(
option
)
{
$
.
fn
.
carousel
=
function
(
option
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs.carousel
'
)
var
data
=
$this
.
data
(
'
bs.carousel
'
)
...
@@ -166,6 +164,9 @@
...
@@ -166,6 +164,9 @@
})
})
}
}
var
old
=
$
.
fn
.
carousel
$
.
fn
.
carousel
=
Plugin
$
.
fn
.
carousel
.
Constructor
=
Carousel
$
.
fn
.
carousel
.
Constructor
=
Carousel
...
@@ -188,7 +189,7 @@
...
@@ -188,7 +189,7 @@
var
slideIndex
=
$this
.
attr
(
'
data-slide-to
'
)
var
slideIndex
=
$this
.
attr
(
'
data-slide-to
'
)
if
(
slideIndex
)
options
.
interval
=
false
if
(
slideIndex
)
options
.
interval
=
false
$target
.
carousel
(
options
)
Plugin
.
call
(
$target
,
options
)
if
(
slideIndex
=
$this
.
attr
(
'
data-slide-to
'
))
{
if
(
slideIndex
=
$this
.
attr
(
'
data-slide-to
'
))
{
$target
.
data
(
'
bs.carousel
'
).
to
(
slideIndex
)
$target
.
data
(
'
bs.carousel
'
).
to
(
slideIndex
)
...
@@ -200,7 +201,7 @@
...
@@ -200,7 +201,7 @@
$
(
window
).
on
(
'
load
'
,
function
()
{
$
(
window
).
on
(
'
load
'
,
function
()
{
$
(
'
[data-ride="carousel"]
'
).
each
(
function
()
{
$
(
'
[data-ride="carousel"]
'
).
each
(
function
()
{
var
$carousel
=
$
(
this
)
var
$carousel
=
$
(
this
)
$carousel
.
carousel
(
$carousel
.
data
())
Plugin
.
call
(
$carousel
,
$carousel
.
data
())
})
})
})
})
...
...
js/collapse.js
View file @
f20f6660
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
if
(
actives
&&
actives
.
length
)
{
if
(
actives
&&
actives
.
length
)
{
var
hasData
=
actives
.
data
(
'
bs.collapse
'
)
var
hasData
=
actives
.
data
(
'
bs.collapse
'
)
if
(
hasData
&&
hasData
.
transitioning
)
return
if
(
hasData
&&
hasData
.
transitioning
)
return
actives
.
collapse
(
'
hide
'
)
Plugin
.
call
(
actives
,
'
hide
'
)
hasData
||
actives
.
data
(
'
bs.collapse
'
,
null
)
hasData
||
actives
.
data
(
'
bs.collapse
'
,
null
)
}
}
...
@@ -126,9 +126,7 @@
...
@@ -126,9 +126,7 @@
// COLLAPSE PLUGIN DEFINITION
// COLLAPSE PLUGIN DEFINITION
// ==========================
// ==========================
var
old
=
$
.
fn
.
collapse
function
Plugin
(
option
)
{
$
.
fn
.
collapse
=
function
(
option
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs.collapse
'
)
var
data
=
$this
.
data
(
'
bs.collapse
'
)
...
@@ -140,6 +138,9 @@
...
@@ -140,6 +138,9 @@
})
})
}
}
var
old
=
$
.
fn
.
collapse
$
.
fn
.
collapse
=
Plugin
$
.
fn
.
collapse
.
Constructor
=
Collapse
$
.
fn
.
collapse
.
Constructor
=
Collapse
...
@@ -171,7 +172,7 @@
...
@@ -171,7 +172,7 @@
$this
[
$target
.
hasClass
(
'
in
'
)
?
'
addClass
'
:
'
removeClass
'
](
'
collapsed
'
)
$this
[
$target
.
hasClass
(
'
in
'
)
?
'
addClass
'
:
'
removeClass
'
](
'
collapsed
'
)
}
}
$target
.
collapse
(
option
)
Plugin
.
call
(
$target
,
option
)
})
})
}(
jQuery
);
}(
jQuery
);
js/dropdown.js
View file @
f20f6660
...
@@ -112,9 +112,7 @@
...
@@ -112,9 +112,7 @@
// DROPDOWN PLUGIN DEFINITION
// DROPDOWN PLUGIN DEFINITION
// ==========================
// ==========================
var
old
=
$
.
fn
.
dropdown
function
Plugin
(
option
)
{
$
.
fn
.
dropdown
=
function
(
option
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs.dropdown
'
)
var
data
=
$this
.
data
(
'
bs.dropdown
'
)
...
@@ -124,6 +122,9 @@
...
@@ -124,6 +122,9 @@
})
})
}
}
var
old
=
$
.
fn
.
dropdown
$
.
fn
.
dropdown
=
Plugin
$
.
fn
.
dropdown
.
Constructor
=
Dropdown
$
.
fn
.
dropdown
.
Constructor
=
Dropdown
...
...
js/modal.js
View file @
f20f6660
...
@@ -228,9 +228,7 @@
...
@@ -228,9 +228,7 @@
// MODAL PLUGIN DEFINITION
// MODAL PLUGIN DEFINITION
// =======================
// =======================
var
old
=
$
.
fn
.
modal
function
Plugin
(
option
,
_relatedTarget
)
{
$
.
fn
.
modal
=
function
(
option
,
_relatedTarget
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs.modal
'
)
var
data
=
$this
.
data
(
'
bs.modal
'
)
...
@@ -242,6 +240,9 @@
...
@@ -242,6 +240,9 @@
})
})
}
}
var
old
=
$
.
fn
.
modal
$
.
fn
.
modal
=
Plugin
$
.
fn
.
modal
.
Constructor
=
Modal
$
.
fn
.
modal
.
Constructor
=
Modal
...
@@ -265,11 +266,10 @@
...
@@ -265,11 +266,10 @@
if
(
$this
.
is
(
'
a
'
))
e
.
preventDefault
()
if
(
$this
.
is
(
'
a
'
))
e
.
preventDefault
()
$target
Plugin
.
call
(
$target
,
option
,
this
)
.
modal
(
option
,
this
)
$target
.
one
(
'
hide
'
,
function
()
{
.
one
(
'
hide
'
,
function
()
{
$this
.
is
(
'
:visible
'
)
&&
$this
.
trigger
(
'
focus
'
)
$this
.
is
(
'
:visible
'
)
&&
$this
.
trigger
(
'
focus
'
)
})
})
})
})
}(
jQuery
);
}(
jQuery
);
js/popover.js
View file @
f20f6660
...
@@ -82,9 +82,7 @@
...
@@ -82,9 +82,7 @@
// POPOVER PLUGIN DEFINITION
// POPOVER PLUGIN DEFINITION
// =========================
// =========================
var
old
=
$
.
fn
.
popover
function
Plugin
(
option
)
{
$
.
fn
.
popover
=
function
(
option
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs.popover
'
)
var
data
=
$this
.
data
(
'
bs.popover
'
)
...
@@ -96,6 +94,9 @@
...
@@ -96,6 +94,9 @@
})
})
}
}
var
old
=
$
.
fn
.
popover
$
.
fn
.
popover
=
Plugin
$
.
fn
.
popover
.
Constructor
=
Popover
$
.
fn
.
popover
.
Constructor
=
Popover
...
...
js/scrollspy.js
View file @
f20f6660
...
@@ -116,9 +116,7 @@
...
@@ -116,9 +116,7 @@
// SCROLLSPY PLUGIN DEFINITION
// SCROLLSPY PLUGIN DEFINITION
// ===========================
// ===========================
var
old
=
$
.
fn
.
scrollspy
function
Plugin
(
option
)
{
$
.
fn
.
scrollspy
=
function
(
option
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs.scrollspy
'
)
var
data
=
$this
.
data
(
'
bs.scrollspy
'
)
...
@@ -129,6 +127,9 @@
...
@@ -129,6 +127,9 @@
})
})
}
}
var
old
=
$
.
fn
.
scrollspy
$
.
fn
.
scrollspy
=
Plugin
$
.
fn
.
scrollspy
.
Constructor
=
ScrollSpy
$
.
fn
.
scrollspy
.
Constructor
=
ScrollSpy
...
@@ -147,7 +148,7 @@
...
@@ -147,7 +148,7 @@
$
(
window
).
on
(
'
load.bs.scrollspy.data-api
'
,
function
()
{
$
(
window
).
on
(
'
load.bs.scrollspy.data-api
'
,
function
()
{
$
(
'
[data-spy="scroll"]
'
).
each
(
function
()
{
$
(
'
[data-spy="scroll"]
'
).
each
(
function
()
{
var
$spy
=
$
(
this
)
var
$spy
=
$
(
this
)
$spy
.
scrollspy
(
$spy
.
data
())
Plugin
.
call
(
$spy
,
$spy
.
data
())
})
})
})
})
...
...
js/tab.js
View file @
f20f6660
...
@@ -90,9 +90,7 @@
...
@@ -90,9 +90,7 @@
// TAB PLUGIN DEFINITION
// TAB PLUGIN DEFINITION
// =====================
// =====================
var
old
=
$
.
fn
.
tab
function
Plugin
(
option
)
{
$
.
fn
.
tab
=
function
(
option
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs.tab
'
)
var
data
=
$this
.
data
(
'
bs.tab
'
)
...
@@ -102,6 +100,9 @@
...
@@ -102,6 +100,9 @@
})
})
}
}
var
old
=
$
.
fn
.
tab
$
.
fn
.
tab
=
Plugin
$
.
fn
.
tab
.
Constructor
=
Tab
$
.
fn
.
tab
.
Constructor
=
Tab
...
@@ -119,7 +120,7 @@
...
@@ -119,7 +120,7 @@
$
(
document
).
on
(
'
click.bs.tab.data-api
'
,
'
[data-toggle="tab"], [data-toggle="pill"]
'
,
function
(
e
)
{
$
(
document
).
on
(
'
click.bs.tab.data-api
'
,
'
[data-toggle="tab"], [data-toggle="pill"]
'
,
function
(
e
)
{
e
.
preventDefault
()
e
.
preventDefault
()
$
(
this
).
tab
(
'
show
'
)
Plugin
.
call
(
$
(
this
),
'
show
'
)
})
})
}(
jQuery
);
}(
jQuery
);
js/tests/unit/affix.js
View file @
f20f6660
$
(
function
()
{
$
(
function
()
{
module
(
'
affix
'
)
module
(
'
affix plugin
'
)
test
(
'
should provide no conflict
'
,
function
()
{
var
affix
=
$
.
fn
.
affix
.
noConflict
()
ok
(
!
$
.
fn
.
affix
,
'
affix was set back to undefined (org value)
'
)
$
.
fn
.
affix
=
affix
})
test
(
'
should be defined on jquery object
'
,
function
()
{
test
(
'
should be defined on jquery object
'
,
function
()
{
ok
(
$
(
document
.
body
).
affix
,
'
affix method is defined
'
)
ok
(
$
(
document
.
body
).
affix
,
'
affix method is defined
'
)
})
})
module
(
'
affix
'
,
{
setup
:
function
()
{
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$
.
fn
.
bootstrapAffix
=
$
.
fn
.
affix
.
noConflict
()
},
teardown
:
function
()
{
$
.
fn
.
affix
=
$
.
fn
.
bootstrapAffix
delete
$
.
fn
.
bootstrapAffix
}
})
test
(
'
should provide no conflict
'
,
function
()
{
ok
(
!
$
.
fn
.
affix
,
'
affix was set back to undefined (org value)
'
)
})
test
(
'
should return element
'
,
function
()
{
test
(
'
should return element
'
,
function
()
{
ok
(
$
(
document
.
body
).
a
ffix
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
ok
(
$
(
document
.
body
).
bootstrapA
ffix
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
})
})
test
(
'
should exit early if element is not visible
'
,
function
()
{
test
(
'
should exit early if element is not visible
'
,
function
()
{
var
$affix
=
$
(
'
<div style="display: none"></div>
'
).
a
ffix
()
var
$affix
=
$
(
'
<div style="display: none"></div>
'
).
bootstrapA
ffix
()
$affix
.
data
(
'
bs.affix
'
).
checkPosition
()
$affix
.
data
(
'
bs.affix
'
).
checkPosition
()
ok
(
!
$affix
.
hasClass
(
'
affix
'
),
'
affix class was not added
'
)
ok
(
!
$affix
.
hasClass
(
'
affix
'
),
'
affix class was not added
'
)
})
})
...
@@ -28,7 +37,7 @@ $(function () {
...
@@ -28,7 +37,7 @@ $(function () {
var
template
=
$
(
'
<div id="affixTarget"><ul><li>Please affix</li><li>And unaffix</li></ul></div><div id="affixAfter" style="height: 20000px; display:block;"></div>
'
)
var
template
=
$
(
'
<div id="affixTarget"><ul><li>Please affix</li><li>And unaffix</li></ul></div><div id="affixAfter" style="height: 20000px; display:block;"></div>
'
)
template
.
appendTo
(
'
body
'
)
template
.
appendTo
(
'
body
'
)
$
(
'
#affixTarget
'
).
a
ffix
({
$
(
'
#affixTarget
'
).
bootstrapA
ffix
({
offset
:
$
(
'
#affixTarget ul
'
).
position
()
offset
:
$
(
'
#affixTarget ul
'
).
position
()
})
})
...
...
js/tests/unit/alert.js
View file @
f20f6660
$
(
function
()
{
$
(
function
()
{
module
(
'
alert
'
)
module
(
'
alert plugin
'
)
test
(
'
should provide no conflict
'
,
function
()
{
var
alert
=
$
.
fn
.
alert
.
noConflict
()
ok
(
!
$
.
fn
.
alert
,
'
alert was set back to undefined (org value)
'
)
$
.
fn
.
alert
=
alert
})
test
(
'
should be defined on jquery object
'
,
function
()
{
test
(
'
should be defined on jquery object
'
,
function
()
{
ok
(
$
(
document
.
body
).
alert
,
'
alert method is defined
'
)
ok
(
$
(
document
.
body
).
alert
,
'
alert method is defined
'
)
})
})
module
(
'
alert
'
,
{
setup
:
function
()
{
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$
.
fn
.
bootstrapAlert
=
$
.
fn
.
alert
.
noConflict
()
},
teardown
:
function
()
{
$
.
fn
.
alert
=
$
.
fn
.
bootstrapAlert
delete
$
.
fn
.
bootstrapAlert
}
})
test
(
'
should provide no conflict
'
,
function
()
{
ok
(
!
$
.
fn
.
alert
,
'
alert was set back to undefined (org value)
'
)
})
test
(
'
should return element
'
,
function
()
{
test
(
'
should return element
'
,
function
()
{
ok
(
$
(
document
.
body
).
a
lert
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
ok
(
$
(
document
.
body
).
bootstrapA
lert
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
})
})
test
(
'
should fade element out on clicking .close
'
,
function
()
{
test
(
'
should fade element out on clicking .close
'
,
function
()
{
...
@@ -21,7 +30,7 @@ $(function () {
...
@@ -21,7 +30,7 @@ $(function () {
'
<a class="close" href="#" data-dismiss="alert">×</a>
'
+
'
<a class="close" href="#" data-dismiss="alert">×</a>
'
+
'
<p><strong>Holy guacamole!</strong> Best check yo self, you
\'
re not looking too good.</p>
'
+
'
<p><strong>Holy guacamole!</strong> Best check yo self, you
\'
re not looking too good.</p>
'
+
'
</div>
'
,
'
</div>
'
,
alert
=
$
(
alertHTML
).
a
lert
()
alert
=
$
(
alertHTML
).
bootstrapA
lert
()
alert
.
find
(
'
.close
'
).
click
()
alert
.
find
(
'
.close
'
).
click
()
...
@@ -35,7 +44,7 @@ $(function () {
...
@@ -35,7 +44,7 @@ $(function () {
'
<a class="close" href="#" data-dismiss="alert">×</a>
'
+
'
<a class="close" href="#" data-dismiss="alert">×</a>
'
+
'
<p><strong>Holy guacamole!</strong> Best check yo self, you
\'
re not looking too good.</p>
'
+
'
<p><strong>Holy guacamole!</strong> Best check yo self, you
\'
re not looking too good.</p>
'
+
'
</div>
'
,
'
</div>
'
,
alert
=
$
(
alertHTML
).
appendTo
(
'
#qunit-fixture
'
).
a
lert
()
alert
=
$
(
alertHTML
).
appendTo
(
'
#qunit-fixture
'
).
bootstrapA
lert
()
ok
(
$
(
'
#qunit-fixture
'
).
find
(
'
.alert-message
'
).
length
,
'
element added to dom
'
)
ok
(
$
(
'
#qunit-fixture
'
).
find
(
'
.alert-message
'
).
length
,
'
element added to dom
'
)
...
@@ -56,7 +65,7 @@ $(function () {
...
@@ -56,7 +65,7 @@ $(function () {
.
on
(
'
closed.bs.alert
'
,
function
()
{
.
on
(
'
closed.bs.alert
'
,
function
()
{
ok
(
false
)
ok
(
false
)
})
})
.
a
lert
(
'
close
'
)
.
bootstrapA
lert
(
'
close
'
)
})
})
})
})
js/tests/unit/button.js
View file @
f20f6660
$
(
function
()
{
$
(
function
()
{
module
(
'
button
'
)
module
(
'
button plugin
'
)
test
(
'
should provide no conflict
'
,
function
()
{
var
button
=
$
.
fn
.
button
.
noConflict
()
ok
(
!
$
.
fn
.
button
,
'
button was set back to undefined (org value)
'
)
$
.
fn
.
button
=
button
})
test
(
'
should be defined on jquery object
'
,
function
()
{
test
(
'
should be defined on jquery object
'
,
function
()
{
ok
(
$
(
document
.
body
).
button
,
'
button method is defined
'
)
ok
(
$
(
document
.
body
).
button
,
'
button method is defined
'
)
})
})
module
(
'
button
'
,
{
setup
:
function
()
{
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$
.
fn
.
bootstrapButton
=
$
.
fn
.
button
.
noConflict
()
},
teardown
:
function
()
{
$
.
fn
.
button
=
$
.
fn
.
bootstrapButton
delete
$
.
fn
.
bootstrapButton
}
})
test
(
'
should provide no conflict
'
,
function
()
{
ok
(
!
$
.
fn
.
button
,
'
button was set back to undefined (org value)
'
)
})
test
(
'
should return element
'
,
function
()
{
test
(
'
should return element
'
,
function
()
{
ok
(
$
(
document
.
body
).
button
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
ok
(
$
(
document
.
body
).
b
ootstrapB
utton
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
})
})
test
(
'
should return set state to loading
'
,
function
()
{
test
(
'
should return set state to loading
'
,
function
()
{
var
btn
=
$
(
'
<button class="btn" data-loading-text="fat">mdo</button>
'
)
var
btn
=
$
(
'
<button class="btn" data-loading-text="fat">mdo</button>
'
)
equal
(
btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
equal
(
btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
btn
.
button
(
'
loading
'
)
btn
.
b
ootstrapB
utton
(
'
loading
'
)
equal
(
btn
.
html
(),
'
fat
'
,
'
btn text equals fat
'
)
equal
(
btn
.
html
(),
'
fat
'
,
'
btn text equals fat
'
)
stop
()
stop
()
setTimeout
(
function
()
{
setTimeout
(
function
()
{
...
@@ -32,7 +41,7 @@ $(function () {
...
@@ -32,7 +41,7 @@ $(function () {
test
(
'
should return reset state
'
,
function
()
{
test
(
'
should return reset state
'
,
function
()
{
var
btn
=
$
(
'
<button class="btn" data-loading-text="fat">mdo</button>
'
)
var
btn
=
$
(
'
<button class="btn" data-loading-text="fat">mdo</button>
'
)
equal
(
btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
equal
(
btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
btn
.
button
(
'
loading
'
)
btn
.
b
ootstrapB
utton
(
'
loading
'
)
equal
(
btn
.
html
(),
'
fat
'
,
'
btn text equals fat
'
)
equal
(
btn
.
html
(),
'
fat
'
,
'
btn text equals fat
'
)
stop
()
stop
()
setTimeout
(
function
()
{
setTimeout
(
function
()
{
...
@@ -40,7 +49,7 @@ $(function () {
...
@@ -40,7 +49,7 @@ $(function () {
ok
(
btn
.
hasClass
(
'
disabled
'
),
'
btn has disabled class
'
)
ok
(
btn
.
hasClass
(
'
disabled
'
),
'
btn has disabled class
'
)
start
()
start
()
stop
()
stop
()
btn
.
button
(
'
reset
'
)
btn
.
b
ootstrapB
utton
(
'
reset
'
)
equal
(
btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
equal
(
btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
setTimeout
(
function
()
{
setTimeout
(
function
()
{
ok
(
!
btn
.
attr
(
'
disabled
'
),
'
btn is not disabled
'
)
ok
(
!
btn
.
attr
(
'
disabled
'
),
'
btn is not disabled
'
)
...
@@ -54,7 +63,7 @@ $(function () {
...
@@ -54,7 +63,7 @@ $(function () {
test
(
'
should toggle active
'
,
function
()
{
test
(
'
should toggle active
'
,
function
()
{
var
btn
=
$
(
'
<button class="btn">mdo</button>
'
)
var
btn
=
$
(
'
<button class="btn">mdo</button>
'
)
ok
(
!
btn
.
hasClass
(
'
active
'
),
'
btn does not have active class
'
)
ok
(
!
btn
.
hasClass
(
'
active
'
),
'
btn does not have active class
'
)
btn
.
button
(
'
toggle
'
)
btn
.
b
ootstrapB
utton
(
'
toggle
'
)
ok
(
btn
.
hasClass
(
'
active
'
),
'
btn has class active
'
)
ok
(
btn
.
hasClass
(
'
active
'
),
'
btn has class active
'
)
})
})
...
...
js/tests/unit/carousel.js
View file @
f20f6660
$
(
function
()
{
$
(
function
()
{
module
(
'
carousel
'
)
module
(
'
carousel plugin
'
)
test
(
'
should provide no conflict
'
,
function
()
{
var
carousel
=
$
.
fn
.
carousel
.
noConflict
()
ok
(
!
$
.
fn
.
carousel
,
'
carousel was set back to undefined (orig value)
'
)
$
.
fn
.
carousel
=
carousel
})
test
(
'
should be defined on jQuery object
'
,
function
()
{
test
(
'
should be defined on jQuery object
'
,
function
()
{
ok
(
$
(
document
.
body
).
carousel
,
'
carousel method is defined
'
)
ok
(
$
(
document
.
body
).
carousel
,
'
carousel method is defined
'
)
})
})
module
(
'
carousel
'
,
{
setup
:
function
()
{
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$
.
fn
.
bootstrapCarousel
=
$
.
fn
.
carousel
.
noConflict
()
},
teardown
:
function
()
{
$
.
fn
.
carousel
=
$
.
fn
.
bootstrapCarousel
delete
$
.
fn
.
bootstrapCarousel
}
})
test
(
'
should provide no conflict
'
,
function
()
{
ok
(
!
$
.
fn
.
carousel
,
'
carousel was set back to undefined (orig value)
'
)
})
test
(
'
should return element
'
,
function
()
{
test
(
'
should return element
'
,
function
()
{
ok
(
$
(
document
.
body
).
c
arousel
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
ok
(
$
(
document
.
body
).
bootstrapC
arousel
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
})
})
test
(
'
should not fire slide when slide is prevented
'
,
function
()
{
test
(
'
should not fire slide when slide is prevented
'
,
function
()
{
...
@@ -28,7 +37,7 @@ $(function () {
...
@@ -28,7 +37,7 @@ $(function () {
.
on
(
'
slid.bs.carousel
'
,
function
()
{
.
on
(
'
slid.bs.carousel
'
,
function
()
{
ok
(
false
)
ok
(
false
)
})
})
.
c
arousel
(
'
next
'
)
.
bootstrapC
arousel
(
'
next
'
)
})
})
test
(
'
should reset when slide is prevented
'
,
function
()
{
test
(
'
should reset when slide is prevented
'
,
function
()
{
...
@@ -41,7 +50,7 @@ $(function () {
...
@@ -41,7 +50,7 @@ $(function () {
setTimeout
(
function
()
{
setTimeout
(
function
()
{
ok
(
$carousel
.
find
(
'
.item:eq(0)
'
).
is
(
'
.active
'
))
ok
(
$carousel
.
find
(
'
.item:eq(0)
'
).
is
(
'
.active
'
))
ok
(
$carousel
.
find
(
'
.carousel-indicators li:eq(0)
'
).
is
(
'
.active
'
))
ok
(
$carousel
.
find
(
'
.carousel-indicators li:eq(0)
'
).
is
(
'
.active
'
))
$carousel
.
c
arousel
(
'
next
'
)
$carousel
.
bootstrapC
arousel
(
'
next
'
)
},
1
)
},
1
)
})
})
$carousel
.
one
(
'
slid.bs.carousel
'
,
function
()
{
$carousel
.
one
(
'
slid.bs.carousel
'
,
function
()
{
...
@@ -51,7 +60,7 @@ $(function () {
...
@@ -51,7 +60,7 @@ $(function () {
start
()
start
()
},
1
)
},
1
)
})
})
$carousel
.
c
arousel
(
'
next
'
)
$carousel
.
bootstrapC
arousel
(
'
next
'
)
})
})
test
(
'
should fire slide event with direction
'
,
function
()
{
test
(
'
should fire slide event with direction
'
,
function
()
{
...
@@ -63,7 +72,7 @@ $(function () {
...
@@ -63,7 +72,7 @@ $(function () {
ok
(
e
.
direction
)
ok
(
e
.
direction
)
ok
(
e
.
direction
===
'
right
'
||
e
.
direction
===
'
left
'
)
ok
(
e
.
direction
===
'
right
'
||
e
.
direction
===
'
left
'
)
start
()
start
()
}).
c
arousel
(
'
next
'
)
}).
bootstrapC
arousel
(
'
next
'
)
})
})
test
(
'
should fire slid event with direction
'
,
function
()
{
test
(
'
should fire slid event with direction
'
,
function
()
{
...
@@ -89,7 +98,7 @@ $(function () {
...
@@ -89,7 +98,7 @@ $(function () {
ok
(
$
(
e
.
relatedTarget
).
hasClass
(
'
item
'
))
ok
(
$
(
e
.
relatedTarget
).
hasClass
(
'
item
'
))
start
()
start
()
})
})
.
c
arousel
(
'
next
'
)
.
bootstrapC
arousel
(
'
next
'
)
})
})
test
(
'
should fire slid event with relatedTarget
'
,
function
()
{
test
(
'
should fire slid event with relatedTarget
'
,
function
()
{
...
@@ -129,7 +138,7 @@ $(function () {
...
@@ -129,7 +138,7 @@ $(function () {
template
.
attr
(
'
data-interval
'
,
false
)
template
.
attr
(
'
data-interval
'
,
false
)
template
.
appendTo
(
'
body
'
)
template
.
appendTo
(
'
body
'
)
$
(
'
#myCarousel
'
).
c
arousel
(
1
)
$
(
'
#myCarousel
'
).
bootstrapC
arousel
(
1
)
ok
(
$
(
'
#myCarousel
'
).
data
(
'
bs.carousel
'
).
options
.
interval
===
false
,
'
data attribute has higher priority than default options
'
)
ok
(
$
(
'
#myCarousel
'
).
data
(
'
bs.carousel
'
).
options
.
interval
===
false
,
'
data attribute has higher priority than default options
'
)
$
(
'
#myCarousel
'
).
remove
()
$
(
'
#myCarousel
'
).
remove
()
})
})
...
@@ -153,11 +162,11 @@ $(function () {
...
@@ -153,11 +162,11 @@ $(function () {
+
'
</div>
'
+
'
</div>
'
)
)
$template
.
c
arousel
()
$template
.
bootstrapC
arousel
()
equal
(
$template
.
find
(
'
.item
'
)[
0
],
$template
.
find
(
'
.active
'
)[
0
],
'
the first carousel item should be active
'
)
equal
(
$template
.
find
(
'
.item
'
)[
0
],
$template
.
find
(
'
.active
'
)[
0
],
'
the first carousel item should be active
'
)
$template
.
c
arousel
(
1
)
$template
.
bootstrapC
arousel
(
1
)
equal
(
$template
.
find
(
'
.item
'
)[
1
],
$template
.
find
(
'
.active
'
)[
0
],
'
the second carousel item should be active
'
)
equal
(
$template
.
find
(
'
.item
'
)[
1
],
$template
.
find
(
'
.active
'
)[
0
],
'
the second carousel item should be active
'
)
})
})
...
...
js/tests/unit/collapse.js
View file @
f20f6660
$
(
function
()
{
$
(
function
()
{
module
(
'
collapse
'
)
module
(
'
collapse plugin
'
)
test
(
'
should provide no conflict
'
,
function
()
{
var
collapse
=
$
.
fn
.
collapse
.
noConflict
()
ok
(
!
$
.
fn
.
collapse
,
'
collapse was set back to undefined (org value)
'
)
$
.
fn
.
collapse
=
collapse
})
test
(
'
should be defined on jquery object
'
,
function
()
{
test
(
'
should be defined on jquery object
'
,
function
()
{
ok
(
$
(
document
.
body
).
collapse
,
'
collapse method is defined
'
)
ok
(
$
(
document
.
body
).
collapse
,
'
collapse method is defined
'
)
})
})
module
(
'
collapse
'
,
{
setup
:
function
()
{
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$
.
fn
.
bootstrapCollapse
=
$
.
fn
.
collapse
.
noConflict
()
},
teardown
:
function
()
{
$
.
fn
.
collapse
=
$
.
fn
.
bootstrapCollapse
delete
$
.
fn
.
bootstrapCollapse
}
})
test
(
'
should provide no conflict
'
,
function
()
{
ok
(
!
$
.
fn
.
collapse
,
'
collapse was set back to undefined (org value)
'
)
})
test
(
'
should return element
'
,
function
()
{
test
(
'
should return element
'
,
function
()
{
ok
(
$
(
document
.
body
).
c
ollapse
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
ok
(
$
(
document
.
body
).
bootstrapC
ollapse
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
})
})
test
(
'
should show a collapsed element
'
,
function
()
{
test
(
'
should show a collapsed element
'
,
function
()
{
var
el
=
$
(
'
<div class="collapse"></div>
'
).
c
ollapse
(
'
show
'
)
var
el
=
$
(
'
<div class="collapse"></div>
'
).
bootstrapC
ollapse
(
'
show
'
)
ok
(
el
.
hasClass
(
'
in
'
),
'
has class in
'
)
ok
(
el
.
hasClass
(
'
in
'
),
'
has class in
'
)
ok
(
!
/height/
.
test
(
el
.
attr
(
'
style
'
)),
'
has height reset
'
)
ok
(
!
/height/
.
test
(
el
.
attr
(
'
style
'
)),
'
has height reset
'
)
})
})
test
(
'
should hide a collapsed element
'
,
function
()
{
test
(
'
should hide a collapsed element
'
,
function
()
{
var
el
=
$
(
'
<div class="collapse"></div>
'
).
c
ollapse
(
'
hide
'
)
var
el
=
$
(
'
<div class="collapse"></div>
'
).
bootstrapC
ollapse
(
'
hide
'
)
ok
(
!
el
.
hasClass
(
'
in
'
),
'
does not have class in
'
)
ok
(
!
el
.
hasClass
(
'
in
'
),
'
does not have class in
'
)
ok
(
/height/
.
test
(
el
.
attr
(
'
style
'
)),
'
has height set
'
)
ok
(
/height/
.
test
(
el
.
attr
(
'
style
'
)),
'
has height set
'
)
})
})
...
@@ -40,7 +49,7 @@ $(function () {
...
@@ -40,7 +49,7 @@ $(function () {
.
on
(
'
shown.bs.collapse
'
,
function
()
{
.
on
(
'
shown.bs.collapse
'
,
function
()
{
ok
(
false
)
ok
(
false
)
})
})
.
c
ollapse
(
'
show
'
)
.
bootstrapC
ollapse
(
'
show
'
)
})
})
test
(
'
should reset style to auto after finishing opening collapse
'
,
function
()
{
test
(
'
should reset style to auto after finishing opening collapse
'
,
function
()
{
...
@@ -54,7 +63,7 @@ $(function () {
...
@@ -54,7 +63,7 @@ $(function () {
ok
(
this
.
style
.
height
===
''
)
ok
(
this
.
style
.
height
===
''
)
start
()
start
()
})
})
.
c
ollapse
(
'
show
'
)
.
bootstrapC
ollapse
(
'
show
'
)
})
})
test
(
'
should add active class to target when collapse shown
'
,
function
()
{
test
(
'
should add active class to target when collapse shown
'
,
function
()
{
...
...
js/tests/unit/dropdown.js
View file @
f20f6660
$
(
function
()
{
$
(
function
()
{
module
(
'
dropdowns
'
)
module
(
'
dropdowns plugin
'
)
test
(
'
should provide no conflict
'
,
function
()
{
var
dropdown
=
$
.
fn
.
dropdown
.
noConflict
()
ok
(
!
$
.
fn
.
dropdown
,
'
dropdown was set back to undefined (org value)
'
)
$
.
fn
.
dropdown
=
dropdown
})
test
(
'
should be defined on jquery object
'
,
function
()
{
test
(
'
should be defined on jquery object
'
,
function
()
{
ok
(
$
(
document
.
body
).
dropdown
,
'
dropdown method is defined
'
)
ok
(
$
(
document
.
body
).
dropdown
,
'
dropdown method is defined
'
)
})
})
module
(
'
dropdowns
'
,
{
setup
:
function
()
{
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$
.
fn
.
bootstrapDropdown
=
$
.
fn
.
dropdown
.
noConflict
()
},
teardown
:
function
()
{
$
.
fn
.
dropdown
=
$
.
fn
.
bootstrapDropdown
delete
$
.
fn
.
bootstrapDropdown
}
})
test
(
'
should provide no conflict
'
,
function
()
{
ok
(
!
$
.
fn
.
dropdown
,
'
dropdown was set back to undefined (org value)
'
)
})
test
(
'
should return element
'
,
function
()
{
test
(
'
should return element
'
,
function
()
{
var
el
=
$
(
'
<div />
'
)
var
el
=
$
(
'
<div />
'
)
ok
(
el
.
d
ropdown
()[
0
]
===
el
[
0
],
'
same element returned
'
)
ok
(
el
.
bootstrapD
ropdown
()[
0
]
===
el
[
0
],
'
same element returned
'
)
})
})
test
(
'
should not open dropdown if target is disabled
'
,
function
()
{
test
(
'
should not open dropdown if target is disabled
'
,
function
()
{
...
@@ -29,7 +38,7 @@ $(function () {
...
@@ -29,7 +38,7 @@ $(function () {
'
</ul>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</li>
'
+
'
</ul>
'
,
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
d
ropdown
().
click
()
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
bootstrapD
ropdown
().
click
()
ok
(
!
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
ok
(
!
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
})
})
...
@@ -46,7 +55,7 @@ $(function () {
...
@@ -46,7 +55,7 @@ $(function () {
'
</ul>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</li>
'
+
'
</ul>
'
,
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
d
ropdown
().
click
()
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
bootstrapD
ropdown
().
click
()
ok
(
!
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
ok
(
!
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
})
})
...
@@ -63,7 +72,7 @@ $(function () {
...
@@ -63,7 +72,7 @@ $(function () {
'
</ul>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</li>
'
+
'
</ul>
'
,
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
d
ropdown
().
click
()
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
bootstrapD
ropdown
().
click
()
ok
(
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
ok
(
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
})
})
...
@@ -80,7 +89,7 @@ $(function () {
...
@@ -80,7 +89,7 @@ $(function () {
'
</ul>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</li>
'
+
'
</ul>
'
,
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
d
ropdown
().
click
()
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
bootstrapD
ropdown
().
click
()
ok
(
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
ok
(
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
})
})
...
@@ -101,7 +110,7 @@ $(function () {
...
@@ -101,7 +110,7 @@ $(function () {
dropdown
=
$
(
dropdownHTML
)
dropdown
=
$
(
dropdownHTML
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
d
ropdown
()
.
bootstrapD
ropdown
()
.
click
()
.
click
()
ok
(
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
ok
(
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
...
@@ -163,7 +172,7 @@ $(function () {
...
@@ -163,7 +172,7 @@ $(function () {
dropdown
=
$
(
dropdownHTML
)
dropdown
=
$
(
dropdownHTML
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
d
ropdown
()
.
bootstrapD
ropdown
()
stop
()
stop
()
...
@@ -197,7 +206,7 @@ $(function () {
...
@@ -197,7 +206,7 @@ $(function () {
dropdown
=
$
(
dropdownHTML
)
dropdown
=
$
(
dropdownHTML
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
d
ropdown
()
.
bootstrapD
ropdown
()
stop
()
stop
()
...
...
js/tests/unit/modal.js
View file @
f20f6660
$
(
function
()
{
$
(
function
()
{
module
(
'
modal
'
)
module
(
'
modal plugin
'
)
test
(
'
should provide no conflict
'
,
function
()
{
var
modal
=
$
.
fn
.
modal
.
noConflict
()
ok
(
!
$
.
fn
.
modal
,
'
modal was set back to undefined (org value)
'
)
$
.
fn
.
modal
=
modal
})
test
(
'
should be defined on jquery object
'
,
function
()
{
test
(
'
should be defined on jquery object
'
,
function
()
{
var
div
=
$
(
'
<div id="modal-test"></div>
'
)
var
div
=
$
(
'
<div id="modal-test"></div>
'
)
ok
(
div
.
modal
,
'
modal method is defined
'
)
ok
(
div
.
modal
,
'
modal method is defined
'
)
})
})
module
(
'
modal
'
,
{
setup
:
function
()
{
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$
.
fn
.
bootstrapModal
=
$
.
fn
.
modal
.
noConflict
()
},
teardown
:
function
()
{
$
.
fn
.
modal
=
$
.
fn
.
bootstrapModal
delete
$
.
fn
.
bootstrapModal
}
})
test
(
'
should provide no conflict
'
,
function
()
{
ok
(
!
$
.
fn
.
modal
,
'
modal was set back to undefined (org value)
'
)
})
test
(
'
should return element
'
,
function
()
{
test
(
'
should return element
'
,
function
()
{
var
div
=
$
(
'
<div id="modal-test"></div>
'
)
var
div
=
$
(
'
<div id="modal-test"></div>
'
)
ok
(
div
.
m
odal
()
==
div
,
'
document.body returned
'
)
ok
(
div
.
bootstrapM
odal
()
==
div
,
'
document.body returned
'
)
$
(
'
#modal-test
'
).
remove
()
$
(
'
#modal-test
'
).
remove
()
})
})
test
(
'
should expose defaults var for settings
'
,
function
()
{
test
(
'
should expose defaults var for settings
'
,
function
()
{
ok
(
$
.
fn
.
m
odal
.
Constructor
.
DEFAULTS
,
'
default object exposed
'
)
ok
(
$
.
fn
.
bootstrapM
odal
.
Constructor
.
DEFAULTS
,
'
default object exposed
'
)
})
})
test
(
'
should insert into dom when show method is called
'
,
function
()
{
test
(
'
should insert into dom when show method is called
'
,
function
()
{
...
@@ -32,7 +41,7 @@ $(function () {
...
@@ -32,7 +41,7 @@ $(function () {
$
(
this
).
remove
()
$
(
this
).
remove
()
start
()
start
()
})
})
.
m
odal
(
'
show
'
)
.
bootstrapM
odal
(
'
show
'
)
})
})
test
(
'
should fire show event
'
,
function
()
{
test
(
'
should fire show event
'
,
function
()
{
...
@@ -46,7 +55,7 @@ $(function () {
...
@@ -46,7 +55,7 @@ $(function () {
$
(
this
).
remove
()
$
(
this
).
remove
()
start
()
start
()
})
})
.
m
odal
(
'
show
'
)
.
bootstrapM
odal
(
'
show
'
)
})
})
test
(
'
should not fire shown when default prevented
'
,
function
()
{
test
(
'
should not fire shown when default prevented
'
,
function
()
{
...
@@ -61,7 +70,7 @@ $(function () {
...
@@ -61,7 +70,7 @@ $(function () {
.
on
(
'
shown.bs.modal
'
,
function
()
{
.
on
(
'
shown.bs.modal
'
,
function
()
{
ok
(
false
,
'
shown was called
'
)
ok
(
false
,
'
shown was called
'
)
})
})
.
m
odal
(
'
show
'
)
.
bootstrapM
odal
(
'
show
'
)
})
})
test
(
'
should hide modal when hide is called
'
,
function
()
{
test
(
'
should hide modal when hide is called
'
,
function
()
{
...
@@ -72,14 +81,14 @@ $(function () {
...
@@ -72,14 +81,14 @@ $(function () {
.
on
(
'
shown.bs.modal
'
,
function
()
{
.
on
(
'
shown.bs.modal
'
,
function
()
{
ok
(
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal visible
'
)
ok
(
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal visible
'
)
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal inserted into dom
'
)
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal inserted into dom
'
)
$
(
this
).
m
odal
(
'
hide
'
)
$
(
this
).
bootstrapM
odal
(
'
hide
'
)
})
})
.
on
(
'
hidden.bs.modal
'
,
function
()
{
.
on
(
'
hidden.bs.modal
'
,
function
()
{
ok
(
!
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal hidden
'
)
ok
(
!
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal hidden
'
)
$
(
'
#modal-test
'
).
remove
()
$
(
'
#modal-test
'
).
remove
()
start
()
start
()
})
})
.
m
odal
(
'
show
'
)
.
bootstrapM
odal
(
'
show
'
)
})
})
test
(
'
should toggle when toggle is called
'
,
function
()
{
test
(
'
should toggle when toggle is called
'
,
function
()
{
...
@@ -90,14 +99,14 @@ $(function () {
...
@@ -90,14 +99,14 @@ $(function () {
.
on
(
'
shown.bs.modal
'
,
function
()
{
.
on
(
'
shown.bs.modal
'
,
function
()
{
ok
(
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal visible
'
)
ok
(
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal visible
'
)
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal inserted into dom
'
)
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal inserted into dom
'
)
div
.
m
odal
(
'
toggle
'
)
div
.
bootstrapM
odal
(
'
toggle
'
)
})
})
.
on
(
'
hidden.bs.modal
'
,
function
()
{
.
on
(
'
hidden.bs.modal
'
,
function
()
{
ok
(
!
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal hidden
'
)
ok
(
!
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal hidden
'
)
div
.
remove
()
div
.
remove
()
start
()
start
()
})
})
.
m
odal
(
'
toggle
'
)
.
bootstrapM
odal
(
'
toggle
'
)
})
})
test
(
'
should remove from dom when click [data-dismiss="modal"]
'
,
function
()
{
test
(
'
should remove from dom when click [data-dismiss="modal"]
'
,
function
()
{
...
@@ -115,7 +124,7 @@ $(function () {
...
@@ -115,7 +124,7 @@ $(function () {
div
.
remove
()
div
.
remove
()
start
()
start
()
})
})
.
m
odal
(
'
toggle
'
)
.
bootstrapM
odal
(
'
toggle
'
)
})
})
test
(
'
should allow modal close with "backdrop:false"
'
,
function
()
{
test
(
'
should allow modal close with "backdrop:false"
'
,
function
()
{
...
@@ -125,14 +134,14 @@ $(function () {
...
@@ -125,14 +134,14 @@ $(function () {
div
div
.
on
(
'
shown.bs.modal
'
,
function
()
{
.
on
(
'
shown.bs.modal
'
,
function
()
{
ok
(
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal visible
'
)
ok
(
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal visible
'
)
div
.
m
odal
(
'
hide
'
)
div
.
bootstrapM
odal
(
'
hide
'
)
})
})
.
on
(
'
hidden.bs.modal
'
,
function
()
{
.
on
(
'
hidden.bs.modal
'
,
function
()
{
ok
(
!
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal hidden
'
)
ok
(
!
$
(
'
#modal-test
'
).
is
(
'
:visible
'
),
'
modal hidden
'
)
div
.
remove
()
div
.
remove
()
start
()
start
()
})
})
.
m
odal
(
'
show
'
)
.
bootstrapM
odal
(
'
show
'
)
})
})
test
(
'
should close modal when clicking outside of modal-content
'
,
function
()
{
test
(
'
should close modal when clicking outside of modal-content
'
,
function
()
{
...
@@ -151,7 +160,7 @@ $(function () {
...
@@ -151,7 +160,7 @@ $(function () {
div
.
remove
()
div
.
remove
()
start
()
start
()
})
})
.
m
odal
(
'
show
'
)
.
bootstrapM
odal
(
'
show
'
)
})
})
test
(
'
should trigger hide event once when clicking outside of modal-content
'
,
function
()
{
test
(
'
should trigger hide event once when clicking outside of modal-content
'
,
function
()
{
...
@@ -171,7 +180,7 @@ $(function () {
...
@@ -171,7 +180,7 @@ $(function () {
ok
(
triggered
===
1
,
'
modal hide triggered once
'
)
ok
(
triggered
===
1
,
'
modal hide triggered once
'
)
start
()
start
()
})
})
.
m
odal
(
'
show
'
)
.
bootstrapM
odal
(
'
show
'
)
})
})
test
(
'
should close reopened modal with [data-dismiss="modal"] click
'
,
function
()
{
test
(
'
should close reopened modal with [data-dismiss="modal"] click
'
,
function
()
{
...
@@ -186,9 +195,9 @@ $(function () {
...
@@ -186,9 +195,9 @@ $(function () {
.
one
(
'
hidden.bs.modal
'
,
function
()
{
.
one
(
'
hidden.bs.modal
'
,
function
()
{
div
.
one
(
'
hidden.bs.modal
'
,
function
()
{
div
.
one
(
'
hidden.bs.modal
'
,
function
()
{
start
()
start
()
}).
m
odal
(
'
show
'
)
}).
bootstrapM
odal
(
'
show
'
)
})
})
.
m
odal
(
'
show
'
)
.
bootstrapM
odal
(
'
show
'
)
div
.
remove
()
div
.
remove
()
})
})
...
...
js/tests/unit/popover.js
View file @
f20f6660
$
(
function
()
{
$
(
function
()
{
module
(
'
popover
'
)
module
(
'
popover plugin
'
)
test
(
'
should provide no conflict
'
,
function
()
{
var
popover
=
$
.
fn
.
popover
.
noConflict
()
ok
(
!
$
.
fn
.
popover
,
'
popover was set back to undefined (org value)
'
)
$
.
fn
.
popover
=
popover
})
test
(
'
should be defined on jquery object
'
,
function
()
{
test
(
'
should be defined on jquery object
'
,
function
()
{
var
div
=
$
(
'
<div></div>
'
)
var
div
=
$
(
'
<div></div>
'
)
ok
(
div
.
popover
,
'
popover method is defined
'
)
ok
(
div
.
popover
,
'
popover method is defined
'
)
})
})
module
(
'
popover
'
,
{
setup
:
function
()
{
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$
.
fn
.
bootstrapPopover
=
$
.
fn
.
popover
.
noConflict
()
},
teardown
:
function
()
{
$
.
fn
.
popover
=
$
.
fn
.
bootstrapPopover
delete
$
.
fn
.
bootstrapPopover
}
})
test
(
'
should provide no conflict
'
,
function
()
{
ok
(
!
$
.
fn
.
popover
,
'
popover was set back to undefined (org value)
'
)
})
test
(
'
should return element
'
,
function
()
{
test
(
'
should return element
'
,
function
()
{
var
div
=
$
(
'
<div></div>
'
)
var
div
=
$
(
'
<div></div>
'
)
ok
(
div
.
p
opover
()
==
div
,
'
document.body returned
'
)
ok
(
div
.
bootstrapP
opover
()
==
div
,
'
document.body returned
'
)
})
})
test
(
'
should render popover element
'
,
function
()
{
test
(
'
should render popover element
'
,
function
()
{
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>
'
)
var
popover
=
$
(
'
<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
p
opover
(
'
show
'
)
.
bootstrapP
opover
(
'
show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
popover
.
p
opover
(
'
hide
'
)
popover
.
bootstrapP
opover
(
'
hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover removed
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover removed
'
)
})
})
test
(
'
should store popover instance in popover data object
'
,
function
()
{
test
(
'
should store popover instance in popover data object
'
,
function
()
{
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>
'
)
var
popover
=
$
(
'
<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>
'
)
.
p
opover
()
.
bootstrapP
opover
()
ok
(
!!
popover
.
data
(
'
bs.popover
'
),
'
popover instance exists
'
)
ok
(
!!
popover
.
data
(
'
bs.popover
'
),
'
popover instance exists
'
)
})
})
...
@@ -41,7 +50,7 @@ $(function () {
...
@@ -41,7 +50,7 @@ $(function () {
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#">@fat</a>
'
)
var
popover
=
$
(
'
<a href="#">@fat</a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
p
opover
({
.
bootstrapP
opover
({
title
:
function
()
{
title
:
function
()
{
return
'
@fat
'
return
'
@fat
'
},
},
...
@@ -50,13 +59,13 @@ $(function () {
...
@@ -50,13 +59,13 @@ $(function () {
}
}
})
})
popover
.
p
opover
(
'
show
'
)
popover
.
bootstrapP
opover
(
'
show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
equal
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@fat
'
,
'
title correctly inserted
'
)
equal
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@fat
'
,
'
title correctly inserted
'
)
equal
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves writing tests (╯°□°)╯︵ ┻━┻
'
,
'
content correctly inserted
'
)
equal
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves writing tests (╯°□°)╯︵ ┻━┻
'
,
'
content correctly inserted
'
)
popover
.
p
opover
(
'
hide
'
)
popover
.
bootstrapP
opover
(
'
hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
$
(
'
#qunit-fixture
'
).
empty
()
$
(
'
#qunit-fixture
'
).
empty
()
})
})
...
@@ -68,24 +77,24 @@ $(function () {
...
@@ -68,24 +77,24 @@ $(function () {
var
popover
=
$
(
'
<a href="#">@fat</a>
'
)
var
popover
=
$
(
'
<a href="#">@fat</a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
p
opover
({
.
bootstrapP
opover
({
content
:
function
()
{
content
:
function
()
{
return
$div
return
$div
}
}
})
})
popover
.
p
opover
(
'
show
'
)
popover
.
bootstrapP
opover
(
'
show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
equal
(
$
(
'
.popover .popover-content
'
).
html
(),
$div
,
'
content correctly inserted
'
)
equal
(
$
(
'
.popover .popover-content
'
).
html
(),
$div
,
'
content correctly inserted
'
)
popover
.
p
opover
(
'
hide
'
)
popover
.
bootstrapP
opover
(
'
hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
popover
.
p
opover
(
'
show
'
)
popover
.
bootstrapP
opover
(
'
show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
equal
(
$
(
'
.popover .popover-content
'
).
html
(),
$div
,
'
content correctly inserted
'
)
equal
(
$
(
'
.popover .popover-content
'
).
html
(),
$div
,
'
content correctly inserted
'
)
popover
.
p
opover
(
'
hide
'
)
popover
.
bootstrapP
opover
(
'
hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
$
(
'
#qunit-fixture
'
).
empty
()
$
(
'
#qunit-fixture
'
).
empty
()
})
})
...
@@ -94,14 +103,14 @@ $(function () {
...
@@ -94,14 +103,14 @@ $(function () {
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>
'
)
var
popover
=
$
(
'
<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
p
opover
()
.
bootstrapP
opover
()
.
p
opover
(
'
show
'
)
.
bootstrapP
opover
(
'
show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
equal
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@mdo
'
,
'
title correctly inserted
'
)
equal
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@mdo
'
,
'
title correctly inserted
'
)
equal
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻
'
,
'
content correctly inserted
'
)
equal
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻
'
,
'
content correctly inserted
'
)
popover
.
p
opover
(
'
hide
'
)
popover
.
bootstrapP
opover
(
'
hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
$
(
'
#qunit-fixture
'
).
empty
()
$
(
'
#qunit-fixture
'
).
empty
()
})
})
...
@@ -111,17 +120,17 @@ $(function () {
...
@@ -111,17 +120,17 @@ $(function () {
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>
'
)
var
popover
=
$
(
'
<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
p
opover
({
.
bootstrapP
opover
({
title
:
'
ignored title option
'
,
title
:
'
ignored title option
'
,
content
:
'
ignored content option
'
content
:
'
ignored content option
'
})
})
.
p
opover
(
'
show
'
)
.
bootstrapP
opover
(
'
show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
equal
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@mdo
'
,
'
title correctly inserted
'
)
equal
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@mdo
'
,
'
title correctly inserted
'
)
equal
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻
'
,
'
content correctly inserted
'
)
equal
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻
'
,
'
content correctly inserted
'
)
popover
.
p
opover
(
'
hide
'
)
popover
.
bootstrapP
opover
(
'
hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
$
(
'
#qunit-fixture
'
).
empty
()
$
(
'
#qunit-fixture
'
).
empty
()
})
})
...
@@ -130,29 +139,29 @@ $(function () {
...
@@ -130,29 +139,29 @@ $(function () {
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#">@fat</a>
'
)
var
popover
=
$
(
'
<a href="#">@fat</a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
p
opover
({
.
bootstrapP
opover
({
title
:
'
Test
'
,
title
:
'
Test
'
,
content
:
'
Test
'
,
content
:
'
Test
'
,
template
:
'
<div class="popover foobar"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>
'
template
:
'
<div class="popover foobar"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>
'
})
})
popover
.
p
opover
(
'
show
'
)
popover
.
bootstrapP
opover
(
'
show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
ok
(
$
(
'
.popover
'
).
hasClass
(
'
foobar
'
),
'
custom class is present
'
)
ok
(
$
(
'
.popover
'
).
hasClass
(
'
foobar
'
),
'
custom class is present
'
)
popover
.
p
opover
(
'
hide
'
)
popover
.
bootstrapP
opover
(
'
hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
$
(
'
#qunit-fixture
'
).
empty
()
$
(
'
#qunit-fixture
'
).
empty
()
})
})
test
(
'
should destroy popover
'
,
function
()
{
test
(
'
should destroy popover
'
,
function
()
{
var
popover
=
$
(
'
<div/>
'
).
p
opover
({
trigger
:
'
hover
'
}).
on
(
'
click.foo
'
,
function
()
{})
var
popover
=
$
(
'
<div/>
'
).
bootstrapP
opover
({
trigger
:
'
hover
'
}).
on
(
'
click.foo
'
,
function
()
{})
ok
(
popover
.
data
(
'
bs.popover
'
),
'
popover has data
'
)
ok
(
popover
.
data
(
'
bs.popover
'
),
'
popover has data
'
)
ok
(
$
.
_data
(
popover
[
0
],
'
events
'
).
mouseover
&&
$
.
_data
(
popover
[
0
],
'
events
'
).
mouseout
,
'
popover has hover event
'
)
ok
(
$
.
_data
(
popover
[
0
],
'
events
'
).
mouseover
&&
$
.
_data
(
popover
[
0
],
'
events
'
).
mouseout
,
'
popover has hover event
'
)
ok
(
$
.
_data
(
popover
[
0
],
'
events
'
).
click
[
0
].
namespace
==
'
foo
'
,
'
popover has extra click.foo event
'
)
ok
(
$
.
_data
(
popover
[
0
],
'
events
'
).
click
[
0
].
namespace
==
'
foo
'
,
'
popover has extra click.foo event
'
)
popover
.
p
opover
(
'
show
'
)
popover
.
bootstrapP
opover
(
'
show
'
)
popover
.
p
opover
(
'
destroy
'
)
popover
.
bootstrapP
opover
(
'
destroy
'
)
ok
(
!
popover
.
hasClass
(
'
in
'
),
'
popover is hidden
'
)
ok
(
!
popover
.
hasClass
(
'
in
'
),
'
popover is hidden
'
)
ok
(
!
popover
.
data
(
'
popover
'
),
'
popover does not have data
'
)
ok
(
!
popover
.
data
(
'
popover
'
),
'
popover does not have data
'
)
ok
(
$
.
_data
(
popover
[
0
],
'
events
'
).
click
[
0
].
namespace
==
'
foo
'
,
'
popover still has click.foo
'
)
ok
(
$
.
_data
(
popover
[
0
],
'
events
'
).
click
[
0
].
namespace
==
'
foo
'
,
'
popover still has click.foo
'
)
...
...
js/tests/unit/scrollspy.js
View file @
f20f6660
$
(
function
()
{
$
(
function
()
{
module
(
'
scrollspy
'
)
module
(
'
scrollspy plugin
'
)
test
(
'
should provide no conflict
'
,
function
()
{
var
scrollspy
=
$
.
fn
.
scrollspy
.
noConflict
()
ok
(
!
$
.
fn
.
scrollspy
,
'
scrollspy was set back to undefined (org value)
'
)
$
.
fn
.
scrollspy
=
scrollspy
})
test
(
'
should be defined on jquery object
'
,
function
()
{
test
(
'
should be defined on jquery object
'
,
function
()
{
ok
(
$
(
document
.
body
).
scrollspy
,
'
scrollspy method is defined
'
)
ok
(
$
(
document
.
body
).
scrollspy
,
'
scrollspy method is defined
'
)
})
})
module
(
'
scrollspy
'
,
{
setup
:
function
()
{
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$
.
fn
.
bootstrapScrollspy
=
$
.
fn
.
scrollspy
.
noConflict
()
},
teardown
:
function
()
{
$
.
fn
.
scrollspy
=
$
.
fn
.
bootstrapScrollspy
delete
$
.
fn
.
bootstrapScrollspy
}
})
test
(
'
should provide no conflict
'
,
function
()
{
ok
(
!
$
.
fn
.
scrollspy
,
'
scrollspy was set back to undefined (org value)
'
)
})
test
(
'
should return element
'
,
function
()
{
test
(
'
should return element
'
,
function
()
{
ok
(
$
(
document
.
body
).
s
crollspy
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
ok
(
$
(
document
.
body
).
bootstrapS
crollspy
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
})
})
test
(
'
should switch active class on scroll
'
,
function
()
{
test
(
'
should switch active class on scroll
'
,
function
()
{
...
@@ -27,7 +36,7 @@ $(function () {
...
@@ -27,7 +36,7 @@ $(function () {
'
</div>
'
+
'
</div>
'
+
'
</div>
'
+
'
</div>
'
+
'
</div>
'
,
'
</div>
'
,
$topbar
=
$
(
topbarHTML
).
s
crollspy
()
$topbar
=
$
(
topbarHTML
).
bootstrapS
crollspy
()
$
(
sectionHTML
).
append
(
'
#qunit-fixture
'
)
$
(
sectionHTML
).
append
(
'
#qunit-fixture
'
)
ok
(
$topbar
.
find
(
'
.active
'
,
true
))
ok
(
$topbar
.
find
(
'
.active
'
,
true
))
...
@@ -64,7 +73,7 @@ $(function () {
...
@@ -64,7 +73,7 @@ $(function () {
$scrollSpy
=
$section
$scrollSpy
=
$section
.
show
()
.
show
()
.
find
(
'
#scrollspy-example
'
)
.
find
(
'
#scrollspy-example
'
)
.
s
crollspy
({
target
:
'
#ss-target
'
})
.
bootstrapS
crollspy
({
target
:
'
#ss-target
'
})
$scrollSpy
.
scrollTop
(
350
);
$scrollSpy
.
scrollTop
(
350
);
ok
(
$section
.
hasClass
(
'
active
'
),
'
Active class still on root node
'
)
ok
(
$section
.
hasClass
(
'
active
'
),
'
Active class still on root node
'
)
...
...
js/tests/unit/tab.js
View file @
f20f6660
$
(
function
()
{
$
(
function
()
{
module
(
'
tabs
'
)
module
(
'
tabs plugin
'
)
test
(
'
should provide no conflict
'
,
function
()
{
var
tab
=
$
.
fn
.
tab
.
noConflict
()
ok
(
!
$
.
fn
.
tab
,
'
tab was set back to undefined (org value)
'
)
$
.
fn
.
tab
=
tab
})
test
(
'
should be defined on jquery object
'
,
function
()
{
test
(
'
should be defined on jquery object
'
,
function
()
{
ok
(
$
(
document
.
body
).
tab
,
'
tabs method is defined
'
)
ok
(
$
(
document
.
body
).
tab
,
'
tabs method is defined
'
)
})
})
module
(
'
tabs
'
,
{
setup
:
function
()
{
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$
.
fn
.
bootstrapTab
=
$
.
fn
.
tab
.
noConflict
()
},
teardown
:
function
()
{
$
.
fn
.
tab
=
$
.
fn
.
bootstrapTab
delete
$
.
fn
.
bootstrapTab
}
})
test
(
'
should provide no conflict
'
,
function
()
{
ok
(
!
$
.
fn
.
tab
,
'
tab was set back to undefined (org value)
'
)
})
test
(
'
should return element
'
,
function
()
{
test
(
'
should return element
'
,
function
()
{
ok
(
$
(
document
.
body
).
t
ab
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
ok
(
$
(
document
.
body
).
bootstrapT
ab
()[
0
]
==
document
.
body
,
'
document.body returned
'
)
})
})
test
(
'
should activate element by tab id
'
,
function
()
{
test
(
'
should activate element by tab id
'
,
function
()
{
...
@@ -24,10 +33,10 @@ $(function () {
...
@@ -24,10 +33,10 @@ $(function () {
$
(
'
<ul><li id="home"></li><li id="profile"></li></ul>
'
).
appendTo
(
'
#qunit-fixture
'
)
$
(
'
<ul><li id="home"></li><li id="profile"></li></ul>
'
).
appendTo
(
'
#qunit-fixture
'
)
$
(
tabsHTML
).
find
(
'
li:last a
'
).
t
ab
(
'
show
'
)
$
(
tabsHTML
).
find
(
'
li:last a
'
).
bootstrapT
ab
(
'
show
'
)
equal
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
profile
'
)
equal
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
profile
'
)
$
(
tabsHTML
).
find
(
'
li:first a
'
).
t
ab
(
'
show
'
)
$
(
tabsHTML
).
find
(
'
li:first a
'
).
bootstrapT
ab
(
'
show
'
)
equal
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
home
'
)
equal
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
home
'
)
})
})
...
@@ -39,10 +48,10 @@ $(function () {
...
@@ -39,10 +48,10 @@ $(function () {
$
(
'
<ul><li id="home"></li><li id="profile"></li></ul>
'
).
appendTo
(
'
#qunit-fixture
'
)
$
(
'
<ul><li id="home"></li><li id="profile"></li></ul>
'
).
appendTo
(
'
#qunit-fixture
'
)
$
(
pillsHTML
).
find
(
'
li:last a
'
).
t
ab
(
'
show
'
)
$
(
pillsHTML
).
find
(
'
li:last a
'
).
bootstrapT
ab
(
'
show
'
)
equal
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
profile
'
)
equal
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
profile
'
)
$
(
pillsHTML
).
find
(
'
li:first a
'
).
t
ab
(
'
show
'
)
$
(
pillsHTML
).
find
(
'
li:first a
'
).
bootstrapT
ab
(
'
show
'
)
equal
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
home
'
)
equal
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
home
'
)
})
})
...
@@ -59,7 +68,7 @@ $(function () {
...
@@ -59,7 +68,7 @@ $(function () {
.
on
(
'
shown.bs.tab
'
,
function
()
{
.
on
(
'
shown.bs.tab
'
,
function
()
{
ok
(
false
)
ok
(
false
)
})
})
.
t
ab
(
'
show
'
)
.
bootstrapT
ab
(
'
show
'
)
})
})
test
(
'
show and shown events should reference correct relatedTarget
'
,
function
()
{
test
(
'
show and shown events should reference correct relatedTarget
'
,
function
()
{
...
@@ -72,7 +81,7 @@ $(function () {
...
@@ -72,7 +81,7 @@ $(function () {
'
</li>
'
+
'
</li>
'
+
'
</ul>
'
'
</ul>
'
$
(
dropHTML
).
find
(
'
ul>li:first a
'
).
t
ab
(
'
show
'
).
end
()
$
(
dropHTML
).
find
(
'
ul>li:first a
'
).
bootstrapT
ab
(
'
show
'
).
end
()
.
find
(
'
ul>li:last a
'
)
.
find
(
'
ul>li:last a
'
)
.
on
(
'
show.bs.tab
'
,
function
(
event
)
{
.
on
(
'
show.bs.tab
'
,
function
(
event
)
{
equal
(
event
.
relatedTarget
.
hash
,
'
#1-1
'
)
equal
(
event
.
relatedTarget
.
hash
,
'
#1-1
'
)
...
@@ -80,7 +89,7 @@ $(function () {
...
@@ -80,7 +89,7 @@ $(function () {
.
on
(
'
show.bs.tab
'
,
function
(
event
)
{
.
on
(
'
show.bs.tab
'
,
function
(
event
)
{
equal
(
event
.
relatedTarget
.
hash
,
'
#1-1
'
)
equal
(
event
.
relatedTarget
.
hash
,
'
#1-1
'
)
})
})
.
t
ab
(
'
show
'
)
.
bootstrapT
ab
(
'
show
'
)
})
})
})
})
js/tests/unit/tooltip.js
View file @
f20f6660
$
(
function
()
{
$
(
function
()
{
module
(
'
tooltip
'
)
module
(
'
tooltip plugin
'
)
test
(
'
should provide no conflict
'
,
function
()
{
var
tooltip
=
$
.
fn
.
tooltip
.
noConflict
()
ok
(
!
$
.
fn
.
tooltip
,
'
tooltip was set back to undefined (org value)
'
)
$
.
fn
.
tooltip
=
tooltip
})
test
(
'
should be defined on jquery object
'
,
function
()
{
test
(
'
should be defined on jquery object
'
,
function
()
{
var
div
=
$
(
'
<div></div>
'
)
var
div
=
$
(
'
<div></div>
'
)
ok
(
div
.
tooltip
,
'
popover method is defined
'
)
ok
(
div
.
tooltip
,
'
popover method is defined
'
)
})
})
module
(
'
tooltip
'
,
{
setup
:
function
()
{
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
$
.
fn
.
bootstrapTooltip
=
$
.
fn
.
tooltip
.
noConflict
()
},
teardown
:
function
()
{
$
.
fn
.
tooltip
=
$
.
fn
.
bootstrapTooltip
delete
$
.
fn
.
bootstrapTooltip
}
})
test
(
'
should provide no conflict
'
,
function
()
{
ok
(
!
$
.
fn
.
tooltip
,
'
tooltip was set back to undefined (org value)
'
)
})
test
(
'
should return element
'
,
function
()
{
test
(
'
should return element
'
,
function
()
{
var
div
=
$
(
'
<div></div>
'
)
var
div
=
$
(
'
<div></div>
'
)
ok
(
div
.
t
ooltip
()
==
div
,
'
document.body returned
'
)
ok
(
div
.
bootstrapT
ooltip
()
==
div
,
'
document.body returned
'
)
})
})
test
(
'
should expose default settings
'
,
function
()
{
test
(
'
should expose default settings
'
,
function
()
{
ok
(
!!
$
.
fn
.
t
ooltip
.
Constructor
.
DEFAULTS
,
'
defaults is defined
'
)
ok
(
!!
$
.
fn
.
bootstrapT
ooltip
.
Constructor
.
DEFAULTS
,
'
defaults is defined
'
)
})
})
test
(
'
should empty title attribute
'
,
function
()
{
test
(
'
should empty title attribute
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
).
t
ooltip
()
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
).
bootstrapT
ooltip
()
ok
(
tooltip
.
attr
(
'
title
'
)
===
''
,
'
title attribute was emptied
'
)
ok
(
tooltip
.
attr
(
'
title
'
)
===
''
,
'
title attribute was emptied
'
)
})
})
test
(
'
should add data attribute for referencing original title
'
,
function
()
{
test
(
'
should add data attribute for referencing original title
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
).
t
ooltip
()
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
).
bootstrapT
ooltip
()
equal
(
tooltip
.
attr
(
'
data-original-title
'
),
'
Another tooltip
'
,
'
original title preserved in data attribute
'
)
equal
(
tooltip
.
attr
(
'
data-original-title
'
),
'
Another tooltip
'
,
'
original title preserved in data attribute
'
)
})
})
...
@@ -36,33 +45,33 @@ $(function () {
...
@@ -36,33 +45,33 @@ $(function () {
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
placement
:
'
bottom
'
})
.
bootstrapT
ooltip
({
placement
:
'
bottom
'
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.bottom.in
'
),
'
has correct classes applied
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.bottom.in
'
),
'
has correct classes applied
'
)
tooltip
.
t
ooltip
(
'
hide
'
)
tooltip
.
bootstrapT
ooltip
(
'
hide
'
)
})
})
test
(
'
should allow html entities
'
,
function
()
{
test
(
'
should allow html entities
'
,
function
()
{
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="<b>@fat</b>"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="<b>@fat</b>"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
html
:
true
})
.
bootstrapT
ooltip
({
html
:
true
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip b
'
).
length
,
'
b tag was inserted
'
)
ok
(
$
(
'
.tooltip b
'
).
length
,
'
b tag was inserted
'
)
tooltip
.
t
ooltip
(
'
hide
'
)
tooltip
.
bootstrapT
ooltip
(
'
hide
'
)
ok
(
!
$
(
'
.tooltip
'
).
length
,
'
tooltip removed
'
)
ok
(
!
$
(
'
.tooltip
'
).
length
,
'
tooltip removed
'
)
})
})
test
(
'
should respect custom classes
'
,
function
()
{
test
(
'
should respect custom classes
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
template
:
'
<div class="tooltip some-class"><div class="tooltip-arrow"/><div class="tooltip-inner"/></div>
'
})
.
bootstrapT
ooltip
({
template
:
'
<div class="tooltip some-class"><div class="tooltip-arrow"/><div class="tooltip-inner"/></div>
'
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
hasClass
(
'
some-class
'
),
'
custom class is present
'
)
ok
(
$
(
'
.tooltip
'
).
hasClass
(
'
some-class
'
),
'
custom class is present
'
)
tooltip
.
t
ooltip
(
'
hide
'
)
tooltip
.
bootstrapT
ooltip
(
'
hide
'
)
ok
(
!
$
(
'
.tooltip
'
).
length
,
'
tooltip removed
'
)
ok
(
!
$
(
'
.tooltip
'
).
length
,
'
tooltip removed
'
)
})
})
...
@@ -73,7 +82,7 @@ $(function () {
...
@@ -73,7 +82,7 @@ $(function () {
ok
(
true
,
'
show was called
'
)
ok
(
true
,
'
show was called
'
)
start
()
start
()
})
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
})
})
test
(
'
should fire shown event
'
,
function
()
{
test
(
'
should fire shown event
'
,
function
()
{
...
@@ -83,7 +92,7 @@ $(function () {
...
@@ -83,7 +92,7 @@ $(function () {
ok
(
true
,
'
shown was called
'
)
ok
(
true
,
'
shown was called
'
)
start
()
start
()
})
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
})
})
test
(
'
should not fire shown event when default prevented
'
,
function
()
{
test
(
'
should not fire shown event when default prevented
'
,
function
()
{
...
@@ -97,40 +106,40 @@ $(function () {
...
@@ -97,40 +106,40 @@ $(function () {
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
ok
(
false
,
'
shown was called
'
)
ok
(
false
,
'
shown was called
'
)
})
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
})
})
test
(
'
should fire hide event
'
,
function
()
{
test
(
'
should fire hide event
'
,
function
()
{
stop
()
stop
()
$
(
'
<div title="tooltip title"></div>
'
)
$
(
'
<div title="tooltip title"></div>
'
)
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
$
(
this
).
t
ooltip
(
'
hide
'
)
$
(
this
).
bootstrapT
ooltip
(
'
hide
'
)
})
})
.
on
(
'
hide.bs.tooltip
'
,
function
()
{
.
on
(
'
hide.bs.tooltip
'
,
function
()
{
ok
(
true
,
'
hide was called
'
)
ok
(
true
,
'
hide was called
'
)
start
()
start
()
})
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
})
})
test
(
'
should fire hidden event
'
,
function
()
{
test
(
'
should fire hidden event
'
,
function
()
{
stop
()
stop
()
$
(
'
<div title="tooltip title"></div>
'
)
$
(
'
<div title="tooltip title"></div>
'
)
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
$
(
this
).
t
ooltip
(
'
hide
'
)
$
(
this
).
bootstrapT
ooltip
(
'
hide
'
)
})
})
.
on
(
'
hidden.bs.tooltip
'
,
function
()
{
.
on
(
'
hidden.bs.tooltip
'
,
function
()
{
ok
(
true
,
'
hidden was called
'
)
ok
(
true
,
'
hidden was called
'
)
start
()
start
()
})
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
})
})
test
(
'
should not fire hidden event when default prevented
'
,
function
()
{
test
(
'
should not fire hidden event when default prevented
'
,
function
()
{
stop
()
stop
()
$
(
'
<div title="tooltip title"></div>
'
)
$
(
'
<div title="tooltip title"></div>
'
)
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
$
(
this
).
t
ooltip
(
'
hide
'
)
$
(
this
).
bootstrapT
ooltip
(
'
hide
'
)
})
})
.
on
(
'
hide.bs.tooltip
'
,
function
(
e
)
{
.
on
(
'
hide.bs.tooltip
'
,
function
(
e
)
{
e
.
preventDefault
()
e
.
preventDefault
()
...
@@ -140,13 +149,13 @@ $(function () {
...
@@ -140,13 +149,13 @@ $(function () {
.
on
(
'
hidden.bs.tooltip
'
,
function
()
{
.
on
(
'
hidden.bs.tooltip
'
,
function
()
{
ok
(
false
,
'
hidden was called
'
)
ok
(
false
,
'
hidden was called
'
)
})
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
})
})
test
(
'
should not show tooltip if leave event occurs before delay expires
'
,
function
()
{
test
(
'
should not show tooltip if leave event occurs before delay expires
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
delay
:
200
})
.
bootstrapT
ooltip
({
delay
:
200
})
stop
()
stop
()
...
@@ -165,7 +174,7 @@ $(function () {
...
@@ -165,7 +174,7 @@ $(function () {
test
(
'
should not show tooltip if leave event occurs before delay expires, even if hide delay is 0
'
,
function
()
{
test
(
'
should not show tooltip if leave event occurs before delay expires, even if hide delay is 0
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
delay
:
{
show
:
200
,
hide
:
0
}
})
.
bootstrapT
ooltip
({
delay
:
{
show
:
200
,
hide
:
0
}
})
stop
()
stop
()
...
@@ -184,7 +193,7 @@ $(function () {
...
@@ -184,7 +193,7 @@ $(function () {
test
(
'
should wait 200 ms before hiding the tooltip
'
,
3
,
function
()
{
test
(
'
should wait 200 ms before hiding the tooltip
'
,
3
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
delay
:
{
show
:
0
,
hide
:
200
}
})
.
bootstrapT
ooltip
({
delay
:
{
show
:
0
,
hide
:
200
}
})
stop
()
stop
()
...
@@ -206,7 +215,7 @@ $(function () {
...
@@ -206,7 +215,7 @@ $(function () {
test
(
'
should not hide tooltip if leave event occurs, then tooltip is show immediately again
'
,
function
()
{
test
(
'
should not hide tooltip if leave event occurs, then tooltip is show immediately again
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
delay
:
{
show
:
0
,
hide
:
200
}
})
.
bootstrapT
ooltip
({
delay
:
{
show
:
0
,
hide
:
200
}
})
stop
()
stop
()
...
@@ -229,7 +238,7 @@ $(function () {
...
@@ -229,7 +238,7 @@ $(function () {
test
(
'
should not show tooltip if leave event occurs before delay expires
'
,
function
()
{
test
(
'
should not show tooltip if leave event occurs before delay expires
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
delay
:
100
})
.
bootstrapT
ooltip
({
delay
:
100
})
stop
()
stop
()
tooltip
.
trigger
(
'
mouseenter
'
)
tooltip
.
trigger
(
'
mouseenter
'
)
setTimeout
(
function
()
{
setTimeout
(
function
()
{
...
@@ -245,7 +254,7 @@ $(function () {
...
@@ -245,7 +254,7 @@ $(function () {
test
(
'
should show tooltip if leave event hasn
\'
t occured before delay expires
'
,
function
()
{
test
(
'
should show tooltip if leave event hasn
\'
t occured before delay expires
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
delay
:
150
})
.
bootstrapT
ooltip
({
delay
:
150
})
stop
()
stop
()
tooltip
.
trigger
(
'
mouseenter
'
)
tooltip
.
trigger
(
'
mouseenter
'
)
setTimeout
(
function
()
{
setTimeout
(
function
()
{
...
@@ -258,12 +267,12 @@ $(function () {
...
@@ -258,12 +267,12 @@ $(function () {
})
})
test
(
'
should destroy tooltip
'
,
function
()
{
test
(
'
should destroy tooltip
'
,
function
()
{
var
tooltip
=
$
(
'
<div/>
'
).
t
ooltip
().
on
(
'
click.foo
'
,
function
()
{})
var
tooltip
=
$
(
'
<div/>
'
).
bootstrapT
ooltip
().
on
(
'
click.foo
'
,
function
()
{})
ok
(
tooltip
.
data
(
'
bs.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
'
).
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
'
)
ok
(
$
.
_data
(
tooltip
[
0
],
'
events
'
).
click
[
0
].
namespace
==
'
foo
'
,
'
tooltip has extra click.foo event
'
)
tooltip
.
t
ooltip
(
'
show
'
)
tooltip
.
bootstrapT
ooltip
(
'
show
'
)
tooltip
.
t
ooltip
(
'
destroy
'
)
tooltip
.
bootstrapT
ooltip
(
'
destroy
'
)
ok
(
!
tooltip
.
hasClass
(
'
in
'
),
'
tooltip is hidden
'
)
ok
(
!
tooltip
.
hasClass
(
'
in
'
),
'
tooltip is hidden
'
)
ok
(
!
$
.
_data
(
tooltip
[
0
],
'
bs.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
'
).
click
[
0
].
namespace
==
'
foo
'
,
'
tooltip still has click.foo
'
)
...
@@ -273,7 +282,7 @@ $(function () {
...
@@ -273,7 +282,7 @@ $(function () {
test
(
'
should show tooltip with delegate selector on click
'
,
function
()
{
test
(
'
should show tooltip with delegate selector on click
'
,
function
()
{
var
div
=
$
(
'
<div><a href="#" rel="tooltip" title="Another tooltip"></a></div>
'
)
var
div
=
$
(
'
<div><a href="#" rel="tooltip" title="Another tooltip"></a></div>
'
)
div
.
appendTo
(
'
#qunit-fixture
'
)
div
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
selector
:
'
a[rel="tooltip"]
'
,
trigger
:
'
click
'
})
.
bootstrapT
ooltip
({
selector
:
'
a[rel="tooltip"]
'
,
trigger
:
'
click
'
})
div
.
find
(
'
a
'
).
trigger
(
'
click
'
)
div
.
find
(
'
a
'
).
trigger
(
'
click
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.in
'
),
'
tooltip is faded in
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.in
'
),
'
tooltip is faded in
'
)
})
})
...
@@ -281,19 +290,19 @@ $(function () {
...
@@ -281,19 +290,19 @@ $(function () {
test
(
'
should show tooltip when toggle is called
'
,
function
()
{
test
(
'
should show tooltip when toggle is called
'
,
function
()
{
$
(
'
<a href="#" rel="tooltip" title="tooltip on toggle"></a>
'
)
$
(
'
<a href="#" rel="tooltip" title="tooltip on toggle"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
trigger
:
'
manual
'
})
.
bootstrapT
ooltip
({
trigger
:
'
manual
'
})
.
t
ooltip
(
'
toggle
'
)
.
bootstrapT
ooltip
(
'
toggle
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.in
'
),
'
tooltip should be toggled in
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.in
'
),
'
tooltip should be toggled in
'
)
})
})
test
(
'
should place tooltips inside the body
'
,
function
()
{
test
(
'
should place tooltips inside the body
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Another tooltip"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
container
:
'
body
'
})
.
bootstrapT
ooltip
({
container
:
'
body
'
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
ok
(
$
(
'
body > .tooltip
'
).
length
,
'
inside the body
'
)
ok
(
$
(
'
body > .tooltip
'
).
length
,
'
inside the body
'
)
ok
(
!
$
(
'
#qunit-fixture > .tooltip
'
).
length
,
'
not found in parent
'
)
ok
(
!
$
(
'
#qunit-fixture > .tooltip
'
).
length
,
'
not found in parent
'
)
tooltip
.
t
ooltip
(
'
hide
'
)
tooltip
.
bootstrapT
ooltip
(
'
hide
'
)
})
})
test
(
'
should place tooltip inside window
'
,
function
()
{
test
(
'
should place tooltip inside window
'
,
function
()
{
...
@@ -302,8 +311,8 @@ $(function () {
...
@@ -302,8 +311,8 @@ $(function () {
$
(
'
<a href="#" title="Very very very very very very very very long tooltip">Hover me</a>
'
)
$
(
'
<a href="#" title="Very very very very very very very very long tooltip">Hover me</a>
'
)
.
css
({
position
:
'
absolute
'
,
top
:
0
,
left
:
0
})
.
css
({
position
:
'
absolute
'
,
top
:
0
,
left
:
0
})
.
appendTo
(
container
)
.
appendTo
(
container
)
.
t
ooltip
({
placement
:
'
top
'
,
animate
:
false
})
.
bootstrapT
ooltip
({
placement
:
'
top
'
,
animate
:
false
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
stop
()
stop
()
...
@@ -322,8 +331,8 @@ $(function () {
...
@@ -322,8 +331,8 @@ $(function () {
tooltiped
=
$
(
'
<a href="#" title="very very very very very very very long tooltip">Hover me</a>
'
)
tooltiped
=
$
(
'
<a href="#" title="very very very very very very very long tooltip">Hover me</a>
'
)
.
css
({
marginTop
:
200
})
.
css
({
marginTop
:
200
})
.
appendTo
(
p
)
.
appendTo
(
p
)
.
t
ooltip
({
placement
:
'
top
'
,
animate
:
false
})
.
bootstrapT
ooltip
({
placement
:
'
top
'
,
animate
:
false
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
stop
()
stop
()
...
@@ -342,8 +351,8 @@ $(function () {
...
@@ -342,8 +351,8 @@ $(function () {
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
),
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
),
target
=
$
(
'
<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line"></a>
'
)
target
=
$
(
'
<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line"></a>
'
)
.
appendTo
(
container
)
.
appendTo
(
container
)
.
t
ooltip
({
placement
:
'
right
'
,
viewport
:
null
})
.
bootstrapT
ooltip
({
placement
:
'
right
'
,
viewport
:
null
})
.
t
ooltip
(
'
show
'
),
.
bootstrapT
ooltip
(
'
show
'
),
tooltip
=
container
.
find
(
'
.tooltip
'
)
tooltip
=
container
.
find
(
'
.tooltip
'
)
// this is some dumb hack shit because sub pixels in firefox
// this is some dumb hack shit because sub pixels in firefox
...
@@ -351,41 +360,41 @@ $(function () {
...
@@ -351,41 +360,41 @@ $(function () {
var
top2
=
Math
.
round
(
tooltip
.
offset
().
top
)
var
top2
=
Math
.
round
(
tooltip
.
offset
().
top
)
var
topDiff
=
top
-
top2
var
topDiff
=
top
-
top2
ok
(
topDiff
<=
1
&&
topDiff
>=
-
1
)
ok
(
topDiff
<=
1
&&
topDiff
>=
-
1
)
target
.
t
ooltip
(
'
hide
'
)
target
.
bootstrapT
ooltip
(
'
hide
'
)
$
(
'
head #test
'
).
remove
()
$
(
'
head #test
'
).
remove
()
})
})
test
(
'
tooltip title test #1
'
,
function
()
{
test
(
'
tooltip title test #1
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Simple tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Simple tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({})
.
bootstrapT
ooltip
({})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
equal
(
$
(
'
.tooltip
'
).
children
(
'
.tooltip-inner
'
).
text
(),
'
Simple tooltip
'
,
'
title from title attribute is set
'
)
equal
(
$
(
'
.tooltip
'
).
children
(
'
.tooltip-inner
'
).
text
(),
'
Simple tooltip
'
,
'
title from title attribute is set
'
)
tooltip
.
t
ooltip
(
'
hide
'
)
tooltip
.
bootstrapT
ooltip
(
'
hide
'
)
ok
(
!
$
(
'
.tooltip
'
).
length
,
'
tooltip removed
'
)
ok
(
!
$
(
'
.tooltip
'
).
length
,
'
tooltip removed
'
)
})
})
test
(
'
tooltip title test #2
'
,
function
()
{
test
(
'
tooltip title test #2
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Simple tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="Simple tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
.
bootstrapT
ooltip
({
title
:
'
This is a tooltip with some content
'
title
:
'
This is a tooltip with some content
'
})
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
equal
(
$
(
'
.tooltip
'
).
children
(
'
.tooltip-inner
'
).
text
(),
'
Simple tooltip
'
,
'
title is set from title attribute while prefered over title option
'
)
equal
(
$
(
'
.tooltip
'
).
children
(
'
.tooltip-inner
'
).
text
(),
'
Simple tooltip
'
,
'
title is set from title attribute while prefered over title option
'
)
tooltip
.
t
ooltip
(
'
hide
'
)
tooltip
.
bootstrapT
ooltip
(
'
hide
'
)
ok
(
!
$
(
'
.tooltip
'
).
length
,
'
tooltip removed
'
)
ok
(
!
$
(
'
.tooltip
'
).
length
,
'
tooltip removed
'
)
})
})
test
(
'
tooltip title test #3
'
,
function
()
{
test
(
'
tooltip title test #3
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>
'
)
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
t
ooltip
({
.
bootstrapT
ooltip
({
title
:
'
This is a tooltip with some content
'
title
:
'
This is a tooltip with some content
'
})
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
equal
(
$
(
'
.tooltip
'
).
children
(
'
.tooltip-inner
'
).
text
(),
'
This is a tooltip with some content
'
,
'
title from title option is set
'
)
equal
(
$
(
'
.tooltip
'
).
children
(
'
.tooltip-inner
'
).
text
(),
'
This is a tooltip with some content
'
,
'
title from title option is set
'
)
tooltip
.
t
ooltip
(
'
hide
'
)
tooltip
.
bootstrapT
ooltip
(
'
hide
'
)
ok
(
!
$
(
'
.tooltip
'
).
length
,
'
tooltip removed
'
)
ok
(
!
$
(
'
.tooltip
'
).
length
,
'
tooltip removed
'
)
})
})
...
@@ -403,28 +412,28 @@ $(function () {
...
@@ -403,28 +412,28 @@ $(function () {
var
topTooltip
=
$
(
'
<div style="display: inline-block; position: absolute; left: 0; top: 0;" rel="tooltip" title="Top tooltip">Top Dynamic Tooltip</div>
'
)
var
topTooltip
=
$
(
'
<div style="display: inline-block; position: absolute; left: 0; top: 0;" rel="tooltip" title="Top tooltip">Top Dynamic Tooltip</div>
'
)
.
appendTo
(
'
#dynamic-tt-test
'
)
.
appendTo
(
'
#dynamic-tt-test
'
)
.
t
ooltip
({
placement
:
'
auto
'
})
.
bootstrapT
ooltip
({
placement
:
'
auto
'
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.bottom
'
),
'
top positioned tooltip is dynamically positioned bottom
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.bottom
'
),
'
top positioned tooltip is dynamically positioned bottom
'
)
topTooltip
.
t
ooltip
(
'
hide
'
)
topTooltip
.
bootstrapT
ooltip
(
'
hide
'
)
var
rightTooltip
=
$
(
'
<div style="display: inline-block; position: absolute; right: 0;" rel="tooltip" title="Right tooltip">Right Dynamic Tooltip</div>
'
)
var
rightTooltip
=
$
(
'
<div style="display: inline-block; position: absolute; right: 0;" rel="tooltip" title="Right tooltip">Right Dynamic Tooltip</div>
'
)
.
appendTo
(
'
#dynamic-tt-test
'
)
.
appendTo
(
'
#dynamic-tt-test
'
)
.
t
ooltip
({
placement
:
'
right auto
'
})
.
bootstrapT
ooltip
({
placement
:
'
right auto
'
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.left
'
),
'
right positioned tooltip is dynamically positioned left
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.left
'
),
'
right positioned tooltip is dynamically positioned left
'
)
rightTooltip
.
t
ooltip
(
'
hide
'
)
rightTooltip
.
bootstrapT
ooltip
(
'
hide
'
)
var
leftTooltip
=
$
(
'
<div style="display: inline-block; position: absolute; left: 0;" rel="tooltip" title="Left tooltip">Left Dynamic Tooltip</div>
'
)
var
leftTooltip
=
$
(
'
<div style="display: inline-block; position: absolute; left: 0;" rel="tooltip" title="Left tooltip">Left Dynamic Tooltip</div>
'
)
.
appendTo
(
'
#dynamic-tt-test
'
)
.
appendTo
(
'
#dynamic-tt-test
'
)
.
t
ooltip
({
placement
:
'
auto left
'
})
.
bootstrapT
ooltip
({
placement
:
'
auto left
'
})
.
t
ooltip
(
'
show
'
)
.
bootstrapT
ooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.right
'
),
'
left positioned tooltip is dynamically positioned right
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.right
'
),
'
left positioned tooltip is dynamically positioned right
'
)
leftTooltip
.
t
ooltip
(
'
hide
'
)
leftTooltip
.
bootstrapT
ooltip
(
'
hide
'
)
ttContainer
.
remove
()
ttContainer
.
remove
()
})
})
...
@@ -435,12 +444,12 @@ $(function () {
...
@@ -435,12 +444,12 @@ $(function () {
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
),
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
),
target
=
$
(
'
<a href="#" rel="tooltip" title="tip" style="position: fixed; top: 0px; left: 0px;"></a>
'
)
target
=
$
(
'
<a href="#" rel="tooltip" title="tip" style="position: fixed; top: 0px; left: 0px;"></a>
'
)
.
appendTo
(
container
)
.
appendTo
(
container
)
.
t
ooltip
({
placement
:
'
right
'
,
viewport
:
{
selector
:
'
body
'
,
padding
:
12
}})
.
bootstrapT
ooltip
({
placement
:
'
right
'
,
viewport
:
{
selector
:
'
body
'
,
padding
:
12
}})
.
t
ooltip
(
'
show
'
),
.
bootstrapT
ooltip
(
'
show
'
),
tooltip
=
container
.
find
(
'
.tooltip
'
)
tooltip
=
container
.
find
(
'
.tooltip
'
)
ok
(
Math
.
round
(
tooltip
.
offset
().
top
)
===
12
)
ok
(
Math
.
round
(
tooltip
.
offset
().
top
)
===
12
)
target
.
t
ooltip
(
'
hide
'
)
target
.
bootstrapT
ooltip
(
'
hide
'
)
$
(
'
head #test
'
).
remove
()
$
(
'
head #test
'
).
remove
()
})
})
...
@@ -450,12 +459,12 @@ $(function () {
...
@@ -450,12 +459,12 @@ $(function () {
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
),
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
),
target
=
$
(
'
<a href="#" rel="tooltip" title="tip" style="position: fixed; bottom: 0px; left: 0px;"></a>
'
)
target
=
$
(
'
<a href="#" rel="tooltip" title="tip" style="position: fixed; bottom: 0px; left: 0px;"></a>
'
)
.
appendTo
(
container
)
.
appendTo
(
container
)
.
t
ooltip
({
placement
:
'
right
'
,
viewport
:
{
selector
:
'
body
'
,
padding
:
12
}})
.
bootstrapT
ooltip
({
placement
:
'
right
'
,
viewport
:
{
selector
:
'
body
'
,
padding
:
12
}})
.
t
ooltip
(
'
show
'
),
.
bootstrapT
ooltip
(
'
show
'
),
tooltip
=
container
.
find
(
'
.tooltip
'
)
tooltip
=
container
.
find
(
'
.tooltip
'
)
ok
(
Math
.
round
(
tooltip
.
offset
().
top
)
===
Math
.
round
(
$
(
window
).
height
()
-
12
-
tooltip
[
0
].
offsetHeight
)
)
ok
(
Math
.
round
(
tooltip
.
offset
().
top
)
===
Math
.
round
(
$
(
window
).
height
()
-
12
-
tooltip
[
0
].
offsetHeight
)
)
target
.
t
ooltip
(
'
hide
'
)
target
.
bootstrapT
ooltip
(
'
hide
'
)
$
(
'
head #test
'
).
remove
()
$
(
'
head #test
'
).
remove
()
})
})
...
@@ -465,12 +474,12 @@ $(function () {
...
@@ -465,12 +474,12 @@ $(function () {
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
),
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
),
target
=
$
(
'
<a href="#" rel="tooltip" title="tip" style="position: fixed; top: 0px; left: 0px;"></a>
'
)
target
=
$
(
'
<a href="#" rel="tooltip" title="tip" style="position: fixed; top: 0px; left: 0px;"></a>
'
)
.
appendTo
(
container
)
.
appendTo
(
container
)
.
t
ooltip
({
placement
:
'
bottom
'
,
viewport
:
{
selector
:
'
body
'
,
padding
:
12
}})
.
bootstrapT
ooltip
({
placement
:
'
bottom
'
,
viewport
:
{
selector
:
'
body
'
,
padding
:
12
}})
.
t
ooltip
(
'
show
'
),
.
bootstrapT
ooltip
(
'
show
'
),
tooltip
=
container
.
find
(
'
.tooltip
'
)
tooltip
=
container
.
find
(
'
.tooltip
'
)
ok
(
Math
.
round
(
tooltip
.
offset
().
left
)
===
12
)
ok
(
Math
.
round
(
tooltip
.
offset
().
left
)
===
12
)
target
.
t
ooltip
(
'
hide
'
)
target
.
bootstrapT
ooltip
(
'
hide
'
)
$
(
'
head #test
'
).
remove
()
$
(
'
head #test
'
).
remove
()
})
})
...
@@ -480,12 +489,12 @@ $(function () {
...
@@ -480,12 +489,12 @@ $(function () {
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
),
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
),
target
=
$
(
'
<a href="#" rel="tooltip" title="tip" style="position: fixed; top: 0px; right: 0px;"></a>
'
)
target
=
$
(
'
<a href="#" rel="tooltip" title="tip" style="position: fixed; top: 0px; right: 0px;"></a>
'
)
.
appendTo
(
container
)
.
appendTo
(
container
)
.
t
ooltip
({
placement
:
'
bottom
'
,
viewport
:
{
selector
:
'
body
'
,
padding
:
12
}})
.
bootstrapT
ooltip
({
placement
:
'
bottom
'
,
viewport
:
{
selector
:
'
body
'
,
padding
:
12
}})
.
t
ooltip
(
'
show
'
),
.
bootstrapT
ooltip
(
'
show
'
),
tooltip
=
container
.
find
(
'
.tooltip
'
)
tooltip
=
container
.
find
(
'
.tooltip
'
)
ok
(
Math
.
round
(
tooltip
.
offset
().
left
)
===
Math
.
round
(
$
(
window
).
width
()
-
12
-
tooltip
[
0
].
offsetWidth
)
)
ok
(
Math
.
round
(
tooltip
.
offset
().
left
)
===
Math
.
round
(
$
(
window
).
width
()
-
12
-
tooltip
[
0
].
offsetWidth
)
)
target
.
t
ooltip
(
'
hide
'
)
target
.
bootstrapT
ooltip
(
'
hide
'
)
$
(
'
head #test
'
).
remove
()
$
(
'
head #test
'
).
remove
()
})
})
...
@@ -496,12 +505,12 @@ $(function () {
...
@@ -496,12 +505,12 @@ $(function () {
var
container
=
$
(
'
<div />
'
,
{
class
:
'
container-viewport
'
}).
appendTo
(
'
body
'
),
var
container
=
$
(
'
<div />
'
,
{
class
:
'
container-viewport
'
}).
appendTo
(
'
body
'
),
target
=
$
(
'
<a href="#" rel="tooltip" title="tip" style="position: fixed; top: 50px; left: 350px;"></a>
'
)
target
=
$
(
'
<a href="#" rel="tooltip" title="tip" style="position: fixed; top: 50px; left: 350px;"></a>
'
)
.
appendTo
(
container
)
.
appendTo
(
container
)
.
t
ooltip
({
placement
:
'
bottom
'
,
viewport
:
'
.container-viewport
'
})
.
bootstrapT
ooltip
({
placement
:
'
bottom
'
,
viewport
:
'
.container-viewport
'
})
.
t
ooltip
(
'
show
'
),
.
bootstrapT
ooltip
(
'
show
'
),
tooltip
=
container
.
find
(
'
.tooltip
'
)
tooltip
=
container
.
find
(
'
.tooltip
'
)
ok
(
Math
.
round
(
tooltip
.
offset
().
left
)
===
Math
.
round
(
60
+
container
.
width
()
-
tooltip
[
0
].
offsetWidth
)
)
ok
(
Math
.
round
(
tooltip
.
offset
().
left
)
===
Math
.
round
(
60
+
container
.
width
()
-
tooltip
[
0
].
offsetWidth
)
)
target
.
t
ooltip
(
'
hide
'
)
target
.
bootstrapT
ooltip
(
'
hide
'
)
$
(
'
head #test
'
).
remove
()
$
(
'
head #test
'
).
remove
()
$
(
'
head #viewport-style
'
).
remove
()
$
(
'
head #viewport-style
'
).
remove
()
})
})
...
...
js/tooltip.js
View file @
f20f6660
...
@@ -99,7 +99,12 @@
...
@@ -99,7 +99,12 @@
Tooltip
.
prototype
.
enter
=
function
(
obj
)
{
Tooltip
.
prototype
.
enter
=
function
(
obj
)
{
var
self
=
obj
instanceof
this
.
constructor
?
var
self
=
obj
instanceof
this
.
constructor
?
obj
:
$
(
obj
.
currentTarget
)[
this
.
type
](
this
.
getDelegateOptions
()).
data
(
'
bs.
'
+
this
.
type
)
obj
:
$
(
obj
.
currentTarget
).
data
(
'
bs.
'
+
this
.
type
)
if
(
!
self
)
{
self
=
new
this
.
constructor
(
obj
.
currentTarget
,
this
.
getDelegateOptions
())
$
(
obj
.
currentTarget
).
data
(
'
bs.
'
+
this
.
type
,
self
)
}
clearTimeout
(
self
.
timeout
)
clearTimeout
(
self
.
timeout
)
...
@@ -114,7 +119,12 @@
...
@@ -114,7 +119,12 @@
Tooltip
.
prototype
.
leave
=
function
(
obj
)
{
Tooltip
.
prototype
.
leave
=
function
(
obj
)
{
var
self
=
obj
instanceof
this
.
constructor
?
var
self
=
obj
instanceof
this
.
constructor
?
obj
:
$
(
obj
.
currentTarget
)[
this
.
type
](
this
.
getDelegateOptions
()).
data
(
'
bs.
'
+
this
.
type
)
obj
:
$
(
obj
.
currentTarget
).
data
(
'
bs.
'
+
this
.
type
)
if
(
!
self
)
{
self
=
new
this
.
constructor
(
obj
.
currentTarget
,
this
.
getDelegateOptions
())
$
(
obj
.
currentTarget
).
data
(
'
bs.
'
+
this
.
type
,
self
)
}
clearTimeout
(
self
.
timeout
)
clearTimeout
(
self
.
timeout
)
...
@@ -381,7 +391,15 @@
...
@@ -381,7 +391,15 @@
}
}
Tooltip
.
prototype
.
toggle
=
function
(
e
)
{
Tooltip
.
prototype
.
toggle
=
function
(
e
)
{
var
self
=
e
?
$
(
e
.
currentTarget
)[
this
.
type
](
this
.
getDelegateOptions
()).
data
(
'
bs.
'
+
this
.
type
)
:
this
var
self
=
this
if
(
e
)
{
self
=
$
(
e
.
currentTarget
).
data
(
'
bs.
'
+
this
.
type
)
if
(
!
self
)
{
self
=
new
this
.
constructor
(
e
.
currentTarget
,
this
.
getDelegateOptions
())
$
(
e
.
currentTarget
).
data
(
'
bs.
'
+
this
.
type
,
self
)
}
}
self
.
tip
().
hasClass
(
'
in
'
)
?
self
.
leave
(
self
)
:
self
.
enter
(
self
)
self
.
tip
().
hasClass
(
'
in
'
)
?
self
.
leave
(
self
)
:
self
.
enter
(
self
)
}
}
...
@@ -394,9 +412,7 @@
...
@@ -394,9 +412,7 @@
// TOOLTIP PLUGIN DEFINITION
// TOOLTIP PLUGIN DEFINITION
// =========================
// =========================
var
old
=
$
.
fn
.
tooltip
function
Plugin
(
option
)
{
$
.
fn
.
tooltip
=
function
(
option
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'
bs.tooltip
'
)
var
data
=
$this
.
data
(
'
bs.tooltip
'
)
...
@@ -408,6 +424,9 @@
...
@@ -408,6 +424,9 @@
})
})
}
}
var
old
=
$
.
fn
.
tooltip
$
.
fn
.
tooltip
=
Plugin
$
.
fn
.
tooltip
.
Constructor
=
Tooltip
$
.
fn
.
tooltip
.
Constructor
=
Tooltip
...
...
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