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