@@ -5,6 +5,7 @@ var Lib = require('@src/lib');
5
5
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
6
6
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
7
7
var customAssertions = require ( '../assets/custom_assertions' ) ;
8
+ var failTest = require ( '../assets/fail_test' ) ;
8
9
9
10
var assertDims = customAssertions . assertDims ;
10
11
var assertStyle = customAssertions . assertStyle ;
@@ -72,9 +73,9 @@ describe('groupby', function() {
72
73
expect ( gd . _fullData [ 1 ] . transforms [ 0 ] . _indexToPoints ) . toEqual ( { 0 : [ 2 ] , 1 : [ 4 ] , 2 : [ 5 ] } ) ;
73
74
74
75
assertDims ( [ 4 , 3 ] ) ;
75
-
76
- done ( ) ;
77
- } ) ;
76
+ } )
77
+ . catch ( failTest )
78
+ . then ( done ) ;
78
79
} ) ;
79
80
80
81
it ( 'Accepts deprecated object notation for styles' , function ( done ) {
@@ -122,7 +123,9 @@ describe('groupby', function() {
122
123
123
124
expect ( gd . _fullData [ 0 ] . marker . opacity ) . toEqual ( 1 ) ;
124
125
expect ( gd . _fullData [ 1 ] . marker . opacity ) . toEqual ( 1 ) ;
125
- } ) . then ( done ) ;
126
+ } )
127
+ . catch ( failTest )
128
+ . then ( done ) ;
126
129
127
130
// The final test for restyle updates using deprecated syntax
128
131
// is ommitted since old style syntax is *only* sanitized on
@@ -174,9 +177,9 @@ describe('groupby', function() {
174
177
[ 'rgb(0, 128, 0)' , 'rgb(255, 0, 0)' ] ,
175
178
[ 0.4 , 0.4 ]
176
179
) ;
177
-
178
- done ( ) ;
179
- } ) ;
180
+ } )
181
+ . catch ( failTest )
182
+ . then ( done ) ;
180
183
} ) ;
181
184
182
185
it ( 'Plotly.extendTraces should work' , function ( done ) {
@@ -202,9 +205,9 @@ describe('groupby', function() {
202
205
expect ( gd . _fullData [ 1 ] . x . length ) . toEqual ( 5 ) ;
203
206
204
207
assertDims ( [ 5 , 5 ] ) ;
205
-
206
- done ( ) ;
207
- } ) ;
208
+ } )
209
+ . catch ( failTest )
210
+ . then ( done ) ;
208
211
} ) ;
209
212
210
213
it ( 'Plotly.deleteTraces should work' , function ( done ) {
@@ -222,9 +225,9 @@ describe('groupby', function() {
222
225
return Plotly . deleteTraces ( gd , [ 0 ] ) ;
223
226
} ) . then ( function ( ) {
224
227
assertDims ( [ ] ) ;
225
-
226
- done ( ) ;
227
- } ) ;
228
+ } )
229
+ . catch ( failTest )
230
+ . then ( done ) ;
228
231
} ) ;
229
232
230
233
it ( 'toggling trace visibility should work' , function ( done ) {
@@ -246,9 +249,9 @@ describe('groupby', function() {
246
249
return Plotly . restyle ( gd , 'visible' , [ true , true ] , [ 0 , 1 ] ) ;
247
250
} ) . then ( function ( ) {
248
251
assertDims ( [ 4 , 3 , 4 , 3 ] ) ;
249
-
250
- done ( ) ;
251
- } ) ;
252
+ } )
253
+ . catch ( failTest )
254
+ . then ( done ) ;
252
255
} ) ;
253
256
} ) ;
254
257
@@ -359,9 +362,9 @@ describe('groupby', function() {
359
362
expect ( gd . _fullData [ 1 ] . y ) . toEqual ( [ 3 , 2 , 3 ] ) ;
360
363
361
364
assertDims ( [ 4 , 3 ] ) ;
362
-
363
- done ( ) ;
364
- } ) ;
365
+ } )
366
+ . catch ( failTest )
367
+ . then ( done ) ;
365
368
} ) ;
366
369
367
370
it ( 'Plotly.plot should plot the transform traces' , function ( done ) {
@@ -376,9 +379,9 @@ describe('groupby', function() {
376
379
377
380
expect ( gd . _fullData . length ) . toEqual ( 1 ) ;
378
381
assertDims ( [ 7 ] ) ;
379
-
380
- done ( ) ;
381
- } ) ;
382
+ } )
383
+ . catch ( failTest )
384
+ . then ( done ) ;
382
385
} ) ;
383
386
384
387
it ( 'Plotly.plot should plot the transform traces' , function ( done ) {
@@ -396,9 +399,9 @@ describe('groupby', function() {
396
399
expect ( gd . _fullData [ 0 ] . y ) . toEqual ( [ 1 , 2 , 3 , 1 , 2 , 3 , 1 ] ) ;
397
400
398
401
assertDims ( [ 7 ] ) ;
399
-
400
- done ( ) ;
401
- } ) ;
402
+ } )
403
+ . catch ( failTest )
404
+ . then ( done ) ;
402
405
} ) ;
403
406
404
407
it ( 'Plotly.plot should plot the transform traces' , function ( done ) {
@@ -417,9 +420,9 @@ describe('groupby', function() {
417
420
expect ( gd . _fullData [ 0 ] . y ) . toEqual ( [ 1 , 2 , 3 , 1 , 2 , 3 , 1 ] ) ;
418
421
419
422
assertDims ( [ 7 ] ) ;
420
-
421
- done ( ) ;
422
- } ) ;
423
+ } )
424
+ . catch ( failTest )
425
+ . then ( done ) ;
423
426
} ) ;
424
427
425
428
it ( 'Plotly.plot should plot the transform traces' , function ( done ) {
@@ -438,9 +441,9 @@ describe('groupby', function() {
438
441
expect ( gd . _fullData [ 0 ] . y ) . toEqual ( [ 1 , 2 , 3 , 1 , 2 , 3 , 1 ] ) ;
439
442
440
443
assertDims ( [ 7 ] ) ;
441
-
442
- done ( ) ;
443
- } ) ;
444
+ } )
445
+ . catch ( failTest )
446
+ . then ( done ) ;
444
447
} ) ;
445
448
} ) ;
446
449
@@ -478,9 +481,9 @@ describe('groupby', function() {
478
481
expect ( gd . _fullData [ 1 ] . marker . line . width ) . toEqual ( [ 4 , 2 , 3 ] ) ;
479
482
480
483
assertDims ( [ 4 , 3 ] ) ;
481
-
482
- done ( ) ;
483
- } ) ;
484
+ } )
485
+ . catch ( failTest )
486
+ . then ( done ) ;
484
487
} ;
485
488
}
486
489
@@ -611,8 +614,9 @@ describe('groupby', function() {
611
614
Plotly . plot ( gd , data ) . then ( function ( ) {
612
615
expect ( gd . _fullData [ 0 ] . marker . line . color ) . toEqual ( [ 'orange' , 'red' , 'cyan' , 'pink' ] ) ;
613
616
expect ( gd . _fullData [ 1 ] . marker . line . color ) . toEqual ( 'yellow' ) ;
614
- done ( ) ;
615
- } ) ;
617
+ } )
618
+ . catch ( failTest )
619
+ . then ( done ) ;
616
620
} ) ;
617
621
618
622
it ( 'passes with no explicit styling for the individual group' , test ( mockData4 ) ) ;
@@ -649,9 +653,9 @@ describe('groupby', function() {
649
653
expect ( gd . _fullData [ 0 ] . marker . line . width ) . toEqual ( [ 4 , 2 , 4 , 2 , 2 , 3 , 3 ] ) ;
650
654
651
655
assertDims ( [ 7 ] ) ;
652
-
653
- done ( ) ;
654
- } ) ;
656
+ } )
657
+ . catch ( failTest )
658
+ . then ( done ) ;
655
659
} ;
656
660
}
657
661
0 commit comments