From 61d7742dfcd6992425ddc12de46a339611f1868c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20M=C3=BCller?= Date: Thu, 17 Sep 2020 15:06:57 +0200 Subject: [PATCH 1/2] fix(b-nav-item-dropdown): `boundary` handling in `` --- docs/common-props.json | 2 +- src/components/nav/nav-item-dropdown.js | 4 ---- src/components/nav/package.json | 10 +++++----- src/mixins/dropdown.js | 3 +-- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/docs/common-props.json b/docs/common-props.json index 6267ab2c657..2be2f4b6370 100644 --- a/docs/common-props.json +++ b/docs/common-props.json @@ -126,7 +126,7 @@ "description": "Sets the `placeholder` attribute value on the form control" }, "disabled": { - "description": "When set to 'true', disables the component's functionality and places it in a disabled state" + "description": "When set to `true`, disables the component's functionality and places it in a disabled state" }, "readonly": { "description": "Sets the `readonly` attribute on the form control" diff --git a/src/components/nav/nav-item-dropdown.js b/src/components/nav/nav-item-dropdown.js index 176203e0cdb..fc783dc5253 100644 --- a/src/components/nav/nav-item-dropdown.js +++ b/src/components/nav/nav-item-dropdown.js @@ -29,10 +29,6 @@ export const BNavItemDropdown = /*#__PURE__*/ Vue.extend({ toggleId() { return this.safeId('_BV_toggle_') }, - isNav() { - // Signal to dropdown mixin that we are in a navbar - return true - }, dropdownClasses() { return [this.directionClass, this.boundaryClass, { show: this.visible }] }, diff --git a/src/components/nav/package.json b/src/components/nav/package.json index 192dcfbed5c..805bb3f8739 100644 --- a/src/components/nav/package.json +++ b/src/components/nav/package.json @@ -98,11 +98,11 @@ "props": [ { "prop": "text", - "description": "Text to place in the toggle button, or in the split button is split mode" + "description": "Text to place in the toggle element (link)" }, { "prop": "html", - "description": "HTML string to place in the toggle button, or in the split button is split mode. Use with caution" + "description": "HTML string to place in the toggle element (link). Use with caution" }, { "prop": "dropup", @@ -138,16 +138,16 @@ }, { "prop": "toggleClass", - "description": "CSS class (or classes) to add to the toggle button" + "description": "CSS class (or classes) to add to the toggle element (link)" }, { "prop": "noCaret", - "description": "Hide the caret indicator on the toggle button" + "description": "Hide the caret indicator on the toggle element (link)" }, { "prop": "boundary", "version": "2.4.0", - "description": "The boundary constraint of the menu: 'scrollParent', 'window', 'viewport', or a reference to an HTMLElement. Has no effect when dropdown is inside a b-navbar" + "description": "The boundary constraint of the menu: 'scrollParent', 'window', 'viewport', or a reference to an HTMLElement. Has no effect when dropdown is inside a ``" } ], "slots": [ diff --git a/src/mixins/dropdown.js b/src/mixins/dropdown.js index a23ff245f24..c9fced295c1 100644 --- a/src/mixins/dropdown.js +++ b/src/mixins/dropdown.js @@ -127,8 +127,7 @@ export default { // Position `static` is needed to allow menu to "breakout" of the `scrollParent` // boundaries when boundary is anything other than `scrollParent` // See: https://github.com/twbs/bootstrap/issues/24251#issuecomment-341413786 - const { boundary } = this - return boundary !== 'scrollParent' || !boundary ? 'position-static' : '' + return this.boundary !== 'scrollParent' && !this.inNavbar ? 'position-static' : '' } }, watch: { From 7d8d3ccff809eea080b69dc648c10c7a54462086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20M=C3=BCller?= Date: Thu, 17 Sep 2020 15:08:14 +0200 Subject: [PATCH 2/2] Update nav-item-dropdown.spec.js --- src/components/nav/nav-item-dropdown.spec.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/components/nav/nav-item-dropdown.spec.js b/src/components/nav/nav-item-dropdown.spec.js index df15c5e5b5a..f9a115cd1ad 100644 --- a/src/components/nav/nav-item-dropdown.spec.js +++ b/src/components/nav/nav-item-dropdown.spec.js @@ -34,15 +34,6 @@ describe('nav-item-dropdown', () => { wrapper.destroy() }) - it('should have a flag that we are in a nav', async () => { - const wrapper = mount(BNavItemDropdown) - - expect(wrapper.vm).toBeDefined() - expect(wrapper.vm.isNav).toBe(true) - - wrapper.destroy() - }) - it('should have custom toggle class when "toggle-class" prop set', async () => { const wrapper = mount(BNavItemDropdown, { propsData: {