From 6dcd1b9e312f6877990f959c6f4aaa94d0f31161 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Wed, 6 Feb 2019 13:56:37 +0100 Subject: [PATCH 1/2] allow to override default toast options --- js/src/toast.js | 4 ++++ js/tests/unit/toast.js | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/js/src/toast.js b/js/src/toast.js index 98be2a418718..0b8e4ff9ce1b 100644 --- a/js/src/toast.js +++ b/js/src/toast.js @@ -74,6 +74,10 @@ class Toast { static get DefaultType() { return DefaultType } + + static get Default() { + return Default + } // Public diff --git a/js/tests/unit/toast.js b/js/tests/unit/toast.js index e6bd6be1eeb1..2081693ebce6 100644 --- a/js/tests/unit/toast.js +++ b/js/tests/unit/toast.js @@ -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 = + '
' + + '' + + '
' + + var $toast = $(toastHtml) + .bootstrapToast() + + var toast = $toast.data('bs.toast') + assert.strictEqual(toast._config.delay, defaultDelay) + }) }) From 808d83cd701109960e64f5cf2bed6ba0d3dc4847 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 6 Feb 2019 15:00:24 +0200 Subject: [PATCH 2/2] Update toast.js --- js/src/toast.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/toast.js b/js/src/toast.js index 0b8e4ff9ce1b..02596e9dad72 100644 --- a/js/src/toast.js +++ b/js/src/toast.js @@ -74,7 +74,7 @@ class Toast { static get DefaultType() { return DefaultType } - + static get Default() { return Default }