mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
fix modal test to be sure we call getTransitionDurationFromElement
This commit is contained in:
parent
3c49467224
commit
b54ddfda83
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user