0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

allow to override default toast options (#28186)

This commit is contained in:
Johann-S 2019-02-06 14:19:04 +01:00 committed by XhmikosR
parent 58470c0ac5
commit 3c49467224
2 changed files with 24 additions and 0 deletions

View File

@ -75,6 +75,10 @@ class Toast {
return DefaultType
}
static get Default() {
return Default
}
// Public
show() {

View File

@ -236,4 +236,24 @@ $(function () {
})
.bootstrapToast('show')
})
QUnit.test('should expose default setting to allow to override them', function (assert) {
assert.expect(1)
var defaultDelay = 1000
Toast.Default.delay = defaultDelay
var toastHtml =
'<div class="toast" data-autohide="false" data-animation="false">' +
'<button type="button" class="ml-2 mb-1 close" data-dismiss="toast">' +
'close' +
'</button>' +
'</div>'
var $toast = $(toastHtml)
.bootstrapToast()
var toast = $toast.data('bs.toast')
assert.strictEqual(toast._config.delay, defaultDelay)
})
})