@@ -253,6 +253,43 @@ describe('form-group', () => {
253
253
wrapper . destroy ( )
254
254
} )
255
255
256
+ it ( 'horizontal layout without label content has expected structure' , async ( ) => {
257
+ const wrapper = mount ( BFormGroup , {
258
+ propsData : {
259
+ labelCols : 1
260
+ } ,
261
+ slots : {
262
+ default : '<input id="input-id" type="text">'
263
+ }
264
+ } )
265
+
266
+ expect ( wrapper . vm ) . toBeDefined ( )
267
+
268
+ // Auto ID is created after mounted
269
+ await waitNT ( wrapper . vm )
270
+
271
+ expect ( wrapper . element . tagName ) . toBe ( 'FIELDSET' )
272
+ expect ( wrapper . element . tagName ) . not . toBe ( 'DIV' )
273
+ expect ( wrapper . find ( 'legend' ) . exists ( ) ) . toBe ( true )
274
+ expect ( wrapper . find ( 'fieldset > div > legend' ) . exists ( ) ) . toBe ( true )
275
+ expect ( wrapper . classes ( ) ) . toContain ( 'form-group' )
276
+ expect ( wrapper . classes ( ) . length ) . toBe ( 1 )
277
+ expect ( wrapper . attributes ( 'role' ) ) . not . toBeDefined ( )
278
+ expect ( wrapper . attributes ( 'aria-labelledby' ) ) . not . toBeDefined ( )
279
+ expect ( wrapper . find ( 'legend' ) . classes ( ) ) . toContain ( 'col-form-label' )
280
+ expect ( wrapper . find ( 'legend' ) . classes ( ) ) . toContain ( 'col-1' )
281
+ expect ( wrapper . find ( 'legend' ) . classes ( ) ) . toContain ( 'bv-no-focus-ring' )
282
+ expect ( wrapper . find ( 'legend' ) . text ( ) ) . toEqual ( '' )
283
+ expect ( wrapper . find ( 'fieldset > div > div' ) . exists ( ) ) . toBe ( true )
284
+ expect ( wrapper . find ( 'fieldset > div > div' ) . classes ( ) ) . toContain ( 'col' )
285
+ expect ( wrapper . find ( 'fieldset > div > div' ) . classes ( ) ) . toContain ( 'bv-no-focus-ring' )
286
+ expect ( wrapper . find ( 'fieldset > div > div' ) . classes ( ) . length ) . toBe ( 2 )
287
+ expect ( wrapper . find ( 'fieldset > div > div' ) . attributes ( 'role' ) ) . toEqual ( 'group' )
288
+ expect ( wrapper . find ( 'fieldset > div > div' ) . attributes ( 'tabindex' ) ) . toEqual ( '-1' )
289
+
290
+ wrapper . destroy ( )
291
+ } )
292
+
256
293
it ( 'validation and help text works' , async ( ) => {
257
294
const wrapper = mount ( BFormGroup , {
258
295
propsData : {
0 commit comments