diff options
| author | Jacob Thornton <[email protected]> | 2012-05-31 09:03:53 -0700 |
|---|---|---|
| committer | Jacob Thornton <[email protected]> | 2012-05-31 09:03:53 -0700 |
| commit | bcd5097c0267a8285c2b60fd3b751cd3ae78ad7a (patch) | |
| tree | d1b4e6f5c57c81168d1eb18f40bca5e2fc55ad9a /js/tests/unit | |
| parent | 7875e4833cb7d00db2967078fd6f51adbfd4a351 (diff) | |
| parent | 8dda83906d72ade81ecf9b21d55b5a2922589d30 (diff) | |
| download | bootstrap-bcd5097c0267a8285c2b60fd3b751cd3ae78ad7a.tar.xz bootstrap-bcd5097c0267a8285c2b60fd3b751cd3ae78ad7a.zip | |
Merge pull request #3655 from jorgenfb/8dda83906d72ade81ecf9b21d55b5a2922589d30
Updated unit test for tooltips. Now using is() instead of hasClass()
Diffstat (limited to 'js/tests/unit')
| -rw-r--r-- | js/tests/unit/bootstrap-tooltip.js | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js index 63f4f0b07..63a42b0d4 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) @@ -101,9 +120,9 @@ $(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') setTimeout(function () { - ok(!$(".tooltip").hasClass('fade in'), 'tooltip has faded in') + ok(!$(".tooltip").is('.fade.in'), 'tooltip has faded in') start() }, 200) }, 100) @@ -133,4 +152,4 @@ $(function () { ok($.fn.tooltip.Constructor.prototype.isHTML($('<div></div>')), 'correctly detected html') }) -})
\ No newline at end of file +}) |
