From 65ae622d4061efc5f62628d7d607358476f8f345 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Mon, 12 Feb 2018 01:45:59 +0100 Subject: Dropdown - Allow to disable Popper.js style (#24092) * Dropdown - Allow to disable Popper.js style * Update dropdown.js * Update dropdown.html * copy changes --- js/src/dropdown.js | 12 ++++++++++-- js/tests/unit/dropdown.js | 30 ++++++++++++++++++++++++++++++ js/tests/visual/dropdown.html | 18 +++++++++++++++--- 3 files changed, 55 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/src/dropdown.js b/js/src/dropdown.js index 82deaa2205..b877017f2b 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -75,14 +75,16 @@ const Dropdown = (($) => { offset : 0, flip : true, boundary : 'scrollParent', - reference : 'toggle' + reference : 'toggle', + display : 'dynamic' } const DefaultType = { offset : '(number|string|function)', flip : 'boolean', boundary : '(string|element)', - reference : '(string|element)' + reference : '(string|element)', + display : 'string' } /** @@ -295,6 +297,12 @@ const Dropdown = (($) => { } } + // Disable Popper.js if we have a static display + if (this._config.display === 'static') { + popperConfig.modifiers.applyStyle = { + enabled: false + } + } return popperConfig } diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js index 97ceb65961..3040e81b41 100644 --- a/js/tests/unit/dropdown.js +++ b/js/tests/unit/dropdown.js @@ -908,4 +908,34 @@ $(function () { }) $textarea.trigger('click') }) + + QUnit.test('should not use Popper.js if display set to static', function (assert) { + assert.expect(1) + var dropdownHTML = + '
-
+
-
+
+
+ +
-- cgit v1.2.3