@@ -27,7 +27,10 @@ describe('Test removal of gl contexts', function() {
2727 gd = createGraphDiv ( ) ;
2828 } ) ;
2929
30- afterEach ( destroyGraphDiv ) ;
30+ afterEach ( function ( ) {
31+ Plotly . purge ( gd ) ;
32+ destroyGraphDiv ( ) ;
33+ } ) ;
3134
3235 it ( '@gl Plots.cleanPlot should remove gl context from the graph div of a gl2d plot' , function ( done ) {
3336 Plotly . plot ( gd , [ {
@@ -41,6 +44,7 @@ describe('Test removal of gl contexts', function() {
4144
4245 expect ( ! ! gd . _fullLayout . _plots . xy . _scene ) . toBe ( false ) ;
4346 } )
47+ . catch ( failTest )
4448 . then ( done ) ;
4549 } ) ;
4650
@@ -83,6 +87,7 @@ describe('Test removal of gl contexts', function() {
8387 firstCanvas !== secondCanvas && firstGlContext . isContextLost ( )
8488 ) ;
8589 } )
90+ . catch ( failTest )
8691 . then ( done ) ;
8792 } ) ;
8893} ) ;
@@ -94,9 +99,10 @@ describe('Test gl plot side effects', function() {
9499 gd = createGraphDiv ( ) ;
95100 } ) ;
96101
97- afterEach ( function ( ) {
102+ afterEach ( function ( done ) {
98103 Plotly . purge ( gd ) ;
99104 destroyGraphDiv ( ) ;
105+ setTimeout ( done , 1000 ) ;
100106 } ) ;
101107
102108 it ( '@gl should not draw the rangeslider' , function ( done ) {
@@ -118,6 +124,7 @@ describe('Test gl plot side effects', function() {
118124 var rangeSlider = document . getElementsByClassName ( 'range-slider' ) [ 0 ] ;
119125 expect ( rangeSlider ) . not . toBeDefined ( ) ;
120126 } )
127+ . catch ( failTest )
121128 . then ( done ) ;
122129 } ) ;
123130
@@ -160,11 +167,12 @@ describe('Test gl plot side effects', function() {
160167
161168 return Plotly . purge ( gd ) ;
162169 } )
170+ . catch ( failTest )
163171 . then ( done ) ;
164172 } ) ;
165173
166174 it ( '@gl should be able to switch trace type' , function ( done ) {
167- Plotly . newPlot ( gd , [ {
175+ Plotly . plot ( gd , [ {
168176 type : 'parcoords' ,
169177 x : [ 1 , 2 , 3 ] ,
170178 y : [ 2 , 1 , 2 ] ,
@@ -184,6 +192,7 @@ describe('Test gl plot side effects', function() {
184192 . then ( function ( ) {
185193 expect ( d3 . selectAll ( 'canvas' ) . size ( ) ) . toEqual ( 0 ) ;
186194 } )
195+ . catch ( failTest )
187196 . then ( done ) ;
188197 } ) ;
189198
@@ -197,7 +206,7 @@ describe('Test gl plot side effects', function() {
197206 . then ( function ( ) {
198207 expect ( gd . querySelector ( '.gl-canvas-context' ) . width ) . toBe ( 600 ) ;
199208
200- Plotly . relayout ( gd , { width : 300 } ) ;
209+ return Plotly . relayout ( gd , { width : 300 } ) ;
201210 } )
202211 . then ( function ( ) {
203212 expect ( gd . querySelector ( '.gl-canvas-context' ) . width ) . toBe ( 300 ) ;
@@ -216,9 +225,10 @@ describe('Test gl2d plots', function() {
216225 gd = createGraphDiv ( ) ;
217226 } ) ;
218227
219- afterEach ( function ( ) {
228+ afterEach ( function ( done ) {
220229 Plotly . purge ( gd ) ;
221230 destroyGraphDiv ( ) ;
231+ setTimeout ( done , 1000 ) ;
222232 } ) ;
223233
224234 function mouseTo ( p0 , p1 ) {
0 commit comments