@@ -3,7 +3,7 @@ var Registry = require('@src/registry');
3
3
var Plots = Plotly . Plots ;
4
4
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
5
5
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
6
- var fail = require ( '../assets/fail_test' ) ;
6
+ var failTest = require ( '../assets/fail_test' ) ;
7
7
var Lib = require ( '@src/lib' ) ;
8
8
9
9
describe ( 'Plots.executeAPICommand' , function ( ) {
@@ -34,7 +34,9 @@ describe('Plots.executeAPICommand', function() {
34
34
expect ( m . calls . argsFor ( 0 ) ) . toEqual ( [ gd , 'foo' , 'bar' ] ) ;
35
35
36
36
expect ( value ) . toEqual ( 'resolution' ) ;
37
- } ) . catch ( fail ) . then ( done ) ;
37
+ } )
38
+ . catch ( failTest )
39
+ . then ( done ) ;
38
40
} ) ;
39
41
40
42
} ) ;
@@ -47,22 +49,24 @@ describe('Plots.executeAPICommand', function() {
47
49
} ) ;
48
50
49
51
it ( 'calls the API method and rejects' , function ( done ) {
50
- Plots . executeAPICommand ( gd , 'restyle' , [ 'foo' , 'bar' ] ) . then ( fail , function ( value ) {
52
+ Plots . executeAPICommand ( gd , 'restyle' , [ 'foo' , 'bar' ] ) . then ( failTest , function ( value ) {
51
53
var m = Registry . apiMethodRegistry . restyle ;
52
54
expect ( m ) . toHaveBeenCalled ( ) ;
53
55
expect ( m . calls . count ( ) ) . toEqual ( 1 ) ;
54
56
expect ( m . calls . argsFor ( 0 ) ) . toEqual ( [ gd , 'foo' , 'bar' ] ) ;
55
57
56
58
expect ( value ) . toEqual ( 'rejection' ) ;
57
- } ) . catch ( fail ) . then ( done ) ;
59
+ } )
60
+ . catch ( failTest )
61
+ . then ( done ) ;
58
62
} ) ;
59
63
60
64
} ) ;
61
65
62
66
describe ( 'with the skip command' , function ( ) {
63
67
it ( 'resolves immediately' , function ( done ) {
64
68
Plots . executeAPICommand ( gd , 'skip' )
65
- . catch ( fail ) . then ( done ) ;
69
+ . catch ( failTest ) . then ( done ) ;
66
70
} ) ;
67
71
} ) ;
68
72
} ) ;
@@ -514,7 +518,9 @@ describe('component bindings', function() {
514
518
return Plotly . restyle ( gd , 'marker.width' , 8 ) ;
515
519
} ) . then ( function ( ) {
516
520
expect ( count ) . toEqual ( 1 ) ;
517
- } ) . catch ( fail ) . then ( done ) ;
521
+ } )
522
+ . catch ( failTest )
523
+ . then ( done ) ;
518
524
} ) ;
519
525
520
526
it ( 'logs a warning if unable to create an observer' , function ( ) {
@@ -536,15 +542,19 @@ describe('component bindings', function() {
536
542
537
543
Plotly . restyle ( gd , 'marker.color' , 'blue' ) . then ( function ( ) {
538
544
expect ( gd . layout . sliders [ 0 ] . active ) . toBe ( 4 ) ;
539
- } ) . catch ( fail ) . then ( done ) ;
545
+ } )
546
+ . catch ( failTest )
547
+ . then ( done ) ;
540
548
} ) ;
541
549
542
550
it ( 'does not update the component if the value is not present' , function ( done ) {
543
551
expect ( gd . layout . sliders [ 0 ] . active ) . toBe ( 0 ) ;
544
552
545
553
Plotly . restyle ( gd , 'marker.color' , 'black' ) . then ( function ( ) {
546
554
expect ( gd . layout . sliders [ 0 ] . active ) . toBe ( 0 ) ;
547
- } ) . catch ( fail ) . then ( done ) ;
555
+ } )
556
+ . catch ( failTest )
557
+ . then ( done ) ;
548
558
} ) ;
549
559
550
560
it ( 'udpates bound components when the computed value changes' , function ( done ) {
@@ -555,7 +565,9 @@ describe('component bindings', function() {
555
565
// nonetheless is bound by value to the component.
556
566
Plotly . restyle ( gd , 'line.color' , 'blue' ) . then ( function ( ) {
557
567
expect ( gd . layout . sliders [ 0 ] . active ) . toBe ( 4 ) ;
558
- } ) . catch ( fail ) . then ( done ) ;
568
+ } )
569
+ . catch ( failTest )
570
+ . then ( done ) ;
559
571
} ) ;
560
572
} ) ;
561
573
@@ -623,7 +635,9 @@ describe('attaching component bindings', function() {
623
635
// Bindings are no longer simple, so check to ensure they have
624
636
// been removed
625
637
expect ( gd . _internalEv . _events . plotly_animatingframe ) . toBeUndefined ( ) ;
626
- } ) . catch ( fail ) . then ( done ) ;
638
+ } )
639
+ . catch ( failTest )
640
+ . then ( done ) ;
627
641
} ) ;
628
642
629
643
it ( 'attaches and updates bindings for updatemenus' , function ( done ) {
@@ -676,6 +690,8 @@ describe('attaching component bindings', function() {
676
690
// Bindings are no longer simple, so check to ensure they have
677
691
// been removed
678
692
expect ( gd . _internalEv . _events . plotly_animatingframe ) . toBeUndefined ( ) ;
679
- } ) . catch ( fail ) . then ( done ) ;
693
+ } )
694
+ . catch ( failTest )
695
+ . then ( done ) ;
680
696
} ) ;
681
697
} ) ;
0 commit comments