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:
parent
58470c0ac5
commit
3c49467224
@ -75,6 +75,10 @@ class Toast {
|
||||
return DefaultType
|
||||
}
|
||||
|
||||
static get Default() {
|
||||
return Default
|
||||
}
|
||||
|
||||
// Public
|
||||
|
||||
show() {
|
||||
|
@ -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)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user