File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -129,4 +129,31 @@ describe('dropdown', () => {
129
129
130
130
wrapper . destroy ( )
131
131
} )
132
+
133
+ it ( 'has user supplied ID' , async ( ) => {
134
+ const wrapper = mount ( Dropdown , {
135
+ attachToDocument : true ,
136
+ propsData : {
137
+ id : 'test'
138
+ }
139
+ } )
140
+
141
+ expect ( wrapper . is ( 'div' ) ) . toBe ( true )
142
+ expect ( wrapper . isVueInstance ( ) ) . toBe ( true )
143
+
144
+ expect ( wrapper . attributes ( 'id' ) ) . toBeDefined ( )
145
+ expect ( wrapper . attributes ( 'id' ) ) . toEqual ( 'test' )
146
+ const wrapperId = wrapper . attributes ( 'id' )
147
+
148
+ expect ( wrapper . findAll ( 'button' ) . length ) . toBe ( 1 )
149
+ const $button = wrapper . find ( 'button' )
150
+ expect ( $button . attributes ( 'id' ) ) . toEqual ( `${ wrapperId } __BV_toggle_` )
151
+
152
+ expect ( wrapper . findAll ( '.dropdown-menu' ) . length ) . toBe ( 1 )
153
+ const $menu = wrapper . find ( '.dropdown-menu' )
154
+ expect ( $menu . attributes ( 'aria-labelledby' ) ) . toBeDefined ( )
155
+ expect ( $menu . attributes ( 'aria-labelledby' ) ) . toEqual ( `${ wrapperId } __BV_toggle_` )
156
+
157
+ wrapper . destroy ( )
158
+ } )
132
159
} )
You can’t perform that action at this time.
0 commit comments