File tree Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -127,24 +127,26 @@ describe('Backdrop', () => {
127
127
} )
128
128
} )
129
129
} )
130
- } )
131
130
132
- it ( 'should not error if the backdrop no longer has a parent' , done => {
133
- const instance = new Backdrop ( {
134
- isVisible : true ,
135
- isAnimated : true
136
- } )
137
- const getElements = ( ) => document . querySelectorAll ( CLASS_BACKDROP )
131
+ it ( 'should not error if the backdrop no longer has a parent' , done => {
132
+ fixtureEl . innerHTML = '<div id="wrapper"></div>'
138
133
139
- instance . show ( ( ) => {
140
- instance . hide ( ( ) => {
141
- expect ( getElements ( ) . length ) . toEqual ( 0 )
134
+ const wrapper = fixtureEl . querySelector ( '#wrapper' )
135
+ const instance = new Backdrop ( {
136
+ isVisible : true ,
137
+ isAnimated : true ,
138
+ rootElement : wrapper
139
+ } )
142
140
143
- // replace the fixture, which was just wiped out
144
- fixtureEl = getFixture ( )
145
- done ( )
141
+ const getElements = ( ) => document . querySelectorAll ( CLASS_BACKDROP )
142
+
143
+ instance . show ( ( ) => {
144
+ wrapper . parentNode . removeChild ( wrapper )
145
+ instance . hide ( ( ) => {
146
+ expect ( getElements ( ) . length ) . toEqual ( 0 )
147
+ done ( )
148
+ } )
146
149
} )
147
- document . body . innerHTML = 'changed'
148
150
} )
149
151
} )
150
152
You can’t perform that action at this time.
0 commit comments