Skip to content
Permalink
Browse files

feat(b-dropdown-form): add formClass prop for adding classes to the f…

…orm element (closes #4474) (#4475)
  • Loading branch information
bbugh authored and tmorehouse committed Dec 9, 2019
1 parent 5e216f6 commit eef4200976f7921b1bb03f50c0ece8ee7c41ed0e
@@ -11,6 +11,10 @@ export const BDropdownForm = /*#__PURE__*/ Vue.extend({
disabled: {
type: Boolean,
default: false
},
formClass: {
type: [String, Object, Array],
default: null
}
},
render(h, { props, data, children }) {
@@ -24,7 +28,7 @@ export const BDropdownForm = /*#__PURE__*/ Vue.extend({
{
ref: 'form',
staticClass: 'b-dropdown-form',
class: { disabled: props.disabled },
class: [props.formClass, { disabled: props.disabled }],
props,
attrs: {
...$attrs,
@@ -20,6 +20,17 @@ describe('dropdown-form', () => {
expect(form.classes()).not.toContain('disabled')
})

it('should have custom form classes on form', async () => {
const wrapper = mount(BDropdownForm, {
propsData: {
formClass: ['form-class-custom', 'form-class-custom-2']
}
})

const form = wrapper.find('form')
expect(form.classes()).toEqual(['b-dropdown-form', 'form-class-custom', 'form-class-custom-2'])
})

it('has tabindex on form', async () => {
const wrapper = mount(BDropdownForm)
expect(wrapper.is('li')).toBe(true)
@@ -256,6 +256,11 @@
{
"prop": "validated",
"description": "When set, adds the Bootstrap class 'was-validated' on the form, triggering the native browser validation states"
},
{
"prop": "formClass",
"version": "2.2.0",
"description": "CSS class (or classes) to add to the form"
}
]
},

0 comments on commit eef4200

Please sign in to comment.
You can’t perform that action at this time.