Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorJacob Thornton <jacobthornton@gmail.com>2012-04-15 10:10:03 +0400
committerJacob Thornton <jacobthornton@gmail.com>2012-04-15 10:10:03 +0400
commitb14455b03a977cbbf99112d39b55461785666a3f (patch)
tree8ae483f2ea9cde63dee038dca9eb890d1299faa2 /js/tests
parentc7dc4cc573c61306ae849d316f432160b16a2099 (diff)
add tests for mouseout delay in tooltip
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/unit/bootstrap-tooltip.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js
index f6e00089b1..63f4f0b07c 100644
--- a/js/tests/unit/bootstrap-tooltip.js
+++ b/js/tests/unit/bootstrap-tooltip.js
@@ -59,6 +59,56 @@ $(function () {
ok(!$(".tooltip").length, 'tooltip removed')
})
+ test("should not show tooltip if leave event occurs before delay expires", function () {
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
+ .appendTo('#qunit-fixture')
+ .tooltip({ delay: 200 })
+
+ stop()
+
+ tooltip.trigger('mouseenter')
+
+ setTimeout(function () {
+ ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in')
+ tooltip.trigger('mouseout')
+ setTimeout(function () {
+ ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in')
+ start()
+ }, 200)
+ }, 100)
+ })
+
+ test("should not show tooltip if leave event occurs before delay expires", function () {
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
+ .appendTo('#qunit-fixture')
+ .tooltip({ delay: 100 })
+ stop()
+ tooltip.trigger('mouseenter')
+ setTimeout(function () {
+ ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in')
+ tooltip.trigger('mouseout')
+ setTimeout(function () {
+ ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in')
+ start()
+ }, 100)
+ }, 50)
+ })
+
+ test("should show tooltip if leave event hasn't occured before delay expires", function () {
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
+ .appendTo('#qunit-fixture')
+ .tooltip({ delay: 200 })
+ stop()
+ tooltip.trigger('mouseenter')
+ setTimeout(function () {
+ ok(!$(".tooltip").hasClass('fade in'), 'tooltip is not faded in')
+ setTimeout(function () {
+ ok(!$(".tooltip").hasClass('fade in'), 'tooltip has faded in')
+ start()
+ }, 200)
+ }, 100)
+ })
+
test("should detect if title string is html or text: foo", function () {
ok(!$.fn.tooltip.Constructor.prototype.isHTML('foo'), 'correctly detected html')
})