Skip to content

Commit a5f342e

Browse files
enriquecastljacobmllr95
authored andcommitted
feat(b-dropdown): add splitClass property to dropdown component (#4394)
* feat(b-dropdown): add splitClass property to dropdown component * Update package.json
1 parent 1fa25f6 commit a5f342e

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/components/dropdown/dropdown.js

+5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ export const props = {
6060
type: String,
6161
default: () => getComponentConfig(NAME, 'splitVariant')
6262
},
63+
splitClass: {
64+
type: [String, Array],
65+
default: null
66+
},
6367
splitButtonType: {
6468
type: String,
6569
default: 'button',
@@ -144,6 +148,7 @@ export const BDropdown = /*#__PURE__*/ Vue.extend({
144148
{
145149
ref: 'button',
146150
props: btnProps,
151+
class: this.splitClass,
147152
attrs: {
148153
id: this.safeId('_BV_button_')
149154
},

src/components/dropdown/dropdown.spec.js

+15
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,21 @@ describe('dropdown', () => {
368368
wrapper.destroy()
369369
})
370370

371+
it('split should have class specified in split class property', () => {
372+
const splitClass = 'custom-button-class'
373+
const wrapper = mount(BDropdown, {
374+
attachToDocument: true,
375+
propsData: {
376+
splitClass,
377+
split: true
378+
}
379+
})
380+
const $buttons = wrapper.findAll('button')
381+
const $split = $buttons.at(0)
382+
383+
expect($split.classes()).toContain(splitClass)
384+
})
385+
371386
it('menu should have class dropdown-menu-right when prop right set', async () => {
372387
const wrapper = mount(BDropdown, {
373388
attachToDocument: true,

src/components/dropdown/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@
9696
"prop": "splitButtonType",
9797
"description": "Value to place in the 'type' attribute on the split button: 'button', 'submit', 'reset'"
9898
},
99+
{
100+
"prop": "splitClass",
101+
"version": "2.2.0",
102+
"description": "CSS class (or classes) to add to the split button"
103+
},
99104
{
100105
"prop": "boundary",
101106
"description": "The boundary constraint of the menu: 'scrollParent', 'window', 'viewport', or a reference to an HTMLElement"

0 commit comments

Comments
 (0)