diff options
| author | Johann-S <[email protected]> | 2019-02-06 14:35:59 +0100 |
|---|---|---|
| committer | Johann-S <[email protected]> | 2019-02-06 15:01:13 +0100 |
| commit | b54ddfda83bf1d8a01bc97e7636bdc4ae4af888a (patch) | |
| tree | 8cdb7e8db39d76b49b795a361b885dd0ac1250a9 /js/tests | |
| parent | 3c49467224cc7f37ce56ce9c287de8f169efd7b3 (diff) | |
| download | bootstrap-b54ddfda83bf1d8a01bc97e7636bdc4ae4af888a.tar.xz bootstrap-b54ddfda83bf1d8a01bc97e7636bdc4ae4af888a.zip | |
fix modal test to be sure we call getTransitionDurationFromElement
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/modal.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js index 176290480..9b7fb0aa6 100644 --- a/js/tests/unit/modal.js +++ b/js/tests/unit/modal.js @@ -669,7 +669,7 @@ $(function () { }) QUnit.test('transition duration should be the modal-dialog duration before triggering shown event', function (assert) { - assert.expect(2) + assert.expect(1) var done = assert.async() var style = [ '<style>', @@ -694,22 +694,17 @@ $(function () { '</div>' ].join('') - var beginTimestamp = 0 var $modal = $(modalHTML).appendTo('#qunit-fixture') - var $modalDialog = $('.modal-dialog') - var transitionDuration = Util.getTransitionDurationFromElement($modalDialog[0]) - - assert.strictEqual(transitionDuration, 300) + var expectedTransitionDuration = 300 + var spy = sinon.spy(Util, 'getTransitionDurationFromElement') $modal.on('shown.bs.modal', function () { - var diff = Date.now() - beginTimestamp - assert.ok(diff < 400) + assert.ok(spy.returned(expectedTransitionDuration)) $style.remove() + spy.restore() done() }) .bootstrapModal('show') - - beginTimestamp = Date.now() }) QUnit.test('should dispose modal', function (assert) { |
