Commit 9c75c855 authored by Chris Rebert's avatar Chris Rebert

JS unit tests: equal() => strictEqual()

[skip validator]
parent 118b8c26
...@@ -38,7 +38,7 @@ $(function () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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 () { ...@@ -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')
}) })
}) })
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment