Skip to content
Permalink
Browse files
fix(b-nav-item-dropdown): boundary handling in <b-navbar> (closes #…
…5789) (#5794)

* fix(b-nav-item-dropdown): `boundary` handling in `<b-navbar>`

* Update nav-item-dropdown.spec.js
  • Loading branch information
jacobmllr95 committed Sep 17, 2020
1 parent 31eeb0a commit 73383bfd935c097604bf5ad39a9cc2d18961ba87
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 21 deletions.
@@ -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"
@@ -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 }]
},
@@ -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: {
@@ -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 `<b-navbar>`"
}
],
"slots": [
@@ -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: {

0 comments on commit 73383bf

Please sign in to comment.