Skip to content

Commit

Permalink
fix(b-nav-item-dropdown): boundary handling in <b-navbar> (closes #…
Browse files Browse the repository at this point in the history
…5789) (#5794)

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

* Update nav-item-dropdown.spec.js
  • Loading branch information
jacobmllr95 authored Sep 17, 2020
1 parent 31eeb0a commit 73383bf
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docs/common-props.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 0 additions & 4 deletions src/components/nav/nav-item-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }]
},
Expand Down
9 changes: 0 additions & 9 deletions src/components/nav/nav-item-dropdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
10 changes: 5 additions & 5 deletions src/components/nav/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": [
Expand Down
3 changes: 1 addition & 2 deletions src/mixins/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 73383bf

Please sign in to comment.