2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-08 17:22:31 +03:00

tests: comply to the new rules

Use `assert.strictEqual`/`assert.true`/`assert.false`
This commit is contained in:
XhmikosR
2020-11-23 18:26:21 +02:00
parent 5391ecdfde
commit 551f37aff6
12 changed files with 468 additions and 459 deletions
+16 -16
View File
@@ -40,7 +40,7 @@ $(function () {
assert.expect(2)
var $el = $('<div/>')
var $tab = $el.bootstrapTab()
assert.ok($tab instanceof $, 'returns jquery collection')
assert.true($tab instanceof $, 'returns jquery collection')
assert.strictEqual($tab[0], $el[0], 'collection contains element')
})
@@ -321,8 +321,8 @@ $(function () {
var $tabs = $(tabsHTML).appendTo('#qunit-fixture')
$tabs.find('li:last-child a').trigger('click')
assert.notOk($tabs.find('li:first-child a').hasClass('active'))
assert.ok($tabs.find('li:last-child a').hasClass('active'))
assert.false($tabs.find('li:first-child a').hasClass('active'))
assert.true($tabs.find('li:last-child a').hasClass('active'))
})
QUnit.test('selected tab should deactivate previous selected link in dropdown', function (assert) {
@@ -340,9 +340,9 @@ $(function () {
var $tabs = $(tabsHTML).appendTo('#qunit-fixture')
$tabs.find('li:first-child a').trigger('click')
assert.ok($tabs.find('li:first-child a').hasClass('active'))
assert.notOk($tabs.find('li:last-child a').hasClass('active'))
assert.notOk($tabs.find('li:last-child .dropdown-menu a:first-child').hasClass('active'))
assert.true($tabs.find('li:first-child a').hasClass('active'))
assert.false($tabs.find('li:last-child a').hasClass('active'))
assert.false($tabs.find('li:last-child .dropdown-menu a:first-child').hasClass('active'))
})
QUnit.test('should support li > .dropdown-item', function (assert) {
@@ -363,8 +363,8 @@ $(function () {
var $tabs = $(tabsHTML).appendTo('#qunit-fixture')
$tabs.find('.dropdown-item').trigger('click')
assert.ok($tabs.find('.dropdown-item').hasClass('active'))
assert.notOk($tabs.find('.nav-link:not(.dropdown-toggle)').hasClass('active'))
assert.true($tabs.find('.dropdown-item').hasClass('active'))
assert.false($tabs.find('.nav-link:not(.dropdown-toggle)').hasClass('active'))
})
QUnit.test('Nested tabs', function (assert) {
@@ -394,12 +394,12 @@ $(function () {
$(tabsHTML).appendTo('#qunit-fixture')
$('#tabNested2').on('shown.bs.tab', function () {
assert.ok($('#x-tab1').hasClass('active'))
assert.true($('#x-tab1').hasClass('active'))
done()
})
$('#tab1').on('shown.bs.tab', function () {
assert.ok($('#x-tab1').hasClass('active'))
assert.true($('#x-tab1').hasClass('active'))
$('#tabNested2').trigger($.Event('click'))
})
.trigger($.Event('click'))
@@ -420,15 +420,15 @@ $(function () {
$(tabsHTML).appendTo('#qunit-fixture')
$('#tab-profile')
.on('shown.bs.tab', function () {
assert.ok($('#profile').hasClass('fade'))
assert.ok($('#profile').hasClass('show'))
assert.true($('#profile').hasClass('fade'))
assert.true($('#profile').hasClass('show'))
$('#tab-home')
.on('shown.bs.tab', function () {
assert.ok($('#profile').hasClass('fade'))
assert.notOk($('#profile').hasClass('show'))
assert.ok($('#home').hasClass('fade'))
assert.ok($('#home').hasClass('show'))
assert.true($('#profile').hasClass('fade'))
assert.false($('#profile').hasClass('show'))
assert.true($('#home').hasClass('fade'))
assert.true($('#home').hasClass('show'))
done()
})