8000 Update form-group.spec.js · bootstrap-vue/bootstrap-vue@51dc3c1 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

8000
Appearance settings

Commit 51dc3c1

Browse files
committed
Update form-group.spec.js
1 parent 05a6ed2 commit 51dc3c1

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,39 @@ describe('form-group', () => {
5757
wrapper.destroy()
5858
})
5959

60+
it('default slot is optionally scoped', async () => {
61+
const label = 'my-label'
62+
const description = 'my-description'
63+
let slotScope
64+
65+
const wrapper = mount(BFormGroup, {
66+
propsData: {
67+
label,
68+
description
69+
},
70+
scopedSlots: {
71+
default(scope) {
72+
slotScope = scope
73+
return 'foobar'
74+
}
75+
}
76+
})
77+
78+
expect(wrapper.vm).toBeDefined()
79+
await waitNT(wrapper.vm)
80+
81+
expect(slotScope).toBeDefined()
82+
expect(typeof slotScope.ariaDescribedby).toBe('string')
83+
expect(typeof slotScope.descriptionId).toBe('string')
84+
expect(typeof slotScope.id).toBe('string')
85+
expect(typeof slotScope.labelId).toBe('string')
86+
87+
expect(wrapper.text()).toContain(label)
88+
expect(wrapper.text()).toContain(description)
89+
90+
wrapper.destroy()
91+
})
92+
6093
it('has user supplied ID', async () => {
6194
const wrapper = mount(BFormGroup, {
6295
propsData: {

0 commit comments

Comments
 (0)
0