diff options
author | Mark Otto <otto@github.com> | 2012-10-30 09:01:58 +0400 |
---|---|---|
committer | Mark Otto <otto@github.com> | 2012-10-30 09:01:58 +0400 |
commit | b5af762ef59e1fa97f4386f5feadb67aa5183fef (patch) | |
tree | 3bcd0841e6938379e8c8ae7259ee16f27a49ea41 /js/tests/unit/bootstrap-tooltip.js | |
parent | 7426ced0fb288a9e86f18da1849ad74f652d219a (diff) | |
parent | 68cfedb34af198f178128f8c9bc8ea164e44304a (diff) |
Merge branch '2.1.2-wip'v2.2.0
Conflicts:
js/bootstrap-dropdown.js
Diffstat (limited to 'js/tests/unit/bootstrap-tooltip.js')
-rw-r--r-- | js/tests/unit/bootstrap-tooltip.js | 25 |
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 |