mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
JS unit tests: equal() => strictEqual()
[skip validator]
This commit is contained in:
parent
118b8c2695
commit
9c75c855c6
@ -38,7 +38,7 @@ $(function () {
|
|||||||
|
|
||||||
$alert.find('.close').click()
|
$alert.find('.close').click()
|
||||||
|
|
||||||
assert.equal($alert.hasClass('in'), false, 'remove .in class on .close click')
|
assert.strictEqual($alert.hasClass('in'), false, 'remove .in class on .close click')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should remove element when clicking .close', function (assert) {
|
QUnit.test('should remove element when clicking .close', function (assert) {
|
||||||
@ -52,7 +52,7 @@ $(function () {
|
|||||||
|
|
||||||
$alert.find('.close').click()
|
$alert.find('.close').click()
|
||||||
|
|
||||||
assert.equal($('#qunit-fixture').find('.alert').length, 0, 'element removed from dom')
|
assert.strictEqual($('#qunit-fixture').find('.alert').length, 0, 'element removed from dom')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should not fire closed when close is prevented', function (assert) {
|
QUnit.test('should not fire closed when close is prevented', function (assert) {
|
||||||
|
@ -31,11 +31,11 @@ $(function () {
|
|||||||
|
|
||||||
QUnit.test('should return set state to loading', function (assert) {
|
QUnit.test('should return set state to loading', function (assert) {
|
||||||
var $btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
|
var $btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
|
||||||
assert.equal($btn.html(), 'mdo', 'btn text equals mdo')
|
assert.strictEqual($btn.html(), 'mdo', 'btn text equals mdo')
|
||||||
$btn.bootstrapButton('loading')
|
$btn.bootstrapButton('loading')
|
||||||
var done = assert.async()
|
var done = assert.async()
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
assert.equal($btn.html(), 'fat', 'btn text equals fat')
|
assert.strictEqual($btn.html(), 'fat', 'btn text equals fat')
|
||||||
assert.ok($btn[0].hasAttribute('disabled'), 'btn is disabled')
|
assert.ok($btn[0].hasAttribute('disabled'), 'btn is disabled')
|
||||||
assert.ok($btn.hasClass('disabled'), 'btn has disabled class')
|
assert.ok($btn.hasClass('disabled'), 'btn has disabled class')
|
||||||
done()
|
done()
|
||||||
@ -44,18 +44,18 @@ $(function () {
|
|||||||
|
|
||||||
QUnit.test('should return reset state', function (assert) {
|
QUnit.test('should return reset state', function (assert) {
|
||||||
var $btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
|
var $btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
|
||||||
assert.equal($btn.html(), 'mdo', 'btn text equals mdo')
|
assert.strictEqual($btn.html(), 'mdo', 'btn text equals mdo')
|
||||||
$btn.bootstrapButton('loading')
|
$btn.bootstrapButton('loading')
|
||||||
var doneOne = assert.async()
|
var doneOne = assert.async()
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
assert.equal($btn.html(), 'fat', 'btn text equals fat')
|
assert.strictEqual($btn.html(), 'fat', 'btn text equals fat')
|
||||||
assert.ok($btn[0].hasAttribute('disabled'), 'btn is disabled')
|
assert.ok($btn[0].hasAttribute('disabled'), 'btn is disabled')
|
||||||
assert.ok($btn.hasClass('disabled'), 'btn has disabled class')
|
assert.ok($btn.hasClass('disabled'), 'btn has disabled class')
|
||||||
doneOne()
|
doneOne()
|
||||||
var doneTwo = assert.async()
|
var doneTwo = assert.async()
|
||||||
$btn.bootstrapButton('reset')
|
$btn.bootstrapButton('reset')
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
assert.equal($btn.html(), 'mdo', 'btn text equals mdo')
|
assert.strictEqual($btn.html(), 'mdo', 'btn text equals mdo')
|
||||||
assert.ok(!$btn[0].hasAttribute('disabled'), 'btn is not disabled')
|
assert.ok(!$btn[0].hasAttribute('disabled'), 'btn is not disabled')
|
||||||
assert.ok(!$btn.hasClass('disabled'), 'btn does not have disabled class')
|
assert.ok(!$btn.hasClass('disabled'), 'btn does not have disabled class')
|
||||||
doneTwo()
|
doneTwo()
|
||||||
@ -65,18 +65,18 @@ $(function () {
|
|||||||
|
|
||||||
QUnit.test('should work with an empty string as reset state', function (assert) {
|
QUnit.test('should work with an empty string as reset state', function (assert) {
|
||||||
var $btn = $('<button class="btn" data-loading-text="fat"/>')
|
var $btn = $('<button class="btn" data-loading-text="fat"/>')
|
||||||
assert.equal($btn.html(), '', 'btn text equals ""')
|
assert.strictEqual($btn.html(), '', 'btn text equals ""')
|
||||||
$btn.bootstrapButton('loading')
|
$btn.bootstrapButton('loading')
|
||||||
var doneOne = assert.async()
|
var doneOne = assert.async()
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
assert.equal($btn.html(), 'fat', 'btn text equals fat')
|
assert.strictEqual($btn.html(), 'fat', 'btn text equals fat')
|
||||||
assert.ok($btn[0].hasAttribute('disabled'), 'btn is disabled')
|
assert.ok($btn[0].hasAttribute('disabled'), 'btn is disabled')
|
||||||
assert.ok($btn.hasClass('disabled'), 'btn has disabled class')
|
assert.ok($btn.hasClass('disabled'), 'btn has disabled class')
|
||||||
doneOne()
|
doneOne()
|
||||||
var doneTwo = assert.async()
|
var doneTwo = assert.async()
|
||||||
$btn.bootstrapButton('reset')
|
$btn.bootstrapButton('reset')
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
assert.equal($btn.html(), '', 'btn text equals ""')
|
assert.strictEqual($btn.html(), '', 'btn text equals ""')
|
||||||
assert.ok(!$btn[0].hasAttribute('disabled'), 'btn is not disabled')
|
assert.ok(!$btn[0].hasAttribute('disabled'), 'btn is not disabled')
|
||||||
assert.ok(!$btn.hasClass('disabled'), 'btn does not have disabled class')
|
assert.ok(!$btn.hasClass('disabled'), 'btn does not have disabled class')
|
||||||
doneTwo()
|
doneTwo()
|
||||||
@ -104,9 +104,9 @@ $(function () {
|
|||||||
|
|
||||||
QUnit.test('should toggle aria-pressed', function (assert) {
|
QUnit.test('should toggle aria-pressed', function (assert) {
|
||||||
var $btn = $('<button class="btn" data-toggle="button" aria-pressed="false">redux</button>')
|
var $btn = $('<button class="btn" data-toggle="button" aria-pressed="false">redux</button>')
|
||||||
assert.equal($btn.attr('aria-pressed'), 'false', 'btn aria-pressed state is false')
|
assert.strictEqual($btn.attr('aria-pressed'), 'false', 'btn aria-pressed state is false')
|
||||||
$btn.bootstrapButton('toggle')
|
$btn.bootstrapButton('toggle')
|
||||||
assert.equal($btn.attr('aria-pressed'), 'true', 'btn aria-pressed state is true')
|
assert.strictEqual($btn.attr('aria-pressed'), 'true', 'btn aria-pressed state is true')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should toggle aria-pressed when btn children are clicked', function (assert) {
|
QUnit.test('should toggle aria-pressed when btn children are clicked', function (assert) {
|
||||||
@ -115,9 +115,9 @@ $(function () {
|
|||||||
$btn
|
$btn
|
||||||
.append($inner)
|
.append($inner)
|
||||||
.appendTo('#qunit-fixture')
|
.appendTo('#qunit-fixture')
|
||||||
assert.equal($btn.attr('aria-pressed'), 'false', 'btn aria-pressed state is false')
|
assert.strictEqual($btn.attr('aria-pressed'), 'false', 'btn aria-pressed state is false')
|
||||||
$inner.click()
|
$inner.click()
|
||||||
assert.equal($btn.attr('aria-pressed'), 'true', 'btn aria-pressed state is true')
|
assert.strictEqual($btn.attr('aria-pressed'), 'true', 'btn aria-pressed state is true')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should toggle active when btn children are clicked within btn-group', function (assert) {
|
QUnit.test('should toggle active when btn children are clicked within btn-group', function (assert) {
|
||||||
|
@ -327,19 +327,19 @@ $(function () {
|
|||||||
|
|
||||||
$carousel.appendTo('body')
|
$carousel.appendTo('body')
|
||||||
$('[data-slide]').first().click()
|
$('[data-slide]').first().click()
|
||||||
assert.equal($carousel.data('bs.carousel').options.interval, 1814)
|
assert.strictEqual($carousel.data('bs.carousel').options.interval, 1814)
|
||||||
$carousel.remove()
|
$carousel.remove()
|
||||||
|
|
||||||
$carousel.appendTo('body').attr('data-modal', 'foobar')
|
$carousel.appendTo('body').attr('data-modal', 'foobar')
|
||||||
$('[data-slide]').first().click()
|
$('[data-slide]').first().click()
|
||||||
assert.equal($carousel.data('bs.carousel').options.interval, 1814, 'even if there is an data-modal attribute set')
|
assert.strictEqual($carousel.data('bs.carousel').options.interval, 1814, 'even if there is an data-modal attribute set')
|
||||||
$carousel.remove()
|
$carousel.remove()
|
||||||
|
|
||||||
$carousel.appendTo('body')
|
$carousel.appendTo('body')
|
||||||
$('[data-slide]').first().click()
|
$('[data-slide]').first().click()
|
||||||
$carousel.attr('data-interval', 1860)
|
$carousel.attr('data-interval', 1860)
|
||||||
$('[data-slide]').first().click()
|
$('[data-slide]').first().click()
|
||||||
assert.equal($carousel.data('bs.carousel').options.interval, 1814, 'attributes should be read only on initialization')
|
assert.strictEqual($carousel.data('bs.carousel').options.interval, 1814, 'attributes should be read only on initialization')
|
||||||
$carousel.remove()
|
$carousel.remove()
|
||||||
|
|
||||||
$carousel.attr('data-interval', false)
|
$carousel.attr('data-interval', false)
|
||||||
|
@ -63,7 +63,7 @@ $(function () {
|
|||||||
|
|
||||||
$('<div class="collapse" style="height: 0px"/>')
|
$('<div class="collapse" style="height: 0px"/>')
|
||||||
.on('show.bs.collapse', function () {
|
.on('show.bs.collapse', function () {
|
||||||
assert.equal(this.style.height, '0px', 'height is 0px')
|
assert.strictEqual(this.style.height, '0px', 'height is 0px')
|
||||||
})
|
})
|
||||||
.on('shown.bs.collapse', function () {
|
.on('shown.bs.collapse', function () {
|
||||||
assert.strictEqual(this.style.height, '', 'height is auto')
|
assert.strictEqual(this.style.height, '', 'height is auto')
|
||||||
@ -208,7 +208,7 @@ $(function () {
|
|||||||
$('<div id="test1"/>')
|
$('<div id="test1"/>')
|
||||||
.appendTo('#qunit-fixture')
|
.appendTo('#qunit-fixture')
|
||||||
.on('shown.bs.collapse', function () {
|
.on('shown.bs.collapse', function () {
|
||||||
assert.equal($target.attr('aria-expanded'), 'true', 'aria-expanded on target is "true"')
|
assert.strictEqual($target.attr('aria-expanded'), 'true', 'aria-expanded on target is "true"')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ $(function () {
|
|||||||
$('<div id="test1" class="in"/>')
|
$('<div id="test1" class="in"/>')
|
||||||
.appendTo('#qunit-fixture')
|
.appendTo('#qunit-fixture')
|
||||||
.on('hidden.bs.collapse', function () {
|
.on('hidden.bs.collapse', function () {
|
||||||
assert.equal($target.attr('aria-expanded'), 'false', 'aria-expanded on target is "false"')
|
assert.strictEqual($target.attr('aria-expanded'), 'false', 'aria-expanded on target is "false"')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -253,9 +253,9 @@ $(function () {
|
|||||||
$('<div id="body3" aria-expanded="false"/>')
|
$('<div id="body3" aria-expanded="false"/>')
|
||||||
.appendTo($groups.eq(2))
|
.appendTo($groups.eq(2))
|
||||||
.on('shown.bs.collapse', function () {
|
.on('shown.bs.collapse', function () {
|
||||||
assert.equal($target1.attr('aria-expanded'), 'false', 'inactive target 1 has aria-expanded="false"')
|
assert.strictEqual($target1.attr('aria-expanded'), 'false', 'inactive target 1 has aria-expanded="false"')
|
||||||
assert.equal($target2.attr('aria-expanded'), 'false', 'inactive target 2 has aria-expanded="false"')
|
assert.strictEqual($target2.attr('aria-expanded'), 'false', 'inactive target 2 has aria-expanded="false"')
|
||||||
assert.equal($target3.attr('aria-expanded'), 'true', 'active target 3 has aria-expanded="false"')
|
assert.strictEqual($target3.attr('aria-expanded'), 'true', 'active target 3 has aria-expanded="false"')
|
||||||
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
@ -36,7 +36,7 @@ $(function () {
|
|||||||
|
|
||||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||||
$popover.bootstrapPopover('hide')
|
$popover.bootstrapPopover('hide')
|
||||||
assert.equal($('.popover').length, 0, 'popover removed')
|
assert.strictEqual($('.popover').length, 0, 'popover removed')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should store popover instance in popover data object', function (assert) {
|
QUnit.test('should store popover instance in popover data object', function (assert) {
|
||||||
@ -70,11 +70,11 @@ $(function () {
|
|||||||
$popover.bootstrapPopover('show')
|
$popover.bootstrapPopover('show')
|
||||||
|
|
||||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||||
assert.equal($('.popover .popover-title').text(), '@fat', 'title correctly inserted')
|
assert.strictEqual($('.popover .popover-title').text(), '@fat', 'title correctly inserted')
|
||||||
assert.equal($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
|
assert.strictEqual($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
|
||||||
|
|
||||||
$popover.bootstrapPopover('hide')
|
$popover.bootstrapPopover('hide')
|
||||||
assert.equal($('.popover').length, 0, 'popover was removed')
|
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should not duplicate HTML object', function (assert) {
|
QUnit.test('should not duplicate HTML object', function (assert) {
|
||||||
@ -93,14 +93,14 @@ $(function () {
|
|||||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||||
|
|
||||||
$popover.bootstrapPopover('hide')
|
$popover.bootstrapPopover('hide')
|
||||||
assert.equal($('.popover').length, 0, 'popover was removed')
|
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||||
|
|
||||||
$popover.bootstrapPopover('show')
|
$popover.bootstrapPopover('show')
|
||||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||||
|
|
||||||
$popover.bootstrapPopover('hide')
|
$popover.bootstrapPopover('hide')
|
||||||
assert.equal($('.popover').length, 0, 'popover was removed')
|
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should get title and content from attributes', function (assert) {
|
QUnit.test('should get title and content from attributes', function (assert) {
|
||||||
@ -110,11 +110,11 @@ $(function () {
|
|||||||
.bootstrapPopover('show')
|
.bootstrapPopover('show')
|
||||||
|
|
||||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||||
assert.equal($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
assert.strictEqual($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||||
assert.equal($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
assert.strictEqual($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||||
|
|
||||||
$popover.bootstrapPopover('hide')
|
$popover.bootstrapPopover('hide')
|
||||||
assert.equal($('.popover').length, 0, 'popover was removed')
|
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -128,11 +128,11 @@ $(function () {
|
|||||||
.bootstrapPopover('show')
|
.bootstrapPopover('show')
|
||||||
|
|
||||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||||
assert.equal($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
assert.strictEqual($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||||
assert.equal($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
assert.strictEqual($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||||
|
|
||||||
$popover.bootstrapPopover('hide')
|
$popover.bootstrapPopover('hide')
|
||||||
assert.equal($('.popover').length, 0, 'popover was removed')
|
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should respect custom template', function (assert) {
|
QUnit.test('should respect custom template', function (assert) {
|
||||||
@ -150,7 +150,7 @@ $(function () {
|
|||||||
assert.ok($('.popover').hasClass('foobar'), 'custom class is present')
|
assert.ok($('.popover').hasClass('foobar'), 'custom class is present')
|
||||||
|
|
||||||
$popover.bootstrapPopover('hide')
|
$popover.bootstrapPopover('hide')
|
||||||
assert.equal($('.popover').length, 0, 'popover was removed')
|
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should destroy popover', function (assert) {
|
QUnit.test('should destroy popover', function (assert) {
|
||||||
@ -162,14 +162,14 @@ $(function () {
|
|||||||
|
|
||||||
assert.ok($popover.data('bs.popover'), 'popover has data')
|
assert.ok($popover.data('bs.popover'), 'popover has data')
|
||||||
assert.ok($._data($popover[0], 'events').mouseover && $._data($popover[0], 'events').mouseout, 'popover has hover event')
|
assert.ok($._data($popover[0], 'events').mouseover && $._data($popover[0], 'events').mouseout, 'popover has hover event')
|
||||||
assert.equal($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover has extra click.foo event')
|
assert.strictEqual($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover has extra click.foo event')
|
||||||
|
|
||||||
$popover.bootstrapPopover('show')
|
$popover.bootstrapPopover('show')
|
||||||
$popover.bootstrapPopover('destroy')
|
$popover.bootstrapPopover('destroy')
|
||||||
|
|
||||||
assert.ok(!$popover.hasClass('in'), 'popover is hidden')
|
assert.ok(!$popover.hasClass('in'), 'popover is hidden')
|
||||||
assert.ok(!$popover.data('popover'), 'popover does not have data')
|
assert.ok(!$popover.data('popover'), 'popover does not have data')
|
||||||
assert.equal($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover still has click.foo')
|
assert.strictEqual($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover still has click.foo')
|
||||||
assert.ok(!$._data($popover[0], 'events').mouseover && !$._data($popover[0], 'events').mouseout, 'popover does not have any events')
|
assert.ok(!$._data($popover[0], 'events').mouseover && !$._data($popover[0], 'events').mouseout, 'popover does not have any events')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ $(function () {
|
|||||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||||
|
|
||||||
$div.find('a').click()
|
$div.find('a').click()
|
||||||
assert.equal($('.popover').length, 0, 'popover was removed')
|
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should detach popover content rather than removing it so that event handlers are left intact', function (assert) {
|
QUnit.test('should detach popover content rather than removing it so that event handlers are left intact', function (assert) {
|
||||||
|
@ -38,10 +38,10 @@ $(function () {
|
|||||||
$('<ul><li id="home"/><li id="profile"/></ul>').appendTo('#qunit-fixture')
|
$('<ul><li id="home"/><li id="profile"/></ul>').appendTo('#qunit-fixture')
|
||||||
|
|
||||||
$(tabsHTML).find('li:last a').bootstrapTab('show')
|
$(tabsHTML).find('li:last a').bootstrapTab('show')
|
||||||
assert.equal($('#qunit-fixture').find('.active').attr('id'), 'profile')
|
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile')
|
||||||
|
|
||||||
$(tabsHTML).find('li:first a').bootstrapTab('show')
|
$(tabsHTML).find('li:first a').bootstrapTab('show')
|
||||||
assert.equal($('#qunit-fixture').find('.active').attr('id'), 'home')
|
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'home')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should activate element by tab id', function (assert) {
|
QUnit.test('should activate element by tab id', function (assert) {
|
||||||
@ -53,10 +53,10 @@ $(function () {
|
|||||||
$('<ul><li id="home"/><li id="profile"/></ul>').appendTo('#qunit-fixture')
|
$('<ul><li id="home"/><li id="profile"/></ul>').appendTo('#qunit-fixture')
|
||||||
|
|
||||||
$(pillsHTML).find('li:last a').bootstrapTab('show')
|
$(pillsHTML).find('li:last a').bootstrapTab('show')
|
||||||
assert.equal($('#qunit-fixture').find('.active').attr('id'), 'profile')
|
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile')
|
||||||
|
|
||||||
$(pillsHTML).find('li:first a').bootstrapTab('show')
|
$(pillsHTML).find('li:first a').bootstrapTab('show')
|
||||||
assert.equal($('#qunit-fixture').find('.active').attr('id'), 'home')
|
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'home')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should not fire shown when show is prevented', function (assert) {
|
QUnit.test('should not fire shown when show is prevented', function (assert) {
|
||||||
@ -92,10 +92,10 @@ $(function () {
|
|||||||
.end()
|
.end()
|
||||||
.find('ul > li:last a')
|
.find('ul > li:last a')
|
||||||
.on('show.bs.tab', function (e) {
|
.on('show.bs.tab', function (e) {
|
||||||
assert.equal(e.relatedTarget.hash, '#1-1', 'references correct element as relatedTarget')
|
assert.strictEqual(e.relatedTarget.hash, '#1-1', 'references correct element as relatedTarget')
|
||||||
})
|
})
|
||||||
.on('shown.bs.tab', function (e) {
|
.on('shown.bs.tab', function (e) {
|
||||||
assert.equal(e.relatedTarget.hash, '#1-1', 'references correct element as relatedTarget')
|
assert.strictEqual(e.relatedTarget.hash, '#1-1', 'references correct element as relatedTarget')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
.bootstrapTab('show')
|
.bootstrapTab('show')
|
||||||
@ -166,10 +166,10 @@ $(function () {
|
|||||||
$(tabsHTML)
|
$(tabsHTML)
|
||||||
.find('li:first a')
|
.find('li:first a')
|
||||||
.on('hide.bs.tab', function (e) {
|
.on('hide.bs.tab', function (e) {
|
||||||
assert.equal(e.relatedTarget.hash, '#profile', 'references correct element as relatedTarget')
|
assert.strictEqual(e.relatedTarget.hash, '#profile', 'references correct element as relatedTarget')
|
||||||
})
|
})
|
||||||
.on('hidden.bs.tab', function (e) {
|
.on('hidden.bs.tab', function (e) {
|
||||||
assert.equal(e.relatedTarget.hash, '#profile', 'references correct element as relatedTarget')
|
assert.strictEqual(e.relatedTarget.hash, '#profile', 'references correct element as relatedTarget')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
.bootstrapTab('show')
|
.bootstrapTab('show')
|
||||||
@ -186,20 +186,20 @@ $(function () {
|
|||||||
var $tabs = $(tabsHTML).appendTo('#qunit-fixture')
|
var $tabs = $(tabsHTML).appendTo('#qunit-fixture')
|
||||||
|
|
||||||
$tabs.find('li:first a').bootstrapTab('show')
|
$tabs.find('li:first a').bootstrapTab('show')
|
||||||
assert.equal($tabs.find('.active a').attr('aria-expanded'), 'true', 'shown tab has aria-expanded = true')
|
assert.strictEqual($tabs.find('.active a').attr('aria-expanded'), 'true', 'shown tab has aria-expanded = true')
|
||||||
assert.equal($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'hidden tab has aria-expanded = false')
|
assert.strictEqual($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'hidden tab has aria-expanded = false')
|
||||||
|
|
||||||
$tabs.find('li:last a').click()
|
$tabs.find('li:last a').click()
|
||||||
assert.equal($tabs.find('.active a').attr('aria-expanded'), 'true', 'after click, shown tab has aria-expanded = true')
|
assert.strictEqual($tabs.find('.active a').attr('aria-expanded'), 'true', 'after click, shown tab has aria-expanded = true')
|
||||||
assert.equal($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'after click, hidden tab has aria-expanded = false')
|
assert.strictEqual($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'after click, hidden tab has aria-expanded = false')
|
||||||
|
|
||||||
$tabs.find('li:first a').bootstrapTab('show')
|
$tabs.find('li:first a').bootstrapTab('show')
|
||||||
assert.equal($tabs.find('.active a').attr('aria-expanded'), 'true', 'shown tab has aria-expanded = true')
|
assert.strictEqual($tabs.find('.active a').attr('aria-expanded'), 'true', 'shown tab has aria-expanded = true')
|
||||||
assert.equal($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'hidden tab has aria-expanded = false')
|
assert.strictEqual($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'hidden tab has aria-expanded = false')
|
||||||
|
|
||||||
$tabs.find('li:first a').click()
|
$tabs.find('li:first a').click()
|
||||||
assert.equal($tabs.find('.active a').attr('aria-expanded'), 'true', 'after second show event, shown tab still has aria-expanded = true')
|
assert.strictEqual($tabs.find('.active a').attr('aria-expanded'), 'true', 'after second show event, shown tab still has aria-expanded = true')
|
||||||
assert.equal($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'after second show event, hidden tab has aria-expanded = false')
|
assert.strictEqual($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'after second show event, hidden tab has aria-expanded = false')
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -88,7 +88,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('hide')
|
$tooltip.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should allow html entities', function (assert) {
|
QUnit.test('should allow html entities', function (assert) {
|
||||||
@ -100,7 +100,7 @@ $(function () {
|
|||||||
assert.notEqual($('.tooltip b').length, 0, 'b tag was inserted')
|
assert.notEqual($('.tooltip b').length, 0, 'b tag was inserted')
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('hide')
|
$tooltip.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should respect custom classes', function (assert) {
|
QUnit.test('should respect custom classes', function (assert) {
|
||||||
@ -112,7 +112,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').hasClass('some-class'), 'custom class is present')
|
assert.ok($('.tooltip').hasClass('some-class'), 'custom class is present')
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('hide')
|
$tooltip.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should fire show event', function (assert) {
|
QUnit.test('should fire show event', function (assert) {
|
||||||
@ -209,14 +209,14 @@ $(function () {
|
|||||||
|
|
||||||
assert.ok($tooltip.data('bs.tooltip'), 'tooltip has data')
|
assert.ok($tooltip.data('bs.tooltip'), 'tooltip has data')
|
||||||
assert.ok($._data($tooltip[0], 'events').mouseover && $._data($tooltip[0], 'events').mouseout, 'tooltip has hover events')
|
assert.ok($._data($tooltip[0], 'events').mouseover && $._data($tooltip[0], 'events').mouseout, 'tooltip has hover events')
|
||||||
assert.equal($._data($tooltip[0], 'events').click[0].namespace, 'foo', 'tooltip has extra click.foo event')
|
assert.strictEqual($._data($tooltip[0], 'events').click[0].namespace, 'foo', 'tooltip has extra click.foo event')
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('show')
|
$tooltip.bootstrapTooltip('show')
|
||||||
$tooltip.bootstrapTooltip('destroy')
|
$tooltip.bootstrapTooltip('destroy')
|
||||||
|
|
||||||
assert.ok(!$tooltip.hasClass('in'), 'tooltip is hidden')
|
assert.ok(!$tooltip.hasClass('in'), 'tooltip is hidden')
|
||||||
assert.ok(!$._data($tooltip[0], 'bs.tooltip'), 'tooltip does not have data')
|
assert.ok(!$._data($tooltip[0], 'bs.tooltip'), 'tooltip does not have data')
|
||||||
assert.equal($._data($tooltip[0], 'events').click[0].namespace, 'foo', 'tooltip still has click.foo')
|
assert.strictEqual($._data($tooltip[0], 'events').click[0].namespace, 'foo', 'tooltip still has click.foo')
|
||||||
assert.ok(!$._data($tooltip[0], 'events').mouseover && !$._data($tooltip[0], 'events').mouseout, 'tooltip does not have hover events')
|
assert.ok(!$._data($tooltip[0], 'events').mouseover && !$._data($tooltip[0], 'events').mouseout, 'tooltip does not have hover events')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').is('.fade.in'), 'tooltip is faded in')
|
assert.ok($('.tooltip').is('.fade.in'), 'tooltip is faded in')
|
||||||
|
|
||||||
$div.find('a').click()
|
$div.find('a').click()
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip was removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip was removed from dom')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should show tooltip when toggle is called', function (assert) {
|
QUnit.test('should show tooltip when toggle is called', function (assert) {
|
||||||
@ -261,10 +261,10 @@ $(function () {
|
|||||||
.bootstrapTooltip('show')
|
.bootstrapTooltip('show')
|
||||||
|
|
||||||
assert.notEqual($('body > .tooltip').length, 0, 'tooltip is direct descendant of body')
|
assert.notEqual($('body > .tooltip').length, 0, 'tooltip is direct descendant of body')
|
||||||
assert.equal($('#qunit-fixture > .tooltip').length, 0, 'tooltip is not in parent')
|
assert.strictEqual($('#qunit-fixture > .tooltip').length, 0, 'tooltip is not in parent')
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('hide')
|
$tooltip.bootstrapTooltip('hide')
|
||||||
assert.equal($('body > .tooltip').length, 0, 'tooltip was removed from dom')
|
assert.strictEqual($('body > .tooltip').length, 0, 'tooltip was removed from dom')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should add position class before positioning so that position-specific styles are taken into account', function (assert) {
|
QUnit.test('should add position class before positioning so that position-specific styles are taken into account', function (assert) {
|
||||||
@ -301,10 +301,10 @@ $(function () {
|
|||||||
.bootstrapTooltip()
|
.bootstrapTooltip()
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('show')
|
$tooltip.bootstrapTooltip('show')
|
||||||
assert.equal($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title from title attribute is set')
|
assert.strictEqual($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title from title attribute is set')
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('hide')
|
$tooltip.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should prefer title attribute over title option', function (assert) {
|
QUnit.test('should prefer title attribute over title option', function (assert) {
|
||||||
@ -315,10 +315,10 @@ $(function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('show')
|
$tooltip.bootstrapTooltip('show')
|
||||||
assert.equal($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title is set from title attribute while preferred over title option')
|
assert.strictEqual($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title is set from title attribute while preferred over title option')
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('hide')
|
$tooltip.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should use title option', function (assert) {
|
QUnit.test('should use title option', function (assert) {
|
||||||
@ -329,10 +329,10 @@ $(function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('show')
|
$tooltip.bootstrapTooltip('show')
|
||||||
assert.equal($('.tooltip').children('.tooltip-inner').text(), 'This is a tooltip with some content', 'title from title option is set')
|
assert.strictEqual($('.tooltip').children('.tooltip-inner').text(), 'This is a tooltip with some content', 'title from title option is set')
|
||||||
|
|
||||||
$tooltip.bootstrapTooltip('hide')
|
$tooltip.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should be placed dynamically with the dynamic placement option', function (assert) {
|
QUnit.test('should be placed dynamically with the dynamic placement option', function (assert) {
|
||||||
@ -356,7 +356,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned to bottom')
|
assert.ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned to bottom')
|
||||||
|
|
||||||
$topTooltip.bootstrapTooltip('hide')
|
$topTooltip.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'top positioned tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'top positioned tooltip removed from dom')
|
||||||
|
|
||||||
var $rightTooltip = $('<div style="right: 0;" rel="tooltip" title="Right tooltip">Right Dynamic Tooltip</div>')
|
var $rightTooltip = $('<div style="right: 0;" rel="tooltip" title="Right tooltip">Right Dynamic Tooltip</div>')
|
||||||
.appendTo($container)
|
.appendTo($container)
|
||||||
@ -366,7 +366,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').is('.left'), 'right positioned tooltip is dynamically positioned left')
|
assert.ok($('.tooltip').is('.left'), 'right positioned tooltip is dynamically positioned left')
|
||||||
|
|
||||||
$rightTooltip.bootstrapTooltip('hide')
|
$rightTooltip.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'right positioned tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'right positioned tooltip removed from dom')
|
||||||
|
|
||||||
var $leftTooltip = $('<div style="left: 0;" rel="tooltip" title="Left tooltip">Left Dynamic Tooltip</div>')
|
var $leftTooltip = $('<div style="left: 0;" rel="tooltip" title="Left tooltip">Left Dynamic Tooltip</div>')
|
||||||
.appendTo($container)
|
.appendTo($container)
|
||||||
@ -376,7 +376,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').is('.right'), 'left positioned tooltip is dynamically positioned right')
|
assert.ok($('.tooltip').is('.right'), 'left positioned tooltip is dynamically positioned right')
|
||||||
|
|
||||||
$leftTooltip.bootstrapTooltip('hide')
|
$leftTooltip.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'left positioned tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'left positioned tooltip removed from dom')
|
||||||
|
|
||||||
$container.remove()
|
$container.remove()
|
||||||
$style.remove()
|
$style.remove()
|
||||||
@ -402,7 +402,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').is('.top'), 'top positioned tooltip is dynamically positioned to top')
|
assert.ok($('.tooltip').is('.top'), 'top positioned tooltip is dynamically positioned to top')
|
||||||
|
|
||||||
$target.bootstrapTooltip('hide')
|
$target.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
|
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
})
|
})
|
||||||
@ -427,7 +427,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned to bottom')
|
assert.ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned to bottom')
|
||||||
|
|
||||||
$target.bootstrapTooltip('hide')
|
$target.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
|
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
})
|
})
|
||||||
@ -453,7 +453,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').is('.fade.top.in'), 'has correct classes applied')
|
assert.ok($('.tooltip').is('.fade.top.in'), 'has correct classes applied')
|
||||||
|
|
||||||
$target.bootstrapTooltip('hide')
|
$target.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
|
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
})
|
})
|
||||||
@ -479,7 +479,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
||||||
|
|
||||||
$target.bootstrapTooltip('hide')
|
$target.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
|
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
})
|
})
|
||||||
@ -509,7 +509,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
||||||
|
|
||||||
$target.bootstrapTooltip('hide')
|
$target.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
|
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
})
|
})
|
||||||
@ -535,7 +535,7 @@ $(function () {
|
|||||||
assert.ok($('.tooltip').is('.fade.top.in'), 'has correct classes applied')
|
assert.ok($('.tooltip').is('.fade.top.in'), 'has correct classes applied')
|
||||||
|
|
||||||
$target.bootstrapTooltip('hide')
|
$target.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
|
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
})
|
})
|
||||||
@ -559,10 +559,10 @@ $(function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
$target.bootstrapTooltip('show')
|
$target.bootstrapTooltip('show')
|
||||||
assert.equal(Math.round($container.find('.tooltip').offset().top), 12)
|
assert.strictEqual(Math.round($container.find('.tooltip').offset().top), 12)
|
||||||
|
|
||||||
$target.bootstrapTooltip('hide')
|
$target.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
|
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
})
|
})
|
||||||
@ -590,7 +590,7 @@ $(function () {
|
|||||||
assert.strictEqual(Math.round($tooltip.offset().top), Math.round($(window).height() - 12 - $tooltip[0].offsetHeight))
|
assert.strictEqual(Math.round($tooltip.offset().top), Math.round($(window).height() - 12 - $tooltip[0].offsetHeight))
|
||||||
|
|
||||||
$target.bootstrapTooltip('hide')
|
$target.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
|
|
||||||
$container.remove()
|
$container.remove()
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
@ -618,7 +618,7 @@ $(function () {
|
|||||||
assert.strictEqual(Math.round($container.find('.tooltip').offset().left), 12)
|
assert.strictEqual(Math.round($container.find('.tooltip').offset().left), 12)
|
||||||
|
|
||||||
$target.bootstrapTooltip('hide')
|
$target.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
|
|
||||||
$container.remove()
|
$container.remove()
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
@ -647,7 +647,7 @@ $(function () {
|
|||||||
assert.strictEqual(Math.round($tooltip.offset().left), Math.round($(window).width() - 12 - $tooltip[0].offsetWidth))
|
assert.strictEqual(Math.round($tooltip.offset().left), Math.round($(window).width() - 12 - $tooltip[0].offsetWidth))
|
||||||
|
|
||||||
$target.bootstrapTooltip('hide')
|
$target.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
|
|
||||||
$container.remove()
|
$container.remove()
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
@ -674,7 +674,7 @@ $(function () {
|
|||||||
assert.strictEqual(Math.round($tooltip.offset().left), Math.round(60 + $container.width() - $tooltip[0].offsetWidth))
|
assert.strictEqual(Math.round($tooltip.offset().left), Math.round(60 + $container.width() - $tooltip[0].offsetWidth))
|
||||||
|
|
||||||
$target.bootstrapTooltip('hide')
|
$target.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
|
|
||||||
$container.remove()
|
$container.remove()
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
@ -927,7 +927,7 @@ $(function () {
|
|||||||
$styles.remove()
|
$styles.remove()
|
||||||
assert.ok(Math.abs(offset.left - 88) <= 1, 'tooltip has correct horizontal location')
|
assert.ok(Math.abs(offset.left - 88) <= 1, 'tooltip has correct horizontal location')
|
||||||
$circle.bootstrapTooltip('hide')
|
$circle.bootstrapTooltip('hide')
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
.bootstrapTooltip({ container: 'body', placement: 'top', trigger: 'manual' })
|
.bootstrapTooltip({ container: 'body', placement: 'top', trigger: 'manual' })
|
||||||
@ -964,7 +964,7 @@ $(function () {
|
|||||||
.on('hidden.bs.tooltip', function () {
|
.on('hidden.bs.tooltip', function () {
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
$(this).remove()
|
$(this).remove()
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
.bootstrapTooltip({
|
.bootstrapTooltip({
|
||||||
@ -999,7 +999,7 @@ $(function () {
|
|||||||
var currentUid = $('#tt-content').text()
|
var currentUid = $('#tt-content').text()
|
||||||
|
|
||||||
$('#tt-content').trigger('mouseenter')
|
$('#tt-content').trigger('mouseenter')
|
||||||
assert.equal(currentUid, $('#tt-content').text())
|
assert.strictEqual(currentUid, $('#tt-content').text())
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should not reload the tooltip if the mouse leaves and re-enters before hiding', function (assert) {
|
QUnit.test('should not reload the tooltip if the mouse leaves and re-enters before hiding', function (assert) {
|
||||||
@ -1027,14 +1027,14 @@ $(function () {
|
|||||||
var currentUid = $('#tt-content').text()
|
var currentUid = $('#tt-content').text()
|
||||||
|
|
||||||
$('#tt-outer').trigger('mouseleave')
|
$('#tt-outer').trigger('mouseleave')
|
||||||
assert.equal(currentUid, $('#tt-content').text())
|
assert.strictEqual(currentUid, $('#tt-content').text())
|
||||||
|
|
||||||
assert.ok(obj.hoverState == 'out', 'the tooltip hoverState should be set to "out"')
|
assert.ok(obj.hoverState == 'out', 'the tooltip hoverState should be set to "out"')
|
||||||
|
|
||||||
$('#tt-content').trigger('mouseenter')
|
$('#tt-content').trigger('mouseenter')
|
||||||
assert.ok(obj.hoverState == 'in', 'the tooltip hoverState should be set to "in"')
|
assert.ok(obj.hoverState == 'in', 'the tooltip hoverState should be set to "in"')
|
||||||
|
|
||||||
assert.equal(currentUid, $('#tt-content').text())
|
assert.strictEqual(currentUid, $('#tt-content').text())
|
||||||
})
|
})
|
||||||
|
|
||||||
QUnit.test('should position arrow correctly when tooltip is moved to not appear offscreen', function (assert) {
|
QUnit.test('should position arrow correctly when tooltip is moved to not appear offscreen', function (assert) {
|
||||||
@ -1058,7 +1058,7 @@ $(function () {
|
|||||||
.on('hidden.bs.tooltip', function () {
|
.on('hidden.bs.tooltip', function () {
|
||||||
$styles.remove()
|
$styles.remove()
|
||||||
$(this).remove()
|
$(this).remove()
|
||||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
.bootstrapTooltip({
|
.bootstrapTooltip({
|
||||||
|
Loading…
Reference in New Issue
Block a user