Skip to content

Commit e48d3dc

Browse files
authored
fix(b-input-group): fix kebab-case prop names for prepend-html and append-html (fixes #3565) (#3567)
1 parent d05f0b9 commit e48d3dc

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

src/components/input-group/input-group.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ export const props = {
1616
prepend: {
1717
type: String
1818
},
19-
prependHTML: {
19+
prependHtml: {
2020
type: String
2121
},
2222
append: {
2323
type: String
2424
},
25-
appendHTML: {
25+
appendHtml: {
2626
type: String
2727
},
2828
tag: {
@@ -43,12 +43,12 @@ export const BInputGroup = /*#__PURE__*/ Vue.extend({
4343
const childNodes = []
4444

4545
// Prepend prop/slot
46-
if (props.prepend || props.prependHTML || hasNormalizedSlot('prepend', $scopedSlots, $slots)) {
46+
if (props.prepend || props.prependHtml || hasNormalizedSlot('prepend', $scopedSlots, $slots)) {
4747
childNodes.push(
4848
h(BInputGroupPrepend, [
4949
// Prop
50-
props.prepend || props.prependHTML
51-
? h(BInputGroupText, { domProps: htmlOrText(props.prependHTML, props.prepend) })
50+
props.prepend || props.prependHtml
51+
? h(BInputGroupText, { domProps: htmlOrText(props.prependHtml, props.prepend) })
5252
: h(false),
5353
// Slot
5454
normalizeSlot('prepend', {}, $scopedSlots, $slots) || h(false)
@@ -66,12 +66,12 @@ export const BInputGroup = /*#__PURE__*/ Vue.extend({
6666
}
6767

6868
// Append prop
69-
if (props.append || props.appendHTML || hasNormalizedSlot('append', $scopedSlots, $slots)) {
69+
if (props.append || props.appendHtml || hasNormalizedSlot('append', $scopedSlots, $slots)) {
7070
childNodes.push(
7171
h(BInputGroupAppend, [
7272
// prop
73-
props.append || props.appendHTML
74-
? h(BInputGroupText, { domProps: htmlOrText(props.appendHTML, props.append) })
73+
props.append || props.appendHtml
74+
? h(BInputGroupText, { domProps: htmlOrText(props.appendHtml, props.append) })
7575
: h(false),
7676
// Slot
7777
normalizeSlot('append', {}, $scopedSlots, $slots) || h(false)

src/components/input-group/input-group.spec.js

+27
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,33 @@ describe('input-group', () => {
8383
)
8484
})
8585

86+
it('renders input-group-prepend & input-group-append when prepend-html & append-html props set', async () => {
87+
const wrapper = mount(BInputGroup, {
88+
propsData: {
89+
prependHtml: '<i>foo</i>',
90+
appendHtml: '<b>bar</b>'
91+
},
92+
slots: {
93+
default: 'baz'
94+
}
95+
})
96+
97+
expect(wrapper.is('div')).toBe(true)
98+
expect(wrapper.classes()).toContain('input-group')
99+
expect(wrapper.classes().length).toBe(1)
100+
expect(wrapper.text()).toEqual('foobazbar')
101+
expect(wrapper.findAll('.input-group > *').length).toBe(2)
102+
expect(wrapper.findAll('.input-group-prepend').length).toBe(1)
103+
expect(wrapper.findAll('.input-group-prepend > .input-group-text').length).toBe(1)
104+
expect(wrapper.find('.input-group-prepend').text()).toBe('foo')
105+
expect(wrapper.findAll('.input-group-append').length).toBe(1)
106+
expect(wrapper.findAll('.input-group-append > .input-group-text').length).toBe(1)
107+
expect(wrapper.find('.input-group-append').text()).toBe('bar')
108+
expect(wrapper.find('.input-group > .input-group-prepend ~ .input-group-append').exists()).toBe(
109+
true
110+
)
111+
})
112+
86113
it('renders input-group-prepend & input-group-append when prepend & append slots present', async () => {
87114
const wrapper = mount(BInputGroup, {
88115
slots: {

0 commit comments

Comments
 (0)