@@ -32,7 +32,10 @@ const App = {
32
32
h (
33
33
BPopover ,
34
34
{
35
- attrs : { id : 'bar' } ,
35
+ attrs : {
36
+ id : 'bar' ,
37
+ 'data-foo' : 'bar'
38
+ } ,
36
39
props : {
37
40
target : 'foo' ,
38
41
triggers : this . triggers ,
@@ -156,20 +159,22 @@ describe('b-popover', () => {
156
159
expect ( $button . attributes ( 'id' ) ) . toEqual ( 'foo' )
157
160
expect ( $button . attributes ( 'data-original-title' ) ) . not . toBeDefined ( )
158
161
// ID of the tooltip that will be in the body
159
- const adb = $button . attributes ( 'aria-describedby' )
162
+ const $ adb = $button . attributes ( 'aria-describedby' )
160
163
161
164
// <b-popover> wrapper
162
165
const $tipHolder = wrapper . findComponent ( BPopover )
163
166
expect ( $tipHolder . exists ( ) ) . toBe ( true )
164
167
expect ( $tipHolder . element . nodeType ) . toEqual ( Node . COMMENT_NODE )
165
168
166
169
// Find the popover element in the document
167
- const tip = document . getElementById ( adb )
168
- expect ( tip ) . not . toBe ( null )
169
- expect ( tip ) . toBeInstanceOf ( HTMLElement )
170
- expect ( tip . tagName ) . toEqual ( 'DIV' )
171
- expect ( tip . classList . contains ( 'popover' ) ) . toBe ( true )
172
- expect ( tip . classList . contains ( 'b-popover' ) ) . toBe ( true )
170
+ const $tip = document . getElementById ( $adb )
171
+ expect ( $tip ) . not . toBe ( null )
172
+ expect ( $tip ) . toBeInstanceOf ( HTMLElement )
173
+ expect ( $tip . tagName ) . toEqual ( 'DIV' )
174
+ expect ( $tip . getAttribute ( 'id' ) ) . toEqual ( 'bar' )
175
+ expect ( $tip . getAttribute ( 'data-foo' ) ) . toEqual ( 'bar' )
176
+ expect ( $tip . classList . contains ( 'popover' ) ) . toBe ( true )
177
+ expect ( $tip . classList . contains ( 'b-popover' ) ) . toBe ( true )
173
178
174
179
// Hide the Popover
175
180
await wrapper . setProps ( {
@@ -184,8 +189,8 @@ describe('b-popover', () => {
184
189
expect ( $button . attributes ( 'aria-describedby' ) ) . not . toBeDefined ( )
185
190
186
191
// Popover element should not be in the document
187
- expect ( document . body . contains ( tip ) ) . toBe ( false )
188
- expect ( document . getElementById ( adb ) ) . toBe ( null )
192
+ expect ( document . body . contains ( $ tip) ) . toBe ( false )
193
+ expect ( document . getElementById ( $ adb) ) . toBe ( null )
189
194
190
195
wrapper . destroy ( )
191
196
} )
0 commit comments