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
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests/unit/bootstrap-tooltip.js')
-rw-r--r--js/tests/unit/bootstrap-tooltip.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js
index 9844d6460f..bbdf3ce80f 100644
--- a/js/tests/unit/bootstrap-tooltip.js
+++ b/js/tests/unit/bootstrap-tooltip.js
@@ -37,10 +37,11 @@ $(function () {
tooltip.tooltip('hide')
})
- test("should always allow html entities", function () {
+ test("should allow html entities", function () {
$.support.transition = false
var tooltip = $('<a href="#" rel="tooltip" title="<b>@fat</b>"></a>')
.appendTo('#qunit-fixture')
+ .tooltip({html: true})
.tooltip('show')
ok($('.tooltip b').length, 'b tag was inserted')
@@ -113,7 +114,7 @@ $(function () {
}, 50)
})
- test("should show tooltip if leave event hasn't occurred 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>')
.appendTo('#qunit-fixture')
.tooltip({ delay: 150 })
@@ -131,14 +132,22 @@ $(function () {
test("should destroy tooltip", function () {
var tooltip = $('<div/>').tooltip().on('click.foo', function(){})
ok(tooltip.data('tooltip'), 'tooltip has data')
- ok(tooltip.data('events').mouseover && tooltip.data('events').mouseout, 'tooltip has hover event')
- ok(tooltip.data('events').click[0].namespace == 'foo', 'tooltip has extra click.foo 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')
tooltip.tooltip('show')
tooltip.tooltip('destroy')
ok(!tooltip.hasClass('in'), 'tooltip is hidden')
- ok(!tooltip.data('tooltip'), 'tooltip does not have data')
- ok(tooltip.data('events').click[0].namespace == 'foo', 'tooltip still has click.foo')
- ok(!tooltip.data('events').mouseover && !tooltip.data('events').mouseout, 'tooltip does not have any events')
+ ok(!$._data(tooltip[0], 'tooltip'), 'tooltip does not have data')
+ ok($._data(tooltip[0], 'events').click[0].namespace == 'foo', 'tooltip still has click.foo')
+ ok(!$._data(tooltip[0], 'events').mouseover && !$._data(tooltip[0], 'events').mouseout, 'tooltip does not have any events')
})
-})
+ test("should show tooltip with delegate selector on click", function () {
+ var div = $('<div><a href="#" rel="tooltip" title="Another tooltip"></a></div>')
+ var tooltip = div.appendTo('#qunit-fixture')
+ .tooltip({ selector: 'a[rel=tooltip]',
+ trigger: 'click' })
+ div.find('a').trigger('click')
+ ok($(".tooltip").is('.fade.in'), 'tooltip is faded in')
+ })
+}) \ No newline at end of file