@@ -39,9 +39,7 @@ describe('form-group', () => {
39
39
expect ( wrapper . find ( 'label' ) . exists ( ) ) . toBe ( false )
40
40
expect ( wrapper . find ( 'legend' ) . exists ( ) ) . toBe ( false )
41
41
expect ( wrapper . find ( 'div' ) . exists ( ) ) . toBe ( true )
42
- expect ( wrapper . find ( 'div' ) . attributes ( 'role' ) ) . toBeDefined ( )
43
42
expect ( wrapper . find ( 'div' ) . attributes ( 'role' ) ) . toEqual ( 'group' )
44
- expect ( wrapper . find ( 'div' ) . attributes ( 'tabindex' ) ) . toBeDefined ( )
45
43
expect ( wrapper . find ( 'div' ) . attributes ( 'tabindex' ) ) . toEqual ( '-1' )
46
44
expect ( wrapper . text ( ) ) . toEqual ( '' )
47
45
@@ -61,7 +59,6 @@ describe('form-group', () => {
61
59
await waitNT ( wrapper . vm )
62
60
63
61
expect ( wrapper . find ( 'div' ) . exists ( ) ) . toBe ( true )
64
- expect ( wrapper . find ( 'div' ) . attributes ( 'role' ) ) . toBeDefined ( )
65
62
expect ( wrapper . find ( 'div' ) . attributes ( 'role' ) ) . toEqual ( 'group' )
66
63
expect ( wrapper . find ( 'div[role="group"]' ) . text ( ) ) . toEqual ( 'foobar' )
67
64
expect ( wrapper . text ( ) ) . toEqual ( 'foobar' )
@@ -82,7 +79,6 @@ describe('form-group', () => {
82
79
} )
83
80
84
81
expect ( wrapper . vm ) . toBeDefined ( )
85
- expect ( wrapper . attributes ( 'id' ) ) . toBeDefined ( )
86
82
expect ( wrapper . attributes ( 'id' ) ) . toEqual ( 'foo' )
87
83
expect ( wrapper . attributes ( 'aria-labelledby' ) ) . not . toBeDefined ( )
88
84
expect ( wrapper . find ( 'label' ) . attributes ( 'id' ) ) . toEqual ( 'foo__BV_label_' )
@@ -106,31 +102,29 @@ describe('form-group', () => {
106
102
// Auto ID is created after mounted
107
103
await waitNT ( wrapper . vm )
108
104
105
+ const formGroupId = wrapper . attributes ( 'id' )
109
106
expect ( wrapper . element . tagName ) . not . toBe ( 'FIELDSET' )
110
107
expect ( wrapper . element . tagName ) . toBe ( 'DIV' )
111
108
expect ( wrapper . classes ( ) ) . toContain ( 'form-group' )
112
109
expect ( wrapper . classes ( ) . length ) . toBe ( 1 )
113
110
expect ( wrapper . attributes ( 'id' ) ) . toBeDefined ( )
114
- expect ( wrapper . attributes ( 'role' ) ) . toBeDefined ( )
115
111
expect ( wrapper . attributes ( 'role' ) ) . toEqual ( 'group' )
116
112
expect ( wrapper . attributes ( 'aria-labelledby' ) ) . not . toBeDefined ( )
117
113
expect ( wrapper . find ( 'legend' ) . exists ( ) ) . toBe ( false )
118
114
expect ( wrapper . find ( 'label' ) . exists ( ) ) . toBe ( true )
119
115
expect ( wrapper . find ( 'label' ) . classes ( ) ) . toContain ( 'd-block' )
120
116
expect ( wrapper . find ( 'label' ) . text ( ) ) . toEqual ( 'test' )
121
- expect ( wrapper . find ( 'label' ) . attributes ( 'for' ) ) . toBeDefined ( )
122
117
expect ( wrapper . find ( 'label' ) . attributes ( 'for' ) ) . toEqual ( 'input-id' )
123
118
expect ( wrapper . find ( 'div > div' ) . exists ( ) ) . toBe ( true )
124
119
expect ( wrapper . find ( 'div > div' ) . classes ( ) ) . toContain ( 'bv-no-focus-ring' )
125
120
expect ( wrapper . find ( 'div > div' ) . classes ( ) . length ) . toBe ( 1 )
126
121
expect ( wrapper . find ( 'div > div' ) . attributes ( 'role' ) ) . not . toBeDefined ( )
127
122
expect ( wrapper . find ( 'div > div' ) . attributes ( 'tabindex' ) ) . not . toBeDefined ( )
123
+ expect ( wrapper . find ( 'div > div' ) . attributes ( 'aria-labelledby' ) ) . not . toBeDefined ( )
128
124
expect ( wrapper . find ( 'div > div > input' ) . exists ( ) ) . toBe ( true )
129
125
expect ( wrapper . find ( 'div > div > input' ) . attributes ( 'aria-describedby' ) ) . not . toBeDefined ( )
130
126
expect ( wrapper . find ( 'div > div > input' ) . attributes ( 'aria-labelledby' ) ) . not . toBeDefined ( )
131
127
expect ( wrapper . find ( 'div > div' ) . text ( ) ) . toEqual ( '' )
132
- const formGroupId = wrapper . attributes ( 'id' )
133
- expect ( wrapper . find ( 'label' ) . attributes ( 'id' ) ) . toBeDefined ( )
134
128
expect ( wrapper . find ( 'label' ) . attributes ( 'id' ) ) . toEqual ( `${ formGroupId } __BV_label_` )
135
129
136
130
wrapper . destroy ( )
@@ -160,7 +154,6 @@ describe('form-group', () => {
160
154
expect ( wrapper . classes ( ) ) . toContain ( 'form-group' )
161
155
expect ( wrapper . classes ( ) ) . toContain ( 'form-row' )
162
156
expect ( wrapper . classes ( ) . length ) . toBe ( 2 )
163
- expect ( wrapper . attributes ( 'role' ) ) . toBeDefined ( )
164
157
expect ( wrapper . attributes ( 'role' ) ) . toEqual ( 'group' )
165
158
expect ( wrapper . attributes ( 'aria-labelledby' ) ) . not . toBeDefined ( )
166
159
expect ( wrapper . find ( 'label' ) . exists ( ) ) . toBe ( true )
@@ -176,6 +169,9 @@ describe('form-group', () => {
176
169
expect ( wrapper . find ( 'div > div' ) . classes ( ) ) . toContain ( 'col' )
177
170
expect ( wrapper . find ( 'div > div' ) . classes ( ) ) . toContain ( 'bv-no-focus-ring' )
178
171
expect ( wrapper . find ( 'div > div' ) . classes ( ) . length ) . toBe ( 2 )
172
+ expect ( wrapper . find ( 'div > div' ) . attributes ( 'role' ) ) . not . toBeDefined ( )
173
+ expect ( wrapper . find ( 'div > div' ) . attributes ( 'tabindex' ) ) . not . toBeDefined ( )
174
+ expect ( wrapper . find ( 'div > div' ) . attributes ( 'aria-labelledby' ) ) . not . toBeDefined ( )
179
175
180
176
wrapper . destroy ( )
181
177
} )
@@ -200,7 +196,6 @@ describe('form-group', () => {
200
196
201
197
const $input = wrapper . find ( 'input' )
202
198
expect ( $input . exists ( ) ) . toBe ( true )
203
- expect ( $input . attributes ( 'aria-describedby' ) ) . toBeDefined ( )
204
199
expect ( $input . attributes ( 'aria-describedby' ) ) . toEqual ( '/group-id__BV_description_' )
205
200
206
201
wrapper . destroy ( )
@@ -249,6 +244,7 @@ describe('form-group', () => {
249
244
expect ( wrapper . find ( 'fieldset > div > div' ) . classes ( ) . length ) . toBe ( 2 )
250
245
expect ( wrapper . find ( 'fieldset > div > div' ) . attributes ( 'role' ) ) . toEqual ( 'group' )
251
246
expect ( wrapper . find ( 'fieldset > div > div' ) . attributes ( 'tabindex' ) ) . toEqual ( '-1' )
247
+ expect ( wrapper . find ( 'fieldset > div > div' ) . attributes ( 'aria-labelledby' ) ) . toBeDefined ( )
252
248
253
249
wrapper . destroy ( )
254
250
} )
@@ -329,7 +325,6 @@ describe('form-group', () => {
329
325
330
326
const $input = wrapper . find ( 'input' )
331
327
expect ( $input . exists ( ) ) . toBe ( true )
332
- expect ( $input . attributes ( 'aria-describedby' ) ) . toBeDefined ( )
333
328
expect ( $input . attributes ( 'aria-describedby' ) ) . toEqual ( 'group-id__BV_description_' )
334
329
335
330
// With state = true, description and valid are visible
@@ -350,11 +345,9 @@ describe('form-group', () => {
350
345
state : false
351
346
} )
352
347
await waitNT ( wrapper . vm )
353
- expect ( $input . attributes ( 'aria-describedby' ) ) . toBeDefined ( )
354
348
expect ( $input . attributes ( 'aria-describedby' ) ) . toEqual (
355
349
'group-id__BV_description_ group-id__BV_feedback_invalid_'
356
350
)
357
- expect ( wrapper . attributes ( 'aria-invalid' ) ) . toBeDefined ( )
358
351
expect ( wrapper . attributes ( 'aria-invalid' ) ) . toEqual ( 'true' )
359
352
expect ( wrapper . classes ( ) ) . not . toContain ( 'is-valid' )
360
353
expect ( wrapper . classes ( ) ) . toContain ( 'is-invalid' )
0 commit comments