From 4febcb4b492c322c71bdef579cc4ad99ea86e150 Mon Sep 17 00:00:00 2001 From: Kevin Kirsche Date: Sun, 1 Mar 2015 09:33:48 -0500 Subject: [Fixes #15953] Implement assert.expect in each unit test [Fixes #15953] Implement `assert.expect` in each unit test --- js/tests/unit/collapse.js | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'js/tests/unit/collapse.js') diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js index 8fe367532..68c4bce25 100644 --- a/js/tests/unit/collapse.js +++ b/js/tests/unit/collapse.js @@ -4,6 +4,7 @@ $(function () { QUnit.module('collapse plugin') QUnit.test('should be defined on jquery object', function (assert) { + assert.expect(1) assert.ok($(document.body).collapse, 'collapse method is defined') }) @@ -19,10 +20,12 @@ $(function () { }) QUnit.test('should provide no conflict', function (assert) { + assert.expect(1) assert.strictEqual($.fn.collapse, undefined, 'collapse was set back to undefined (org value)') }) QUnit.test('should return jquery collection containing the element', function (assert) { + assert.expect(2) var $el = $('
') var $collapse = $el.bootstrapCollapse() assert.ok($collapse instanceof $, 'returns jquery collection') @@ -30,6 +33,7 @@ $(function () { }) QUnit.test('should show a collapsed element', function (assert) { + assert.expect(2) var $el = $('
').bootstrapCollapse('show') assert.ok($el.hasClass('in'), 'has class "in"') @@ -37,6 +41,7 @@ $(function () { }) QUnit.test('should hide a collapsed element', function (assert) { + assert.expect(2) var $el = $('
').bootstrapCollapse('hide') assert.ok(!$el.hasClass('in'), 'does not have class "in"') @@ -44,6 +49,7 @@ $(function () { }) QUnit.test('should not fire shown when show is prevented', function (assert) { + assert.expect(1) var done = assert.async() $('
') @@ -59,6 +65,7 @@ $(function () { }) QUnit.test('should reset style to auto after finishing opening collapse', function (assert) { + assert.expect(2) var done = assert.async() $('
') @@ -73,6 +80,7 @@ $(function () { }) QUnit.test('should remove "collapsed" class from target when collapse is shown', function (assert) { + assert.expect(1) var done = assert.async() var $target = $('').appendTo('#qunit-fixture') @@ -103,6 +112,7 @@ $(function () { }) QUnit.test('should remove "collapsed" class from all triggers targeting the collapse when the collapse is shown', function (assert) { + assert.expect(2) var done = assert.async() var $target = $('').appendTo('#qunit-fixture') @@ -137,9 +148,8 @@ $(function () { }) QUnit.test('should not close a collapse when initialized with "show" if already shown', function (assert) { - var done = assert.async() - assert.expect(0) + var done = assert.async() var $test = $('
') .appendTo('#qunit-fixture') @@ -153,9 +163,8 @@ $(function () { }) QUnit.test('should open a collapse when initialized with "show" if not already shown', function (assert) { - var done = assert.async() - assert.expect(1) + var done = assert.async() var $test = $('
') .appendTo('#qunit-fixture') @@ -169,6 +178,7 @@ $(function () { }) QUnit.test('should remove "collapsed" class from active accordion target', function (assert) { + assert.expect(3) var done = assert.async() var accordionHTML = '
' @@ -202,6 +212,7 @@ $(function () { }) QUnit.test('should allow dots in data-parent', function (assert) { + assert.expect(3) var done = assert.async() var accordionHTML = '
' @@ -235,6 +246,7 @@ $(function () { }) QUnit.test('should set aria-expanded="true" on target when collapse is shown', function (assert) { + assert.expect(1) var done = assert.async() var $target = $('').appendTo('#qunit-fixture') @@ -265,6 +278,7 @@ $(function () { }) QUnit.test('should set aria-expanded="true" on all triggers targeting the collapse when the collapse is shown', function (assert) { + assert.expect(2) var done = assert.async() var $target = $('').appendTo('#qunit-fixture') @@ -299,6 +314,7 @@ $(function () { }) QUnit.test('should change aria-expanded from active accordion target to "false" and set the newly active one to "true"', function (assert) { + assert.expect(3) var done = assert.async() var accordionHTML = '