Skip to content

Commit

Permalink
fix modal test to be sure we call getTransitionDurationFromElement
Browse files Browse the repository at this point in the history
  • Loading branch information
Johann-S committed Feb 6, 2019
1 parent 3c49467 commit 0ed4f37
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions js/tests/unit/modal.js
Expand Up @@ -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>',
Expand All @@ -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) {
Expand Down

0 comments on commit 0ed4f37

Please sign in to comment.