@gitlab/ui 114.1.0 → 114.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/base/breadcrumb/breadcrumb.js +4 -16
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +7 -26
- package/src/components/base/breadcrumb/breadcrumb.scss +18 -2
- package/src/components/base/breadcrumb/breadcrumb.vue +4 -17
- package/CHANGELOG.md +0 -13139
- package/src/vendor/bootstrap/LICENSE +0 -11
- package/src/vendor/bootstrap-vue/LICENSE +0 -11
- package/src/vendor/bootstrap-vue/package.json +0 -144
- package/src/vendor/bootstrap-vue/src/components/button/MODIFICATIONS.md +0 -16
- package/src/vendor/bootstrap-vue/src/components/button/README.md +0 -240
- package/src/vendor/bootstrap-vue/src/components/button/button-close.spec.js +0 -210
- package/src/vendor/bootstrap-vue/src/components/button/button.spec.js +0 -349
- package/src/vendor/bootstrap-vue/src/components/button/package.json +0 -105
- package/src/vendor/bootstrap-vue/src/components/dropdown/README.md +0 -730
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-divider.spec.js +0 -58
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-form.spec.js +0 -110
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-group.spec.js +0 -94
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-header.spec.js +0 -73
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-item-button.spec.js +0 -117
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-item.spec.js +0 -147
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-text.spec.js +0 -59
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown.spec.js +0 -1121
- package/src/vendor/bootstrap-vue/src/components/dropdown/package.json +0 -368
- package/src/vendor/bootstrap-vue/src/components/form/README.md +0 -365
- package/src/vendor/bootstrap-vue/src/components/form/form-invalid-feedback.spec.js +0 -170
- package/src/vendor/bootstrap-vue/src/components/form/form-text.spec.js +0 -93
- package/src/vendor/bootstrap-vue/src/components/form/form-valid-feedback.spec.js +0 -157
- package/src/vendor/bootstrap-vue/src/components/form/form.spec.js +0 -97
- package/src/vendor/bootstrap-vue/src/components/form/package.json +0 -112
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/README.md +0 -691
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/form-checkbox-group.spec.js +0 -525
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/form-checkbox.spec.js +0 -922
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/package.json +0 -172
- package/src/vendor/bootstrap-vue/src/components/form-group/README.md +0 -339
- package/src/vendor/bootstrap-vue/src/components/form-group/form-group.spec.js +0 -477
- package/src/vendor/bootstrap-vue/src/components/form-group/package.json +0 -183
- package/src/vendor/bootstrap-vue/src/components/form-radio/README.md +0 -437
- package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.spec.js +0 -357
- package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio.spec.js +0 -587
- package/src/vendor/bootstrap-vue/src/components/form-radio/package.json +0 -162
- package/src/vendor/bootstrap-vue/src/components/form-select/README.md +0 -504
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option-group.spec.js +0 -138
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option.spec.js +0 -75
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select.spec.js +0 -723
- package/src/vendor/bootstrap-vue/src/components/form-select/package.json +0 -132
- package/src/vendor/bootstrap-vue/src/components/form-textarea/README.md +0 -453
- package/src/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.spec.js +0 -1000
- package/src/vendor/bootstrap-vue/src/components/form-textarea/package.json +0 -122
- package/src/vendor/bootstrap-vue/src/components/layout/README.md +0 -791
- package/src/vendor/bootstrap-vue/src/components/layout/col.spec.js +0 -192
- package/src/vendor/bootstrap-vue/src/components/layout/form-row.spec.js +0 -45
- package/src/vendor/bootstrap-vue/src/components/layout/package.json +0 -99
- package/src/vendor/bootstrap-vue/src/components/link/README.md +0 -76
- package/src/vendor/bootstrap-vue/src/components/link/link.spec.js +0 -434
- package/src/vendor/bootstrap-vue/src/components/link/package.json +0 -57
- package/src/vendor/bootstrap-vue/src/components/modal/MODIFICATIONS.md +0 -30
- package/src/vendor/bootstrap-vue/src/components/modal/README.md +0 -1067
- package/src/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal-event.class.spec.js +0 -82
- package/src/vendor/bootstrap-vue/src/components/modal/modal.spec.js +0 -1418
- package/src/vendor/bootstrap-vue/src/components/modal/package.json +0 -544
- package/src/vendor/bootstrap-vue/src/components/nav/README.md +0 -362
- package/src/vendor/bootstrap-vue/src/components/nav/nav-item.spec.js +0 -127
- package/src/vendor/bootstrap-vue/src/components/nav/nav.spec.js +0 -177
- package/src/vendor/bootstrap-vue/src/components/nav/package.json +0 -73
- package/src/vendor/bootstrap-vue/src/components/popover/README.md +0 -919
- package/src/vendor/bootstrap-vue/src/components/popover/package.json +0 -261
- package/src/vendor/bootstrap-vue/src/components/popover/popover.spec.js +0 -198
- package/src/vendor/bootstrap-vue/src/components/table/README.md +0 -3157
- package/src/vendor/bootstrap-vue/src/components/table/helpers/default-sort-compare.spec.js +0 -112
- package/src/vendor/bootstrap-vue/src/components/table/helpers/normalize-fields.spec.js +0 -93
- package/src/vendor/bootstrap-vue/src/components/table/package.json +0 -1763
- package/src/vendor/bootstrap-vue/src/components/table/table-busy.spec.js +0 -150
- package/src/vendor/bootstrap-vue/src/components/table/table-caption.spec.js +0 -176
- package/src/vendor/bootstrap-vue/src/components/table/table-colgroup.spec.js +0 -81
- package/src/vendor/bootstrap-vue/src/components/table/table-filtering.spec.js +0 -409
- package/src/vendor/bootstrap-vue/src/components/table/table-item-formatter.spec.js +0 -56
- package/src/vendor/bootstrap-vue/src/components/table/table-lite.spec.js +0 -682
- package/src/vendor/bootstrap-vue/src/components/table/table-pagination.spec.js +0 -133
- package/src/vendor/bootstrap-vue/src/components/table/table-primarykey.spec.js +0 -83
- package/src/vendor/bootstrap-vue/src/components/table/table-provider.spec.js +0 -411
- package/src/vendor/bootstrap-vue/src/components/table/table-row-details.spec.js +0 -459
- package/src/vendor/bootstrap-vue/src/components/table/table-selectable.spec.js +0 -1182
- package/src/vendor/bootstrap-vue/src/components/table/table-simple.spec.js +0 -206
- package/src/vendor/bootstrap-vue/src/components/table/table-sorting.spec.js +0 -858
- package/src/vendor/bootstrap-vue/src/components/table/table-sticky-column.spec.js +0 -377
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-bottom-row.spec.js +0 -94
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-row-events.spec.js +0 -529
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-top-row.spec.js +0 -88
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-transition.spec.js +0 -83
- package/src/vendor/bootstrap-vue/src/components/table/table-tfoot-custom.spec.js +0 -91
- package/src/vendor/bootstrap-vue/src/components/table/table-tfoot-events.spec.js +0 -137
- package/src/vendor/bootstrap-vue/src/components/table/table-thead-events.spec.js +0 -155
- package/src/vendor/bootstrap-vue/src/components/table/table-thead-top.spec.js +0 -96
- package/src/vendor/bootstrap-vue/src/components/table/table.spec.js +0 -692
- package/src/vendor/bootstrap-vue/src/components/tabs/README.md +0 -433
- package/src/vendor/bootstrap-vue/src/components/tabs/package.json +0 -205
- package/src/vendor/bootstrap-vue/src/components/tabs/tab.spec.js +0 -330
- package/src/vendor/bootstrap-vue/src/components/tabs/tabs.spec.js +0 -778
- package/src/vendor/bootstrap-vue/src/components/toast/README.md +0 -655
- package/src/vendor/bootstrap-vue/src/components/toast/helpers/bv-toast.spec.js +0 -117
- package/src/vendor/bootstrap-vue/src/components/toast/package.json +0 -184
- package/src/vendor/bootstrap-vue/src/components/toast/toast.spec.js +0 -294
- package/src/vendor/bootstrap-vue/src/components/toast/toaster.spec.js +0 -77
- package/src/vendor/bootstrap-vue/src/components/tooltip/README.md +0 -559
- package/src/vendor/bootstrap-vue/src/components/tooltip/package.json +0 -258
- package/src/vendor/bootstrap-vue/src/components/tooltip/tooltip.spec.js +0 -1240
- package/src/vendor/bootstrap-vue/src/components/transition/package.json +0 -5
- package/src/vendor/bootstrap-vue/src/components/transporter/package.json +0 -5
- package/src/vendor/bootstrap-vue/src/components/transporter/transporter.spec.js +0 -85
- package/src/vendor/bootstrap-vue/src/directives/modal/modal.spec.js +0 -191
- package/src/vendor/bootstrap-vue/src/directives/tooltip/README.md +0 -521
- package/src/vendor/bootstrap-vue/src/directives/tooltip/package.json +0 -131
- package/src/vendor/bootstrap-vue/src/directives/tooltip/tooltip.spec.js +0 -190
- package/src/vendor/bootstrap-vue/src/directives/visible/README.md +0 -244
- package/src/vendor/bootstrap-vue/src/directives/visible/package.json +0 -24
- package/src/vendor/bootstrap-vue/src/mixins/attrs.spec.js +0 -194
- package/src/vendor/bootstrap-vue/src/mixins/click-out.spec.js +0 -52
- package/src/vendor/bootstrap-vue/src/mixins/focus-in.spec.js +0 -53
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-document.spec.js +0 -117
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-root.spec.js +0 -77
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-window.spec.js +0 -115
- package/src/vendor/bootstrap-vue/src/mixins/listeners.spec.js +0 -245
- package/src/vendor/bootstrap-vue/src/utils/bv-event.class.spec.js +0 -66
- package/src/vendor/bootstrap-vue/src/utils/clone-deep.spec.js +0 -70
- package/src/vendor/bootstrap-vue/src/utils/config.spec.js +0 -169
- package/src/vendor/bootstrap-vue/src/utils/css-escape.spec.js +0 -82
- package/src/vendor/bootstrap-vue/src/utils/dom.spec.js +0 -291
- package/src/vendor/bootstrap-vue/src/utils/events.spec.js +0 -41
- package/src/vendor/bootstrap-vue/src/utils/get.spec.js +0 -109
- package/src/vendor/bootstrap-vue/src/utils/inspect.spec.js +0 -251
- package/src/vendor/bootstrap-vue/src/utils/loose-equal.spec.js +0 -203
- package/src/vendor/bootstrap-vue/src/utils/normalize-slot.spec.js +0 -63
- package/src/vendor/bootstrap-vue/src/utils/number.spec.js +0 -72
- package/src/vendor/bootstrap-vue/src/utils/object.spec.js +0 -61
- package/src/vendor/bootstrap-vue/src/utils/props.spec.js +0 -112
- package/src/vendor/bootstrap-vue/src/utils/router.spec.js +0 -248
- package/src/vendor/bootstrap-vue/src/utils/string.spec.js +0 -65
- package/src/vendor/bootstrap-vue/src/utils/stringify-object-values.spec.js +0 -47
- package/src/vendor/bootstrap-vue/src/utils/warn.spec.js +0 -54
|
@@ -1,477 +0,0 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils'
|
|
2
|
-
import { waitNT } from '../../../tests/utils'
|
|
3
|
-
import { BCol } from '../layout/col'
|
|
4
|
-
import { BFormGroup } from './form-group'
|
|
5
|
-
|
|
6
|
-
describe('form-group', () => {
|
|
7
|
-
const origGetBCR = Element.prototype.getBoundingClientRect
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
// Mock `getBoundingClientRect()` so that the `isVisible(el)` test returns `true`
|
|
11
|
-
// Needed for input focusing
|
|
12
|
-
Element.prototype.getBoundingClientRect = jest.fn(() => ({
|
|
13
|
-
width: 24,
|
|
14
|
-
height: 24,
|
|
15
|
-
top: 0,
|
|
16
|
-
left: 0,
|
|
17
|
-
bottom: 0,
|
|
18
|
-
right: 0
|
|
19
|
-
}))
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
afterEach(() => {
|
|
23
|
-
// Reset overrides
|
|
24
|
-
Element.prototype.getBoundingClientRect = origGetBCR
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('has expected default structure', async () => {
|
|
28
|
-
const wrapper = mount(BFormGroup)
|
|
29
|
-
|
|
30
|
-
expect(wrapper.vm).toBeDefined()
|
|
31
|
-
await waitNT(wrapper.vm)
|
|
32
|
-
|
|
33
|
-
expect(wrapper.element.tagName).toBe('FIELDSET')
|
|
34
|
-
expect(wrapper.classes()).toContain('form-group')
|
|
35
|
-
expect(wrapper.classes().length).toBe(1)
|
|
36
|
-
expect(wrapper.attributes('id')).toBeDefined()
|
|
37
|
-
expect(wrapper.attributes('aria-labelledby')).toBeUndefined()
|
|
38
|
-
expect(wrapper.find('label').exists()).toBe(false)
|
|
39
|
-
expect(wrapper.find('legend').exists()).toBe(false)
|
|
40
|
-
expect(wrapper.text()).toEqual('')
|
|
41
|
-
|
|
42
|
-
wrapper.destroy()
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it('renders content from default slot', async () => {
|
|
46
|
-
const wrapper = mount(BFormGroup, {
|
|
47
|
-
slots: {
|
|
48
|
-
default: 'foobar'
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
expect(wrapper.vm).toBeDefined()
|
|
53
|
-
await waitNT(wrapper.vm)
|
|
54
|
-
|
|
55
|
-
expect(wrapper.text()).toEqual('foobar')
|
|
56
|
-
|
|
57
|
-
wrapper.destroy()
|
|
58
|
-
})
|
|
59
|
-
|
|
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
|
-
|
|
93
|
-
it('has user supplied ID', async () => {
|
|
94
|
-
const wrapper = mount(BFormGroup, {
|
|
95
|
-
propsData: {
|
|
96
|
-
label: 'test',
|
|
97
|
-
labelFor: 'input-id',
|
|
98
|
-
id: 'foo'
|
|
99
|
-
},
|
|
100
|
-
slots: {
|
|
101
|
-
default: '<input id="input-id" type="text">'
|
|
102
|
-
}
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
expect(wrapper.vm).toBeDefined()
|
|
106
|
-
await waitNT(wrapper.vm)
|
|
107
|
-
|
|
108
|
-
expect(wrapper.attributes('id')).toEqual('foo')
|
|
109
|
-
expect(wrapper.attributes('aria-labelledby')).toBeUndefined()
|
|
110
|
-
expect(wrapper.find('label').attributes('id')).toEqual('foo__BV_label_')
|
|
111
|
-
|
|
112
|
-
wrapper.destroy()
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
it('sets `aria-describedby` even when special characters are used in IDs', async () => {
|
|
116
|
-
const wrapper = mount(BFormGroup, {
|
|
117
|
-
propsData: {
|
|
118
|
-
id: '/group-id',
|
|
119
|
-
label: 'test',
|
|
120
|
-
labelFor: '/input-id',
|
|
121
|
-
// Description is needed to set `aria-describedby`
|
|
122
|
-
description: 'foo'
|
|
123
|
-
},
|
|
124
|
-
slots: {
|
|
125
|
-
default: '<input id="/input-id" type="text">'
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
expect(wrapper.vm).toBeDefined()
|
|
130
|
-
await waitNT(wrapper.vm)
|
|
131
|
-
|
|
132
|
-
const $input = wrapper.find('input')
|
|
133
|
-
expect($input.exists()).toBe(true)
|
|
134
|
-
expect($input.attributes('aria-describedby')).toEqual('/group-id__BV_description_')
|
|
135
|
-
|
|
136
|
-
wrapper.destroy()
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
it('does not render a FIELDSET if prop `label-for` set', async () => {
|
|
140
|
-
const wrapper = mount(BFormGroup, {
|
|
141
|
-
propsData: {
|
|
142
|
-
label: 'test',
|
|
143
|
-
labelFor: 'input-id'
|
|
144
|
-
},
|
|
145
|
-
slots: {
|
|
146
|
-
default: '<input id="input-id" type="text">'
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
expect(wrapper.vm).toBeDefined()
|
|
151
|
-
await waitNT(wrapper.vm)
|
|
152
|
-
|
|
153
|
-
const formGroupId = wrapper.attributes('id')
|
|
154
|
-
|
|
155
|
-
expect(wrapper.element.tagName).toBe('DIV')
|
|
156
|
-
expect(wrapper.classes()).toContain('form-group')
|
|
157
|
-
expect(wrapper.classes().length).toBe(1)
|
|
158
|
-
expect(wrapper.attributes('id')).toBeDefined()
|
|
159
|
-
expect(wrapper.attributes('role')).toEqual('group')
|
|
160
|
-
expect(wrapper.attributes('aria-labelledby')).toBeUndefined()
|
|
161
|
-
|
|
162
|
-
expect(wrapper.find('legend').exists()).toBe(false)
|
|
163
|
-
|
|
164
|
-
const $label = wrapper.find('label')
|
|
165
|
-
expect($label.exists()).toBe(true)
|
|
166
|
-
expect($label.classes()).toContain('!gl-block')
|
|
167
|
-
expect($label.text()).toEqual('test')
|
|
168
|
-
expect($label.attributes('id')).toEqual(`${formGroupId}__BV_label_`)
|
|
169
|
-
expect($label.attributes('for')).toEqual('input-id')
|
|
170
|
-
expect($label.attributes('aria-describedby')).toBeUndefined()
|
|
171
|
-
expect($label.attributes('aria-labelledby')).toBeUndefined()
|
|
172
|
-
|
|
173
|
-
wrapper.destroy()
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
it('has expected structure for horizontal layout with prop `label-for` set', async () => {
|
|
177
|
-
const wrapper = mount(BFormGroup, {
|
|
178
|
-
propsData: {
|
|
179
|
-
label: 'test',
|
|
180
|
-
labelFor: 'input-id',
|
|
181
|
-
labelCols: 1,
|
|
182
|
-
labelColsSm: 2,
|
|
183
|
-
labelColsMd: 3,
|
|
184
|
-
labelColsLg: 4,
|
|
185
|
-
labelColsXl: 5
|
|
186
|
-
},
|
|
187
|
-
slots: {
|
|
188
|
-
default: '<input id="input-id" type="text">'
|
|
189
|
-
}
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
expect(wrapper.vm).toBeDefined()
|
|
193
|
-
await waitNT(wrapper.vm)
|
|
194
|
-
|
|
195
|
-
expect(wrapper.element.tagName).toBe('DIV')
|
|
196
|
-
expect(wrapper.classes()).toContain('form-group')
|
|
197
|
-
expect(wrapper.classes()).toContain('form-row')
|
|
198
|
-
expect(wrapper.classes().length).toBe(2)
|
|
199
|
-
expect(wrapper.attributes('role')).toEqual('group')
|
|
200
|
-
expect(wrapper.attributes('aria-labelledby')).toBeUndefined()
|
|
201
|
-
|
|
202
|
-
const $cols = wrapper.findAllComponents(BCol)
|
|
203
|
-
expect($cols.length).toBe(2)
|
|
204
|
-
|
|
205
|
-
const $label = wrapper.find('label')
|
|
206
|
-
expect($label.exists()).toBe(true)
|
|
207
|
-
expect($label.classes()).toContain('col-form-label')
|
|
208
|
-
expect($label.classes()).toContain('col-1')
|
|
209
|
-
expect($label.classes()).toContain('col-sm-2')
|
|
210
|
-
expect($label.classes()).toContain('col-md-3')
|
|
211
|
-
expect($label.classes()).toContain('col-lg-4')
|
|
212
|
-
expect($label.classes()).toContain('col-xl-5')
|
|
213
|
-
expect($label.classes().length).toBe(6)
|
|
214
|
-
expect($label.text()).toEqual('test')
|
|
215
|
-
|
|
216
|
-
expect(wrapper.find('legend').exists()).toBe(false)
|
|
217
|
-
|
|
218
|
-
wrapper.destroy()
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
it('has expected structure for horizontal layout without prop `label-for` set', async () => {
|
|
222
|
-
const wrapper = mount(BFormGroup, {
|
|
223
|
-
propsData: {
|
|
224
|
-
label: 'test',
|
|
225
|
-
labelCols: 1,
|
|
226
|
-
labelColsSm: 2,
|
|
227
|
-
labelColsMd: 3,
|
|
228
|
-
labelColsLg: 4,
|
|
229
|
-
labelColsXl: 5
|
|
230
|
-
},
|
|
231
|
-
slots: {
|
|
232
|
-
default: '<input id="input-id" type="text">'
|
|
233
|
-
}
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
expect(wrapper.vm).toBeDefined()
|
|
237
|
-
await waitNT(wrapper.vm)
|
|
238
|
-
|
|
239
|
-
expect(wrapper.element.tagName).toBe('FIELDSET')
|
|
240
|
-
expect(wrapper.classes()).toContain('form-group')
|
|
241
|
-
expect(wrapper.classes().length).toBe(1)
|
|
242
|
-
expect(wrapper.attributes('role')).toBeUndefined()
|
|
243
|
-
expect(wrapper.attributes('aria-labelledby')).toBeDefined()
|
|
244
|
-
|
|
245
|
-
const $legend = wrapper.find('legend')
|
|
246
|
-
expect($legend.exists()).toBe(true)
|
|
247
|
-
expect($legend.classes()).toContain('col-form-label')
|
|
248
|
-
expect($legend.classes()).toContain('col-1')
|
|
249
|
-
expect($legend.classes()).toContain('col-sm-2')
|
|
250
|
-
expect($legend.classes()).toContain('col-md-3')
|
|
251
|
-
expect($legend.classes()).toContain('col-lg-4')
|
|
252
|
-
expect($legend.classes()).toContain('col-xl-5')
|
|
253
|
-
expect($legend.classes()).toContain('bv-no-focus-ring')
|
|
254
|
-
expect($legend.classes().length).toBe(7)
|
|
255
|
-
expect($legend.text()).toEqual('test')
|
|
256
|
-
|
|
257
|
-
expect(wrapper.find('label').exists()).toBe(false)
|
|
258
|
-
|
|
259
|
-
wrapper.destroy()
|
|
260
|
-
})
|
|
261
|
-
|
|
262
|
-
it('has expected structure for horizontal layout without label content', async () => {
|
|
263
|
-
const wrapper = mount(BFormGroup, {
|
|
264
|
-
propsData: {
|
|
265
|
-
labelCols: 1
|
|
266
|
-
},
|
|
267
|
-
slots: {
|
|
268
|
-
default: '<input id="input-id" type="text">'
|
|
269
|
-
}
|
|
270
|
-
})
|
|
271
|
-
|
|
272
|
-
expect(wrapper.vm).toBeDefined()
|
|
273
|
-
await waitNT(wrapper.vm)
|
|
274
|
-
|
|
275
|
-
expect(wrapper.element.tagName).toBe('FIELDSET')
|
|
276
|
-
expect(wrapper.classes()).toContain('form-group')
|
|
277
|
-
expect(wrapper.classes().length).toBe(1)
|
|
278
|
-
expect(wrapper.attributes('role')).toBeUndefined()
|
|
279
|
-
expect(wrapper.attributes('aria-labelledby')).toBeUndefined()
|
|
280
|
-
|
|
281
|
-
const $legend = wrapper.find('legend')
|
|
282
|
-
expect($legend.classes()).toContain('col-form-label')
|
|
283
|
-
expect($legend.classes()).toContain('col-1')
|
|
284
|
-
expect($legend.classes()).toContain('bv-no-focus-ring')
|
|
285
|
-
expect($legend.text()).toEqual('')
|
|
286
|
-
|
|
287
|
-
expect(wrapper.find('label').exists()).toBe(false)
|
|
288
|
-
|
|
289
|
-
wrapper.destroy()
|
|
290
|
-
})
|
|
291
|
-
|
|
292
|
-
it('validation and help text works', async () => {
|
|
293
|
-
const wrapper = mount(BFormGroup, {
|
|
294
|
-
propsData: {
|
|
295
|
-
id: 'group-id',
|
|
296
|
-
label: 'test',
|
|
297
|
-
labelFor: 'input-id',
|
|
298
|
-
description: 'foo',
|
|
299
|
-
invalidFeedback: 'bar',
|
|
300
|
-
validFeedback: 'baz'
|
|
301
|
-
},
|
|
302
|
-
slots: {
|
|
303
|
-
default: '<input id="input-id" type="text">'
|
|
304
|
-
}
|
|
305
|
-
})
|
|
306
|
-
|
|
307
|
-
expect(wrapper.vm).toBeDefined()
|
|
308
|
-
await waitNT(wrapper.vm)
|
|
309
|
-
|
|
310
|
-
// When `state` is `null` (default), all helpers are rendered
|
|
311
|
-
expect(wrapper.find('.form-text').exists()).toBe(true)
|
|
312
|
-
expect(wrapper.find('.form-text').text()).toEqual('foo')
|
|
313
|
-
expect(wrapper.attributes('aria-invalid')).toBeUndefined()
|
|
314
|
-
expect(wrapper.classes()).not.toContain('is-invalid')
|
|
315
|
-
expect(wrapper.classes()).not.toContain('is-valid')
|
|
316
|
-
|
|
317
|
-
const $input = wrapper.find('input')
|
|
318
|
-
expect($input.exists()).toBe(true)
|
|
319
|
-
expect($input.attributes('aria-describedby')).toEqual('group-id__BV_description_')
|
|
320
|
-
|
|
321
|
-
const $invalidFeedback = wrapper.find('.invalid-feedback')
|
|
322
|
-
expect($invalidFeedback.exists()).toBe(true)
|
|
323
|
-
expect($invalidFeedback.text()).toEqual('bar')
|
|
324
|
-
expect($invalidFeedback.attributes('aria-live')).toEqual('assertive')
|
|
325
|
-
expect($invalidFeedback.attributes('aria-atomic')).toEqual('true')
|
|
326
|
-
|
|
327
|
-
const $validFeedback = wrapper.find('.valid-feedback')
|
|
328
|
-
expect($validFeedback.exists()).toBe(true)
|
|
329
|
-
expect($validFeedback.text()).toEqual('baz')
|
|
330
|
-
expect($validFeedback.attributes('aria-live')).toEqual('assertive')
|
|
331
|
-
expect($validFeedback.attributes('aria-atomic')).toEqual('true')
|
|
332
|
-
|
|
333
|
-
// When `state` is `true`, description and valid are visible
|
|
334
|
-
await wrapper.setProps({ state: true })
|
|
335
|
-
expect(wrapper.attributes('aria-invalid')).toBeUndefined()
|
|
336
|
-
expect(wrapper.classes()).not.toContain('is-invalid')
|
|
337
|
-
expect(wrapper.classes()).toContain('is-valid')
|
|
338
|
-
expect($input.attributes('aria-describedby')).toBeDefined()
|
|
339
|
-
expect($input.attributes('aria-describedby')).toEqual(
|
|
340
|
-
'group-id__BV_description_ group-id__BV_feedback_valid_'
|
|
341
|
-
)
|
|
342
|
-
|
|
343
|
-
// When `state` is `false`, description and valid are visible
|
|
344
|
-
await wrapper.setProps({ state: false })
|
|
345
|
-
expect(wrapper.attributes('aria-invalid')).toEqual('true')
|
|
346
|
-
expect(wrapper.classes()).not.toContain('is-valid')
|
|
347
|
-
expect(wrapper.classes()).toContain('is-invalid')
|
|
348
|
-
expect($input.attributes('aria-describedby')).toEqual(
|
|
349
|
-
'group-id__BV_description_ group-id__BV_feedback_invalid_'
|
|
350
|
-
)
|
|
351
|
-
})
|
|
352
|
-
|
|
353
|
-
it('has validation elements that respect `feedback-aria-live` prop', async () => {
|
|
354
|
-
const wrapper = mount(BFormGroup, {
|
|
355
|
-
propsData: {
|
|
356
|
-
id: 'group-id',
|
|
357
|
-
label: 'test',
|
|
358
|
-
labelFor: 'input-id',
|
|
359
|
-
invalidFeedback: 'bar',
|
|
360
|
-
validFeedback: 'baz',
|
|
361
|
-
feedbackAriaLive: 'polite'
|
|
362
|
-
},
|
|
363
|
-
slots: {
|
|
364
|
-
default: '<input id="input-id" type="text">'
|
|
365
|
-
}
|
|
366
|
-
})
|
|
367
|
-
|
|
368
|
-
expect(wrapper.vm).toBeDefined()
|
|
369
|
-
await waitNT(wrapper.vm)
|
|
370
|
-
|
|
371
|
-
let $invalidFeedback = wrapper.find('.invalid-feedback')
|
|
372
|
-
expect($invalidFeedback.exists()).toBe(true)
|
|
373
|
-
expect($invalidFeedback.text()).toEqual('bar')
|
|
374
|
-
expect($invalidFeedback.attributes('aria-live')).toEqual('polite')
|
|
375
|
-
expect($invalidFeedback.attributes('aria-atomic')).toEqual('true')
|
|
376
|
-
|
|
377
|
-
let $validFeedback = wrapper.find('.valid-feedback')
|
|
378
|
-
expect($validFeedback.exists()).toBe(true)
|
|
379
|
-
expect($validFeedback.text()).toEqual('baz')
|
|
380
|
-
expect($validFeedback.attributes('aria-live')).toEqual('polite')
|
|
381
|
-
expect($validFeedback.attributes('aria-atomic')).toEqual('true')
|
|
382
|
-
|
|
383
|
-
await wrapper.setProps({ feedbackAriaLive: null })
|
|
384
|
-
|
|
385
|
-
$invalidFeedback = wrapper.find('.invalid-feedback')
|
|
386
|
-
expect($invalidFeedback.exists()).toBe(true)
|
|
387
|
-
expect($invalidFeedback.text()).toEqual('bar')
|
|
388
|
-
expect($invalidFeedback.attributes('role')).toBeUndefined()
|
|
389
|
-
expect($invalidFeedback.attributes('aria-live')).toBeUndefined()
|
|
390
|
-
expect($invalidFeedback.attributes('aria-atomic')).toBeUndefined()
|
|
391
|
-
|
|
392
|
-
$validFeedback = wrapper.find('.valid-feedback')
|
|
393
|
-
expect($validFeedback.exists()).toBe(true)
|
|
394
|
-
expect($validFeedback.text()).toEqual('baz')
|
|
395
|
-
expect($validFeedback.attributes('role')).toBeUndefined()
|
|
396
|
-
expect($validFeedback.attributes('aria-live')).toBeUndefined()
|
|
397
|
-
expect($validFeedback.attributes('aria-atomic')).toBeUndefined()
|
|
398
|
-
})
|
|
399
|
-
|
|
400
|
-
it('aligns the LABEL based on `label-align` props', async () => {
|
|
401
|
-
const wrapper = mount(BFormGroup, {
|
|
402
|
-
propsData: {
|
|
403
|
-
id: 'group-id',
|
|
404
|
-
label: 'test',
|
|
405
|
-
labelFor: 'input-id',
|
|
406
|
-
labelAlign: 'left',
|
|
407
|
-
labelAlignMd: 'center',
|
|
408
|
-
labelAlignXl: 'right'
|
|
409
|
-
},
|
|
410
|
-
slots: {
|
|
411
|
-
default: '<input id="input-id" type="text">'
|
|
412
|
-
}
|
|
413
|
-
})
|
|
414
|
-
|
|
415
|
-
expect(wrapper.vm).toBeDefined()
|
|
416
|
-
await waitNT(wrapper.vm)
|
|
417
|
-
|
|
418
|
-
const $label = wrapper.find('label')
|
|
419
|
-
expect($label.exists()).toBe(true)
|
|
420
|
-
expect($label.classes()).toContain('text-left')
|
|
421
|
-
expect($label.classes()).toContain('text-md-center')
|
|
422
|
-
expect($label.classes()).toContain('text-xl-right')
|
|
423
|
-
|
|
424
|
-
wrapper.destroy()
|
|
425
|
-
})
|
|
426
|
-
|
|
427
|
-
it('Label gl-sr-only works', async () => {
|
|
428
|
-
const wrapper = mount(BFormGroup, {
|
|
429
|
-
propsData: {
|
|
430
|
-
id: 'group-id',
|
|
431
|
-
label: 'test',
|
|
432
|
-
labelFor: 'input-id',
|
|
433
|
-
labelSrOnly: true
|
|
434
|
-
},
|
|
435
|
-
slots: {
|
|
436
|
-
default: '<input id="input-id" type="text">'
|
|
437
|
-
}
|
|
438
|
-
})
|
|
439
|
-
|
|
440
|
-
expect(wrapper.vm).toBeDefined()
|
|
441
|
-
await waitNT(wrapper.vm)
|
|
442
|
-
|
|
443
|
-
const $label = wrapper.find('label')
|
|
444
|
-
expect($label.exists()).toBe(true)
|
|
445
|
-
expect($label.classes()).toContain('gl-sr-only')
|
|
446
|
-
expect($label.text()).toEqual('test')
|
|
447
|
-
})
|
|
448
|
-
|
|
449
|
-
it('clicking legend focuses input', async () => {
|
|
450
|
-
const wrapper = mount(BFormGroup, {
|
|
451
|
-
attachTo: document.body,
|
|
452
|
-
propsData: {
|
|
453
|
-
id: 'group-id',
|
|
454
|
-
label: 'test'
|
|
455
|
-
},
|
|
456
|
-
slots: {
|
|
457
|
-
default: '<input id="input-id" type="text">'
|
|
458
|
-
}
|
|
459
|
-
})
|
|
460
|
-
|
|
461
|
-
expect(wrapper.vm).toBeDefined()
|
|
462
|
-
await waitNT(wrapper.vm)
|
|
463
|
-
|
|
464
|
-
const $legend = wrapper.find('legend')
|
|
465
|
-
const $input = wrapper.find('input')
|
|
466
|
-
expect($legend.exists()).toBe(true)
|
|
467
|
-
expect($input.exists()).toBe(true)
|
|
468
|
-
|
|
469
|
-
expect(document.activeElement).not.toBe($input.element)
|
|
470
|
-
expect(document.activeElement).not.toBe($legend.element)
|
|
471
|
-
|
|
472
|
-
await $legend.trigger('click')
|
|
473
|
-
expect(document.activeElement).toBe($input.element)
|
|
474
|
-
|
|
475
|
-
wrapper.destroy()
|
|
476
|
-
})
|
|
477
|
-
})
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bootstrap-vue/form-group",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"meta": {
|
|
5
|
-
"title": "Form Group",
|
|
6
|
-
"description": "Easily add some structure to forms. Its purpose is to pair form controls with a legend or label, and to provide help text and invalid/valid feedback text, as well as visual (color) contextual state feedback.",
|
|
7
|
-
"components": [
|
|
8
|
-
{
|
|
9
|
-
"component": "BFormGroup",
|
|
10
|
-
"alias": [
|
|
11
|
-
"BFormFieldset"
|
|
12
|
-
],
|
|
13
|
-
"props": [
|
|
14
|
-
{
|
|
15
|
-
"prop": "contentCols",
|
|
16
|
-
"version": "2.21.0",
|
|
17
|
-
"description": "Number of columns for the content width 'xs' screens and up"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"prop": "contentColsLg",
|
|
21
|
-
"version": "2.21.0",
|
|
22
|
-
"description": "Number of columns for the content width 'lg' screens and up"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"prop": "contentColsMd",
|
|
26
|
-
"version": "2.21.0",
|
|
27
|
-
"description": "Number of columns for the content width 'md' screens and up"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"prop": "contentColsSm",
|
|
31
|
-
"version": "2.21.0",
|
|
32
|
-
"description": "Number of columns for the content width 'sm' screens and up"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"prop": "contentColsXl",
|
|
36
|
-
"version": "2.21.0",
|
|
37
|
-
"description": "Number of columns for the content width 'xl' screens and up"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"prop": "description",
|
|
41
|
-
"description": "Text to place in the help text area of the form group"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"prop": "disabled",
|
|
45
|
-
"description": "Disabled the fieldset element, which in turn disables the form controls (on browsers that support disabled fieldsets). Has no effect if `label-for` is set"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"prop": "feedbackAriaLive",
|
|
49
|
-
"description": "Value to use for the `aria-live` attribute on the feedback text"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"prop": "invalidFeedback",
|
|
53
|
-
"description": "Text to show when the form group has an invalid state"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"prop": "label",
|
|
57
|
-
"description": "Text to place in the label/legend of the form group"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"prop": "labelAlign",
|
|
61
|
-
"description": "Text alignment 'left', 'center', 'right' for the label 'xs' screens and up"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"prop": "labelAlignLg",
|
|
65
|
-
"description": "Text alignment 'left', 'center', 'right' for the label 'lg' screens and up"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"prop": "labelAlignMd",
|
|
69
|
-
"description": "Text alignment 'left', 'center', 'right' for the label 'md' screens and up"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"prop": "labelAlignSm",
|
|
73
|
-
"description": "Text alignment 'left', 'center', 'right' for the label 'sm' screens and up"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"prop": "labelAlignXl",
|
|
77
|
-
"description": "Text alignment 'left', 'center', 'right' for the label 'xl' screens and up"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"prop": "labelClass",
|
|
81
|
-
"description": "CSS class (or classes) to add to the label/legend element"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"prop": "labelCols",
|
|
85
|
-
"description": "Number of columns for the label width 'xs' screens and up"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"prop": "labelColsLg",
|
|
89
|
-
"description": "Number of columns for the label width 'lg' screens and up"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"prop": "labelColsMd",
|
|
93
|
-
"description": "Number of columns for the label width 'md' screens and up"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"prop": "labelColsSm",
|
|
97
|
-
"description": "Number of columns for the label width 'sm' screens and up"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"prop": "labelColsXl",
|
|
101
|
-
"description": "Number of columns for the label width 'xl' screens and up"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"prop": "labelFor",
|
|
105
|
-
"description": "Set to the ID of the singular form control in the form group. Do not set a value if there is more than one form control in the group"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"prop": "labelSize",
|
|
109
|
-
"description": "Sets the text size of the label: 'sm', 'md' (default) or 'lg'. Use this prop to have the label size match the form control size"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"prop": "labelSrOnly",
|
|
113
|
-
"description": "Visually hides the label content, but makes it available to screen reader users"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"prop": "state",
|
|
117
|
-
"description": "Controls the validation state of the feedback. `true` force shows valid-feedback, `false` force shows invalid feedback, `null` does not force show the feedback"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"prop": "tooltip",
|
|
121
|
-
"description": "Renders the feedback text in a rudimentary tooltip style"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"prop": "validFeedback",
|
|
125
|
-
"description": "Text to show when the form group has a valid state"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"prop": "validated",
|
|
129
|
-
"description": "When set, adds the Bootstrap validation trigger class 'was-validated' on the component"
|
|
130
|
-
}
|
|
131
|
-
],
|
|
132
|
-
"slots": [
|
|
133
|
-
{
|
|
134
|
-
"name": "default",
|
|
135
|
-
"description": "Content to place in the form group",
|
|
136
|
-
"scope": [
|
|
137
|
-
{
|
|
138
|
-
"prop": "ariaDescribedby",
|
|
139
|
-
"type": "String",
|
|
140
|
-
"version": "2.21.0",
|
|
141
|
-
"description": "The value for the `aria-describedby` attribute for input elements in the form group. Will be auto-assigned when `label-for` prop is given"
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"prop": "id",
|
|
145
|
-
"type": "String",
|
|
146
|
-
"version": "2.21.0",
|
|
147
|
-
"description": "The ID of the form group. Will equal `id` prop, when provided"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
"prop": "descriptionId",
|
|
151
|
-
"type": "String",
|
|
152
|
-
"version": "2.21.0",
|
|
153
|
-
"description": "The ID of the description element. Will be `null` when no description content given"
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
"prop": "labelId",
|
|
157
|
-
"type": "String",
|
|
158
|
-
"version": "2.21.0",
|
|
159
|
-
"description": "The ID of the label element. Will be `null` when no description content given"
|
|
160
|
-
}
|
|
161
|
-
]
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
"name": "description",
|
|
165
|
-
"description": "Content to place in the description area. Overrides the `description` prop"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"name": "invalid-feedback",
|
|
169
|
-
"description": "Content to place in the invalid feedback area. Overrides the `invalid-feedback` prop"
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
"name": "label",
|
|
173
|
-
"description": "Content to place inside the label element. Overrides the `label` prop"
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"name": "valid-feedback",
|
|
177
|
-
"description": "Content to place in the valid feedback area. Overrides the `valid-feedback` prop"
|
|
178
|
-
}
|
|
179
|
-
]
|
|
180
|
-
}
|
|
181
|
-
]
|
|
182
|
-
}
|
|
183
|
-
}
|