diff --git a/js/src/collapse.js b/js/src/collapse.js index c3b3599ecc73..e22cf0b7ab68 100644 --- a/js/src/collapse.js +++ b/js/src/collapse.js @@ -331,7 +331,7 @@ const Collapse = (($) => { const _config = { ...Default, ...$this.data(), - ...typeof config === 'object' && config + ...typeof config === 'object' && config ? config : {} } if (!data && _config.toggle && /show|hide/.test(config)) { diff --git a/js/src/modal.js b/js/src/modal.js index 1df41526669f..e3de68b8fe7d 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -500,7 +500,7 @@ const Modal = (($) => { const _config = { ...Default, ...$(this).data(), - ...typeof config === 'object' && config + ...typeof config === 'object' && config ? config : {} } if (!data) { diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 1c46940f53f5..d8cf69473b98 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -165,7 +165,7 @@ const ScrollSpy = (($) => { _getConfig(config) { config = { ...Default, - ...config + ...typeof config === 'object' && config ? config : {} } if (typeof config.target !== 'string') { diff --git a/js/src/tooltip.js b/js/src/tooltip.js index f751ee3c94c1..59c26897c995 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -611,7 +611,7 @@ const Tooltip = (($) => { config = { ...this.constructor.Default, ...$(this.element).data(), - ...config + ...typeof config === 'object' && config ? config : {} } if (typeof config.delay === 'number') { diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js index 726655e9ccce..f87c65bea031 100644 --- a/js/tests/unit/dropdown.js +++ b/js/tests/unit/dropdown.js @@ -544,15 +544,16 @@ $(function () { $dropdown.trigger('click') }) - QUnit.test('should focus next/previous element when using keyboard navigation', function (assert) { - assert.expect(4) + QUnit.test('should skip disabled element when using keyboard navigation', function (assert) { + assert.expect(3) var done = assert.async() var dropdownHTML = '