aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2012-06-01 10:53:47 -0700
committerJacob Thornton <[email protected]>2012-06-01 10:53:47 -0700
commit5657ab46c5351d5a5718eff3e8f7acf5cb43f752 (patch)
treeef81c0025662070b5a0e265f5c30155189f74e6f /js/tests/unit
parenta85c8fe74e2bea9c99ad405dd667035b5307e31e (diff)
parent4eaeea81fd909e6711f57049fc4372f4045fa5aa (diff)
downloadbootstrap-5657ab46c5351d5a5718eff3e8f7acf5cb43f752.tar.xz
bootstrap-5657ab46c5351d5a5718eff3e8f7acf5cb43f752.zip
Merge branch '2.0.4-wip'
Diffstat (limited to 'js/tests/unit')
-rw-r--r--js/tests/unit/bootstrap-tooltip.js43
1 files changed, 31 insertions, 12 deletions
diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js
index 63f4f0b07..7b0c10de0 100644
--- a/js/tests/unit/bootstrap-tooltip.js
+++ b/js/tests/unit/bootstrap-tooltip.js
@@ -33,7 +33,7 @@ $(function () {
.tooltip({placement: 'bottom'})
.tooltip('show')
- ok($(".tooltip").hasClass('fade bottom in'), 'has correct classes applied')
+ ok($(".tooltip").is('.fade.bottom.in'), 'has correct classes applied')
tooltip.tooltip('hide')
})
@@ -69,10 +69,29 @@ $(function () {
tooltip.trigger('mouseenter')
setTimeout(function () {
- ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in')
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
tooltip.trigger('mouseout')
setTimeout(function () {
- ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in')
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
+ start()
+ }, 200)
+ }, 100)
+ })
+
+ 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>')
+ .appendTo('#qunit-fixture')
+ .tooltip({ delay: { show: 200, hide: 0} })
+
+ stop()
+
+ tooltip.trigger('mouseenter')
+
+ setTimeout(function () {
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
+ tooltip.trigger('mouseout')
+ setTimeout(function () {
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
start()
}, 200)
}, 100)
@@ -85,10 +104,10 @@ $(function () {
stop()
tooltip.trigger('mouseenter')
setTimeout(function () {
- ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in')
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
tooltip.trigger('mouseout')
setTimeout(function () {
- ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in')
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
start()
}, 100)
}, 50)
@@ -97,16 +116,16 @@ $(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>')
.appendTo('#qunit-fixture')
- .tooltip({ delay: 200 })
+ .tooltip({ delay: 150 })
stop()
tooltip.trigger('mouseenter')
setTimeout(function () {
- ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in')
- setTimeout(function () {
- ok(!$(".tooltip").hasClass('fade in'), 'tooltip has faded in')
- start()
- }, 200)
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
}, 100)
+ setTimeout(function () {
+ ok($(".tooltip").is('.fade.in'), 'tooltip has faded in')
+ start()
+ }, 200)
})
test("should detect if title string is html or text: foo", function () {
@@ -133,4 +152,4 @@ $(function () {
ok($.fn.tooltip.Constructor.prototype.isHTML($('<div></div>')), 'correctly detected html')
})
-}) \ No newline at end of file
+})