Skip to content

Commit dee537a

Browse files
committed
refactor: CDropdown: rename nav prop to inNav
1 parent 2514aab commit dee537a

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

src/components/Dropdown/CDropdown.vue

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<component
3-
:is="nav ? 'li' : 'div'"
3+
:is="inNav ? 'li' : 'div'"
44
:class="computedDropdownClasses"
55
v-on-clickaway="hide"
66
>
@@ -21,7 +21,10 @@
2121
v-bind="togglerAttrs"
2222
/>
2323
</slot>
24-
<div ref="menu" :class="computedMenuClasses">
24+
<div
25+
ref="menu"
26+
:class="computedMenuClasses"
27+
>
2528
<slot></slot>
2629
</div>
2730
</component>
@@ -45,7 +48,7 @@ export default {
4548
disabled: Boolean,
4649
addMenuClasses: [String, Array, Object],
4750
addTogglerClasses: [String, Array, Object],
48-
nav: Boolean,
51+
inNav: Boolean,
4952
noCaret: Boolean,
5053
variant: String,
5154
size: {
@@ -148,29 +151,29 @@ export default {
148151
this.carretClass,
149152
{
150153
'show': this.visible,
151-
'nav-item': this.nav,
154+
'nav-item': this.inNav,
152155
'btn-group': this.splittedToggler
153156
}
154157
]
155158
},
156159
157160
togglerTag () {
158-
return this.nav ? CLink : 'button'
161+
return this.inNav ? CLink : 'button'
159162
},
160163
161164
splittedToggler () {
162-
return this.split && !this.nav
165+
return this.split && !this.inNav
163166
},
164167
165168
computedTogglerClasses () {
166169
return [
167170
this.addTogglerClasses,
168-
this.nav ? 'nav-link' : 'btn',
171+
this.inNav ? 'nav-link' : 'btn',
169172
{
170173
'dropdown-toggle': !this.noCaret && !this.split,
171-
[`btn-${this.size}`]: this.size && !this.nav,
174+
[`btn-${this.size}`]: this.size && !this.inNav,
172175
'disabled' : this.disabled,
173-
[`${ this.nav ? 'bg' : 'btn'}-${ this.variant }`]: this.variant
176+
[`${ this.inNav ? 'bg' : 'btn'}-${ this.variant }`]: this.variant
174177
}
175178
]
176179
},

src/components/Dropdown/tests/CDropdown.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const customWrapper = mount(Component, {
2929
show: true,
3030
addMenuClasses: 'additional-menu-class',
3131
addTogglerClasses: 'additional-toggler-class',
32-
nav: false,
32+
inNav: false,
3333
noCaret: true,
3434
variant: 'success',
3535
size: 'lg',
@@ -48,7 +48,7 @@ const navWrapper = mount(Component, {
4848
togglerText: 'Dropdown button',
4949
addMenuClasses: 'additional-menu-class',
5050
addTogglerClasses: 'additional-toggler-class',
51-
nav: true,
51+
inNav: true,
5252
noCaret: true,
5353
variant: 'success',
5454
offset: 20,
@@ -71,7 +71,7 @@ describe(ComponentName, () => {
7171
it('renders custom wrapper correctly', () => {
7272
expect(customWrapper.element).toMatchSnapshot()
7373
})
74-
it('renders correctly in nav mode', () => {
74+
it('renders correctly inNav', () => {
7575
expect(navWrapper.element).toMatchSnapshot()
7676
})
7777
it('properly toggle dropdown', () => {

src/components/Dropdown/tests/__snapshots__/CDropdown.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ exports[`CDropdown renders correctly 1`] = `
2020
</div>
2121
`;
2222

23-
exports[`CDropdown renders correctly in nav mode 1`] = `
23+
exports[`CDropdown renders correctly inNav 1`] = `
2424
<li
2525
class="dropleft nav-item"
2626
>

src/components/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export declare class CDropdown extends Vue {
136136
disabled: boolean
137137
addMenuClasses: [string, Array<any>, object]
138138
addTogglerClasses: [string, Array<any>, object]
139-
nav: boolean
139+
inNav: boolean
140140
noCaret: boolean
141141
variant: string
142142
size: string

0 commit comments

Comments
 (0)