mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-18 10:52:19 +01:00
tests: switch to strictEqual/notStrictEqual
This commit is contained in:
parent
195585f5a6
commit
5f79b75ea8
@ -56,7 +56,7 @@ $(function () {
|
||||
'</div>'
|
||||
var $alert = $(alertHTML).appendTo('#qunit-fixture').bootstrapAlert()
|
||||
|
||||
assert.notEqual($('#qunit-fixture').find('.alert').length, 0, 'element added to dom')
|
||||
assert.notStrictEqual($('#qunit-fixture').find('.alert').length, 0, 'element added to dom')
|
||||
|
||||
$alert
|
||||
.one('closed.bs.alert', function () {
|
||||
|
@ -68,7 +68,7 @@ $(function () {
|
||||
|
||||
$('<div id="modal-test"/>')
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
assert.notStrictEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
done()
|
||||
})
|
||||
.bootstrapModal('show')
|
||||
@ -109,7 +109,7 @@ $(function () {
|
||||
$('<div id="modal-test"/>')
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.ok($('#modal-test').is(':visible'), 'modal visible')
|
||||
assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
assert.notStrictEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
$(this).bootstrapModal('hide')
|
||||
})
|
||||
.on('hidden.bs.modal', function () {
|
||||
@ -126,7 +126,7 @@ $(function () {
|
||||
$('<div id="modal-test"/>')
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.ok($('#modal-test').is(':visible'), 'modal visible')
|
||||
assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
assert.notStrictEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
$(this).bootstrapModal('toggle')
|
||||
})
|
||||
.on('hidden.bs.modal', function () {
|
||||
@ -143,7 +143,7 @@ $(function () {
|
||||
$('<div id="modal-test"><span class="close" data-dismiss="modal"/></div>')
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.ok($('#modal-test').is(':visible'), 'modal visible')
|
||||
assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
assert.notStrictEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
$(this).find('.close').trigger('click')
|
||||
})
|
||||
.on('hidden.bs.modal', function () {
|
||||
@ -175,7 +175,7 @@ $(function () {
|
||||
|
||||
$('<div id="modal-test"><div class="contents"/></div>')
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
assert.notStrictEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
$('.contents').trigger('click')
|
||||
assert.ok($('#modal-test').is(':visible'), 'modal visible')
|
||||
$('#modal-test').trigger('click')
|
||||
|
@ -51,7 +51,7 @@ $(function () {
|
||||
$('<a href="#" title="mdo" data-content="https://twitter.com/mdo">@mdo</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
|
||||
$(this).bootstrapPopover('hide')
|
||||
})
|
||||
.on('hidden.bs.popover', function () {
|
||||
@ -95,7 +95,7 @@ $(function () {
|
||||
|
||||
$popover
|
||||
.one('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.strictEqual($('.popover .popover-header').text(), '@fat', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-body').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
|
||||
$popover.bootstrapPopover('hide')
|
||||
@ -121,7 +121,7 @@ $(function () {
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
|
||||
assert.notEqual($('.popover').length, 0, 'popover inserted')
|
||||
assert.notStrictEqual($('.popover').length, 0, 'popover inserted')
|
||||
assert.strictEqual($('.popover .popover-header').text(), '@glebm <3 writing tests', 'title inserted')
|
||||
assert.ok($.contains($('.popover').get(0), title), 'title node moved, not copied')
|
||||
// toLowerCase because IE8 will return <I>...</I>
|
||||
@ -142,7 +142,7 @@ $(function () {
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
|
||||
assert.notEqual($('.popover').length, 0, 'popover inserted')
|
||||
assert.notStrictEqual($('.popover').length, 0, 'popover inserted')
|
||||
assert.strictEqual($('.popover .popover-header').text(), '@glebm <3 writing tests', 'title inserted')
|
||||
assert.ok(!$.contains($('.popover').get(0), title), 'title node copied, not moved')
|
||||
assert.strictEqual($('.popover .popover-body').html(), '¯\\_(ツ)_/¯', 'content inserted')
|
||||
@ -164,8 +164,8 @@ $(function () {
|
||||
})
|
||||
|
||||
function popoverInserted() {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-body').html(), $div[0].outerHTML, 'content correctly inserted')
|
||||
assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.strictEqual($('.popover .popover-body').html(), $div[0].outerHTML, 'content correctly inserted')
|
||||
}
|
||||
|
||||
$popover
|
||||
@ -195,7 +195,7 @@ $(function () {
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover()
|
||||
.one('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.strictEqual($('.popover .popover-header').text(), '@mdo', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-body').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
$popover.bootstrapPopover('hide')
|
||||
@ -217,7 +217,7 @@ $(function () {
|
||||
content: 'ignored content option'
|
||||
})
|
||||
.one('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.strictEqual($('.popover .popover-header').text(), '@mdo', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-body').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
$popover.bootstrapPopover('hide')
|
||||
@ -240,7 +240,7 @@ $(function () {
|
||||
template: '<div class="popover foobar"><div class="arrow"></div><div class="inner"><h3 class="title"/><div class="content"><p/></div></div></div>'
|
||||
})
|
||||
.one('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.ok($('.popover').hasClass('foobar'), 'custom class is present')
|
||||
$popover.bootstrapPopover('hide')
|
||||
})
|
||||
@ -282,7 +282,7 @@ $(function () {
|
||||
trigger: 'click'
|
||||
})
|
||||
.one('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
|
||||
$div.find('a').trigger('click')
|
||||
})
|
||||
.one('hidden.bs.popover', function () {
|
||||
@ -352,7 +352,7 @@ $(function () {
|
||||
$('<a href="#">@Johann-S</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('inserted.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.notStrictEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.ok(true, 'inserted event fired')
|
||||
done()
|
||||
})
|
||||
|
@ -141,7 +141,7 @@ $(function () {
|
||||
|
||||
$tooltip
|
||||
.one('shown.bs.tooltip', function () {
|
||||
assert.notEqual($('.tooltip b').length, 0, 'b tag was inserted')
|
||||
assert.notStrictEqual($('.tooltip b').length, 0, 'b tag was inserted')
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
@ -163,7 +163,7 @@ $(function () {
|
||||
|
||||
$tooltip
|
||||
.one('shown.bs.tooltip', function () {
|
||||
assert.notEqual($('.tooltip').length, 0, 'tooltip inserted')
|
||||
assert.notStrictEqual($('.tooltip').length, 0, 'tooltip inserted')
|
||||
assert.strictEqual($('.tooltip').text(), '<3 writing tests', 'title inserted')
|
||||
assert.ok(!$.contains($('.tooltip').get(0), title), 'title node copied, not moved')
|
||||
done()
|
||||
@ -184,7 +184,7 @@ $(function () {
|
||||
|
||||
$tooltip
|
||||
.one('shown.bs.tooltip', function () {
|
||||
assert.notEqual($('.tooltip').length, 0, 'tooltip inserted')
|
||||
assert.notStrictEqual($('.tooltip').length, 0, 'tooltip inserted')
|
||||
assert.strictEqual($('.tooltip').text(), '<3 writing tests', 'title inserted')
|
||||
assert.ok($.contains($('.tooltip').get(0), title), 'title node moved, not copied')
|
||||
done()
|
||||
@ -244,7 +244,7 @@ $(function () {
|
||||
$('<div title="tooltip title"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('inserted.bs.tooltip', function () {
|
||||
assert.notEqual($('.tooltip').length, 0, 'tooltip was inserted')
|
||||
assert.notStrictEqual($('.tooltip').length, 0, 'tooltip was inserted')
|
||||
assert.ok(true, 'inserted event fired')
|
||||
done()
|
||||
})
|
||||
@ -403,7 +403,7 @@ $(function () {
|
||||
|
||||
$tooltip
|
||||
.one('shown.bs.tooltip', function () {
|
||||
assert.notEqual($('body > .tooltip').length, 0, 'tooltip is direct descendant of body')
|
||||
assert.notStrictEqual($('body > .tooltip').length, 0, 'tooltip is direct descendant of body')
|
||||
assert.strictEqual($('#qunit-fixture > .tooltip').length, 0, 'tooltip is not in parent')
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
})
|
||||
@ -843,7 +843,7 @@ $(function () {
|
||||
$.each(tests, function (idx, triggers) {
|
||||
for (var i = 0, len = triggers.length; i < len; i++) {
|
||||
$el.trigger(triggers[i])
|
||||
assert.equal(i < len - 1, showingTooltip())
|
||||
assert.strictEqual(i < len - 1, showingTooltip())
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -157,9 +157,9 @@ $(function () {
|
||||
mode: 'open'
|
||||
})
|
||||
|
||||
assert.equal(shadowRoot, Util.findShadowRoot(shadowRoot))
|
||||
assert.strictEqual(shadowRoot, Util.findShadowRoot(shadowRoot))
|
||||
shadowRoot.innerHTML = '<button>Shadow Button</button>'
|
||||
assert.equal(shadowRoot, Util.findShadowRoot(shadowRoot.firstChild))
|
||||
assert.strictEqual(shadowRoot, Util.findShadowRoot(shadowRoot.firstChild))
|
||||
})
|
||||
|
||||
QUnit.test('Util.findShadowRoot should return null when attachShadow is not available', function (assert) {
|
||||
@ -167,7 +167,7 @@ $(function () {
|
||||
|
||||
var $div = $('<div id="test"></div>').appendTo($('#qunit-fixture'))
|
||||
if (!document.documentElement.attachShadow) {
|
||||
assert.equal(null, Util.findShadowRoot($div[0]))
|
||||
assert.strictEqual(null, Util.findShadowRoot($div[0]))
|
||||
} else {
|
||||
var sandbox = sinon.createSandbox()
|
||||
|
||||
@ -176,7 +176,7 @@ $(function () {
|
||||
return $div
|
||||
})
|
||||
|
||||
assert.equal(null, Util.findShadowRoot($div[0]))
|
||||
assert.strictEqual(null, Util.findShadowRoot($div[0]))
|
||||
sandbox.restore()
|
||||
}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user