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()
|
||||
|
||||
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) {
|
||||
@ -52,7 +52,7 @@ $(function () {
|
||||
|
||||
$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) {
|
||||
|
@ -31,11 +31,11 @@ $(function () {
|
||||
|
||||
QUnit.test('should return set state to loading', function (assert) {
|
||||
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')
|
||||
var done = assert.async()
|
||||
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.hasClass('disabled'), 'btn has disabled class')
|
||||
done()
|
||||
@ -44,18 +44,18 @@ $(function () {
|
||||
|
||||
QUnit.test('should return reset state', function (assert) {
|
||||
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')
|
||||
var doneOne = assert.async()
|
||||
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.hasClass('disabled'), 'btn has disabled class')
|
||||
doneOne()
|
||||
var doneTwo = assert.async()
|
||||
$btn.bootstrapButton('reset')
|
||||
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.hasClass('disabled'), 'btn does not have disabled class')
|
||||
doneTwo()
|
||||
@ -65,18 +65,18 @@ $(function () {
|
||||
|
||||
QUnit.test('should work with an empty string as reset state', function (assert) {
|
||||
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')
|
||||
var doneOne = assert.async()
|
||||
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.hasClass('disabled'), 'btn has disabled class')
|
||||
doneOne()
|
||||
var doneTwo = assert.async()
|
||||
$btn.bootstrapButton('reset')
|
||||
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.hasClass('disabled'), 'btn does not have disabled class')
|
||||
doneTwo()
|
||||
@ -104,9 +104,9 @@ $(function () {
|
||||
|
||||
QUnit.test('should toggle aria-pressed', function (assert) {
|
||||
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')
|
||||
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) {
|
||||
@ -115,9 +115,9 @@ $(function () {
|
||||
$btn
|
||||
.append($inner)
|
||||
.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()
|
||||
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) {
|
||||
|
@ -327,19 +327,19 @@ $(function () {
|
||||
|
||||
$carousel.appendTo('body')
|
||||
$('[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.appendTo('body').attr('data-modal', 'foobar')
|
||||
$('[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.appendTo('body')
|
||||
$('[data-slide]').first().click()
|
||||
$carousel.attr('data-interval', 1860)
|
||||
$('[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.attr('data-interval', false)
|
||||
|
@ -63,7 +63,7 @@ $(function () {
|
||||
|
||||
$('<div class="collapse" style="height: 0px"/>')
|
||||
.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 () {
|
||||
assert.strictEqual(this.style.height, '', 'height is auto')
|
||||
@ -208,7 +208,7 @@ $(function () {
|
||||
$('<div id="test1"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.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()
|
||||
})
|
||||
|
||||
@ -223,7 +223,7 @@ $(function () {
|
||||
$('<div id="test1" class="in"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.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()
|
||||
})
|
||||
|
||||
@ -253,9 +253,9 @@ $(function () {
|
||||
$('<div id="body3" aria-expanded="false"/>')
|
||||
.appendTo($groups.eq(2))
|
||||
.on('shown.bs.collapse', function () {
|
||||
assert.equal($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.equal($target3.attr('aria-expanded'), 'true', 'active target 3 has aria-expanded="false"')
|
||||
assert.strictEqual($target1.attr('aria-expanded'), 'false', 'inactive target 1 has aria-expanded="false"')
|
||||
assert.strictEqual($target2.attr('aria-expanded'), 'false', 'inactive target 2 has aria-expanded="false"')
|
||||
assert.strictEqual($target3.attr('aria-expanded'), 'true', 'active target 3 has aria-expanded="false"')
|
||||
|
||||
done()
|
||||
})
|
||||
|
@ -36,7 +36,7 @@ $(function () {
|
||||
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
$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) {
|
||||
@ -70,11 +70,11 @@ $(function () {
|
||||
$popover.bootstrapPopover('show')
|
||||
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-title').text(), '@fat', 'title correctly inserted')
|
||||
assert.equal($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-title').text(), '@fat', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
|
||||
|
||||
$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) {
|
||||
@ -93,14 +93,14 @@ $(function () {
|
||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
assert.equal($('.popover').length, 0, 'popover was removed')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
|
||||
$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) {
|
||||
@ -110,11 +110,11 @@ $(function () {
|
||||
.bootstrapPopover('show')
|
||||
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||
assert.equal($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
|
||||
$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')
|
||||
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||
assert.equal($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
|
||||
$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) {
|
||||
@ -150,7 +150,7 @@ $(function () {
|
||||
assert.ok($('.popover').hasClass('foobar'), 'custom class is present')
|
||||
|
||||
$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) {
|
||||
@ -162,14 +162,14 @@ $(function () {
|
||||
|
||||
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.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('destroy')
|
||||
|
||||
assert.ok(!$popover.hasClass('in'), 'popover is hidden')
|
||||
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')
|
||||
})
|
||||
|
||||
@ -185,7 +185,7 @@ $(function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
|
||||
$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) {
|
||||
|
@ -38,10 +38,10 @@ $(function () {
|
||||
$('<ul><li id="home"/><li id="profile"/></ul>').appendTo('#qunit-fixture')
|
||||
|
||||
$(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')
|
||||
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) {
|
||||
@ -53,10 +53,10 @@ $(function () {
|
||||
$('<ul><li id="home"/><li id="profile"/></ul>').appendTo('#qunit-fixture')
|
||||
|
||||
$(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')
|
||||
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) {
|
||||
@ -92,10 +92,10 @@ $(function () {
|
||||
.end()
|
||||
.find('ul > li:last a')
|
||||
.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) {
|
||||
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()
|
||||
})
|
||||
.bootstrapTab('show')
|
||||
@ -166,10 +166,10 @@ $(function () {
|
||||
$(tabsHTML)
|
||||
.find('li:first a')
|
||||
.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) {
|
||||
assert.equal(e.relatedTarget.hash, '#profile', 'references correct element as relatedTarget')
|
||||
assert.strictEqual(e.relatedTarget.hash, '#profile', 'references correct element as relatedTarget')
|
||||
done()
|
||||
})
|
||||
.bootstrapTab('show')
|
||||
@ -186,20 +186,20 @@ $(function () {
|
||||
var $tabs = $(tabsHTML).appendTo('#qunit-fixture')
|
||||
|
||||
$tabs.find('li:first a').bootstrapTab('show')
|
||||
assert.equal($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('.active a').attr('aria-expanded'), 'true', 'shown tab has aria-expanded = true')
|
||||
assert.strictEqual($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'hidden tab has aria-expanded = false')
|
||||
|
||||
$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.equal($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'after click, hidden tab has aria-expanded = false')
|
||||
assert.strictEqual($tabs.find('.active a').attr('aria-expanded'), 'true', 'after click, shown tab has aria-expanded = true')
|
||||
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')
|
||||
assert.equal($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('.active a').attr('aria-expanded'), 'true', 'shown tab has aria-expanded = true')
|
||||
assert.strictEqual($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'hidden tab has aria-expanded = false')
|
||||
|
||||
$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.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('.active a').attr('aria-expanded'), 'true', 'after second show event, shown tab still has aria-expanded = true')
|
||||
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')
|
||||
|
||||
$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) {
|
||||
@ -100,7 +100,7 @@ $(function () {
|
||||
assert.notEqual($('.tooltip b').length, 0, 'b tag was inserted')
|
||||
|
||||
$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) {
|
||||
@ -112,7 +112,7 @@ $(function () {
|
||||
assert.ok($('.tooltip').hasClass('some-class'), 'custom class is present')
|
||||
|
||||
$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) {
|
||||
@ -209,14 +209,14 @@ $(function () {
|
||||
|
||||
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.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('destroy')
|
||||
|
||||
assert.ok(!$tooltip.hasClass('in'), 'tooltip is hidden')
|
||||
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')
|
||||
})
|
||||
|
||||
@ -232,7 +232,7 @@ $(function () {
|
||||
assert.ok($('.tooltip').is('.fade.in'), 'tooltip is faded in')
|
||||
|
||||
$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) {
|
||||
@ -261,10 +261,10 @@ $(function () {
|
||||
.bootstrapTooltip('show')
|
||||
|
||||
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')
|
||||
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) {
|
||||
@ -301,10 +301,10 @@ $(function () {
|
||||
.bootstrapTooltip()
|
||||
|
||||
$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')
|
||||
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) {
|
||||
@ -315,10 +315,10 @@ $(function () {
|
||||
})
|
||||
|
||||
$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')
|
||||
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) {
|
||||
@ -329,10 +329,10 @@ $(function () {
|
||||
})
|
||||
|
||||
$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')
|
||||
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) {
|
||||
@ -356,7 +356,7 @@ $(function () {
|
||||
assert.ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned to bottom')
|
||||
|
||||
$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>')
|
||||
.appendTo($container)
|
||||
@ -366,7 +366,7 @@ $(function () {
|
||||
assert.ok($('.tooltip').is('.left'), 'right positioned tooltip is dynamically positioned left')
|
||||
|
||||
$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>')
|
||||
.appendTo($container)
|
||||
@ -376,7 +376,7 @@ $(function () {
|
||||
assert.ok($('.tooltip').is('.right'), 'left positioned tooltip is dynamically positioned right')
|
||||
|
||||
$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()
|
||||
$style.remove()
|
||||
@ -402,7 +402,7 @@ $(function () {
|
||||
assert.ok($('.tooltip').is('.top'), 'top positioned tooltip is dynamically positioned to top')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
})
|
||||
@ -427,7 +427,7 @@ $(function () {
|
||||
assert.ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned to bottom')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
})
|
||||
@ -453,7 +453,7 @@ $(function () {
|
||||
assert.ok($('.tooltip').is('.fade.top.in'), 'has correct classes applied')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
})
|
||||
@ -479,7 +479,7 @@ $(function () {
|
||||
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
})
|
||||
@ -509,7 +509,7 @@ $(function () {
|
||||
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
})
|
||||
@ -535,7 +535,7 @@ $(function () {
|
||||
assert.ok($('.tooltip').is('.fade.top.in'), 'has correct classes applied')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
})
|
||||
@ -559,10 +559,10 @@ $(function () {
|
||||
})
|
||||
|
||||
$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')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
})
|
||||
@ -590,7 +590,7 @@ $(function () {
|
||||
assert.strictEqual(Math.round($tooltip.offset().top), Math.round($(window).height() - 12 - $tooltip[0].offsetHeight))
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
@ -618,7 +618,7 @@ $(function () {
|
||||
assert.strictEqual(Math.round($container.find('.tooltip').offset().left), 12)
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
@ -647,7 +647,7 @@ $(function () {
|
||||
assert.strictEqual(Math.round($tooltip.offset().left), Math.round($(window).width() - 12 - $tooltip[0].offsetWidth))
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
@ -674,7 +674,7 @@ $(function () {
|
||||
assert.strictEqual(Math.round($tooltip.offset().left), Math.round(60 + $container.width() - $tooltip[0].offsetWidth))
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
@ -927,7 +927,7 @@ $(function () {
|
||||
$styles.remove()
|
||||
assert.ok(Math.abs(offset.left - 88) <= 1, 'tooltip has correct horizontal location')
|
||||
$circle.bootstrapTooltip('hide')
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip({ container: 'body', placement: 'top', trigger: 'manual' })
|
||||
@ -964,7 +964,7 @@ $(function () {
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
$styles.remove()
|
||||
$(this).remove()
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip({
|
||||
@ -999,7 +999,7 @@ $(function () {
|
||||
var currentUid = $('#tt-content').text()
|
||||
|
||||
$('#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) {
|
||||
@ -1027,14 +1027,14 @@ $(function () {
|
||||
var currentUid = $('#tt-content').text()
|
||||
|
||||
$('#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"')
|
||||
|
||||
$('#tt-content').trigger('mouseenter')
|
||||
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) {
|
||||
@ -1058,7 +1058,7 @@ $(function () {
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
$styles.remove()
|
||||
$(this).remove()
|
||||
assert.equal($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip({
|
||||
|
Loading…
Reference in New Issue
Block a user