1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-25 12:22:50 +01:00

put the tooltips into the DOM in the tooltip unit tests

This commit is contained in:
Chris Rebert 2014-06-06 15:30:44 -07:00
parent 20c099d41a
commit b23ed1b034

View File

@ -118,9 +118,11 @@ $(function () {
test('should fire shown event', function () { test('should fire shown event', function () {
stop() stop()
$('<div title="tooltip title"></div>') var tooltip = $('<div title="tooltip title"></div>').appendTo('#qunit-fixture')
tooltip
.on('shown.bs.tooltip', function () { .on('shown.bs.tooltip', function () {
ok(true, 'shown was called') ok(true, 'shown was called')
tooltip.remove()
start() start()
}) })
.bootstrapTooltip('show') .bootstrapTooltip('show')
@ -142,12 +144,14 @@ $(function () {
test('should fire hide event', function () { test('should fire hide event', function () {
stop() stop()
$('<div title="tooltip title"></div>') var tooltip = $('<div title="tooltip title"></div>').appendTo('#qunit-fixture')
tooltip
.on('shown.bs.tooltip', function () { .on('shown.bs.tooltip', function () {
$(this).bootstrapTooltip('hide') $(this).bootstrapTooltip('hide')
}) })
.on('hide.bs.tooltip', function () { .on('hide.bs.tooltip', function () {
ok(true, 'hide was called') ok(true, 'hide was called')
tooltip.remove()
start() start()
}) })
.bootstrapTooltip('show') .bootstrapTooltip('show')
@ -155,12 +159,14 @@ $(function () {
test('should fire hidden event', function () { test('should fire hidden event', function () {
stop() stop()
$('<div title="tooltip title"></div>') var tooltip = $('<div title="tooltip title"></div>').appendTo('#qunit-fixture')
tooltip
.on('shown.bs.tooltip', function () { .on('shown.bs.tooltip', function () {
$(this).bootstrapTooltip('hide') $(this).bootstrapTooltip('hide')
}) })
.on('hidden.bs.tooltip', function () { .on('hidden.bs.tooltip', function () {
ok(true, 'hidden was called') ok(true, 'hidden was called')
tooltip.remove()
start() start()
}) })
.bootstrapTooltip('show') .bootstrapTooltip('show')
@ -168,13 +174,15 @@ $(function () {
test('should not fire hidden event when default prevented', function () { test('should not fire hidden event when default prevented', function () {
stop() stop()
$('<div title="tooltip title"></div>') var tooltip = $('<div title="tooltip title"></div>').appendTo('#qunit-fixture')
tooltip
.on('shown.bs.tooltip', function () { .on('shown.bs.tooltip', function () {
$(this).bootstrapTooltip('hide') $(this).bootstrapTooltip('hide')
}) })
.on('hide.bs.tooltip', function (e) { .on('hide.bs.tooltip', function (e) {
e.preventDefault() e.preventDefault()
ok(true, 'hide was called') ok(true, 'hide was called')
tooltip.remove()
start() start()
}) })
.on('hidden.bs.tooltip', function () { .on('hidden.bs.tooltip', function () {