@@ -9,6 +9,7 @@ var rgb = require('@src/components/color').rgb;
9
9
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
10
10
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
11
11
var mouseEvent = require ( '../assets/mouse_event' ) ;
12
+ var failTest = require ( '../assets/fail_test' ) ;
12
13
13
14
describe ( 'Plot title' , function ( ) {
14
15
'use strict' ;
@@ -47,7 +48,7 @@ describe('Plot title', function() {
47
48
. then ( function ( ) {
48
49
expectDefaultCenteredPosition ( gd ) ;
49
50
} )
50
- . catch ( fail )
51
+ . catch ( failTest )
51
52
. then ( done ) ;
52
53
} ) ;
53
54
@@ -57,7 +58,7 @@ describe('Plot title', function() {
57
58
expectTitle ( 'Plotly line chart' ) ;
58
59
expectDefaultCenteredPosition ( gd ) ;
59
60
} )
60
- . catch ( fail )
61
+ . catch ( failTest )
61
62
. then ( done ) ;
62
63
} ) ;
63
64
@@ -68,7 +69,7 @@ describe('Plot title', function() {
68
69
return Plotly . relayout ( gd , { title : { text : 'Some other title' } } ) ;
69
70
} )
70
71
. then ( expectTitleFn ( 'Some other title' ) )
71
- . catch ( fail )
72
+ . catch ( failTest )
72
73
. then ( done ) ;
73
74
} ) ;
74
75
@@ -92,7 +93,7 @@ describe('Plot title', function() {
92
93
. then ( function ( ) {
93
94
expectLeftEdgeAlignedTo ( testCase . selector ) ;
94
95
} )
95
- . catch ( fail )
96
+ . catch ( failTest )
96
97
. then ( done ) ;
97
98
} ) ;
98
99
@@ -105,7 +106,7 @@ describe('Plot title', function() {
105
106
. then ( function ( ) {
106
107
expectRightEdgeAlignedTo ( testCase . selector ) ;
107
108
} )
108
- . catch ( fail )
109
+ . catch ( failTest )
109
110
. then ( done ) ;
110
111
} ) ;
111
112
@@ -118,7 +119,7 @@ describe('Plot title', function() {
118
119
. then ( function ( ) {
119
120
expectCenteredWithin ( testCase . selector ) ;
120
121
} )
121
- . catch ( fail )
122
+ . catch ( failTest )
122
123
. then ( done ) ;
123
124
} ) ;
124
125
} ) ;
@@ -143,7 +144,7 @@ describe('Plot title', function() {
143
144
. then ( function ( ) {
144
145
expectCapLineAlignsWithTopEdgeOf ( testCase . selector ) ;
145
146
} )
146
- . catch ( fail )
147
+ . catch ( failTest )
147
148
. then ( done ) ;
148
149
} ) ;
149
150
@@ -156,7 +157,7 @@ describe('Plot title', function() {
156
157
. then ( function ( ) {
157
158
expectBaselineAlignsWithBottomEdgeOf ( testCase . selector ) ;
158
159
} )
159
- . catch ( fail )
160
+ . catch ( failTest )
160
161
. then ( done ) ;
161
162
} ) ;
162
163
@@ -169,7 +170,7 @@ describe('Plot title', function() {
169
170
. then ( function ( ) {
170
171
expectCenteredVerticallyWithin ( testCase . selector ) ;
171
172
} )
172
- . catch ( fail )
173
+ . catch ( failTest )
173
174
. then ( done ) ;
174
175
} ) ;
175
176
} ) ;
@@ -191,7 +192,7 @@ describe('Plot title', function() {
191
192
. then ( function ( ) {
192
193
expectBaselineInMiddleOfTopMargin ( gd ) ;
193
194
} )
194
- . catch ( fail )
195
+ . catch ( failTest )
195
196
. then ( done ) ;
196
197
} ) ;
197
198
@@ -222,7 +223,7 @@ describe('Plot title', function() {
222
223
var textAnchor = titleSel ( ) . attr ( 'text-anchor' ) ;
223
224
expect ( textAnchor ) . toBe ( testCase . expAlignment , testDesc ) ;
224
225
} )
225
- . catch ( fail )
226
+ . catch ( failTest )
226
227
. then ( done ) ;
227
228
} ) ;
228
229
}
@@ -255,7 +256,7 @@ describe('Plot title', function() {
255
256
. then ( function ( ) {
256
257
testCase . expFn ( elemSelector ) ;
257
258
} )
258
- . catch ( fail )
259
+ . catch ( failTest )
259
260
. then ( done ) ;
260
261
} ) ;
261
262
}
@@ -269,7 +270,7 @@ describe('Plot title', function() {
269
270
. then ( function ( ) {
270
271
expectDefaultCenteredPosition ( gd ) ;
271
272
} )
272
- . catch ( fail )
273
+ . catch ( failTest )
273
274
. then ( done ) ;
274
275
} ) ;
275
276
@@ -286,7 +287,7 @@ describe('Plot title', function() {
286
287
expect ( titleSel ( ) . attr ( 'text-anchor' ) ) . toBe ( 'start' ) ;
287
288
expect ( titleX ( ) - 10 ) . toBe ( leftOf ( refSelector ) ) ;
288
289
} )
289
- . catch ( fail )
290
+ . catch ( failTest )
290
291
. then ( done ) ;
291
292
} ) ;
292
293
} ) ;
@@ -303,7 +304,7 @@ describe('Plot title', function() {
303
304
expect ( titleSel ( ) . attr ( 'text-anchor' ) ) . toBe ( 'end' ) ;
304
305
expect ( titleX ( ) + 10 ) . toBe ( rightOf ( refSelector ) ) ;
305
306
} )
306
- . catch ( fail )
307
+ . catch ( failTest )
307
308
. then ( done ) ;
308
309
} ) ;
309
310
} ) ;
@@ -332,7 +333,7 @@ describe('Plot title', function() {
332
333
. then ( function ( ) {
333
334
expectCenteredWithin ( refSelector ) ;
334
335
} )
335
- . catch ( fail )
336
+ . catch ( failTest )
336
337
. then ( done ) ;
337
338
} ) ;
338
339
} ) ;
@@ -353,7 +354,7 @@ describe('Plot title', function() {
353
354
. then ( function ( ) {
354
355
expectCenteredWithin ( paperElemSelector ) ;
355
356
} )
356
- . catch ( fail )
357
+ . catch ( failTest )
357
358
. then ( done ) ;
358
359
} ) ;
359
360
} ) ;
@@ -370,7 +371,7 @@ describe('Plot title', function() {
370
371
. then ( function ( ) {
371
372
expectRightEdgeAlignedTo ( paperElemSelector ) ;
372
373
} )
373
- . catch ( fail )
374
+ . catch ( failTest )
374
375
. then ( done ) ;
375
376
} ) ;
376
377
@@ -386,7 +387,7 @@ describe('Plot title', function() {
386
387
. then ( function ( ) {
387
388
expectLeftEdgeAlignedTo ( paperElemSelector ) ;
388
389
} )
389
- . catch ( fail )
390
+ . catch ( failTest )
390
391
. then ( done ) ;
391
392
} ) ;
392
393
@@ -403,7 +404,7 @@ describe('Plot title', function() {
403
404
var capLineY = calcTextCapLineY ( titleSel ( ) ) ;
404
405
expect ( capLineY ) . toBe ( topOf ( refSelector ) + 10 ) ;
405
406
} )
406
- . catch ( fail )
407
+ . catch ( failTest )
407
408
. then ( done ) ;
408
409
} ) ;
409
410
} ) ;
@@ -420,7 +421,7 @@ describe('Plot title', function() {
420
421
var baselineY = calcTextBaselineY ( titleSel ( ) ) ;
421
422
expect ( baselineY ) . toBe ( bottomOf ( refSelector ) - 10 ) ;
422
423
} )
423
- . catch ( fail )
424
+ . catch ( failTest )
424
425
. then ( done ) ;
425
426
} ) ;
426
427
} ) ;
@@ -449,7 +450,7 @@ describe('Plot title', function() {
449
450
. then ( function ( ) {
450
451
expectCenteredVerticallyWithin ( refSelector ) ;
451
452
} )
452
- . catch ( fail )
453
+ . catch ( failTest )
453
454
. then ( done ) ;
454
455
} ) ;
455
456
} ) ;
@@ -470,7 +471,7 @@ describe('Plot title', function() {
470
471
. then ( function ( ) {
471
472
expectCenteredVerticallyWithin ( paperElemSelector ) ;
472
473
} )
473
- . catch ( fail )
474
+ . catch ( failTest )
474
475
. then ( done ) ;
475
476
} ) ;
476
477
} ) ;
@@ -487,7 +488,7 @@ describe('Plot title', function() {
487
488
. then ( function ( ) {
488
489
expectBaselineAlignsWithBottomEdgeOf ( paperElemSelector ) ;
489
490
} )
490
- . catch ( fail )
491
+ . catch ( failTest )
491
492
. then ( done ) ;
492
493
} ) ;
493
494
@@ -503,7 +504,7 @@ describe('Plot title', function() {
503
504
. then ( function ( ) {
504
505
expectCapLineAlignsWithTopEdgeOf ( paperElemSelector ) ;
505
506
} )
506
- . catch ( fail )
507
+ . catch ( failTest )
507
508
. then ( done ) ;
508
509
} ) ;
509
510
@@ -675,7 +676,7 @@ describe('Titles can be updated', function() {
675
676
. then ( function ( ) {
676
677
expectChangedTitles ( ) ;
677
678
} )
678
- . catch ( fail )
679
+ . catch ( failTest )
679
680
. then ( done ) ;
680
681
} ) ;
681
682
@@ -684,7 +685,7 @@ describe('Titles can be updated', function() {
684
685
. then ( function ( ) {
685
686
expectChangedTitles ( ) ;
686
687
} )
687
- . catch ( fail )
688
+ . catch ( failTest )
688
689
. then ( done ) ;
689
690
} ) ;
690
691
} ) ;
@@ -758,7 +759,7 @@ describe('Titles and labels', function() {
758
759
expect ( xTitleSel ( ) . text ( ) ) . toBe ( 'x-new' ) ;
759
760
expect ( d3 . select ( '.xtick' ) . text ( ) ) . toBe ( 'b' ) ;
760
761
} )
761
- . catch ( fail )
762
+ . catch ( failTest )
762
763
. then ( done ) ;
763
764
} ) ;
764
765
} ) ;
@@ -813,7 +814,7 @@ describe('Titles support setting custom font properties', function() {
813
814
expectXAxisTitleFont ( '#333' , 'sans-serif' , 20 ) ;
814
815
expectYAxisTitleFont ( '#666' , 'Arial' , 16 ) ;
815
816
} )
816
- . catch ( fail )
817
+ . catch ( failTest )
817
818
. then ( done ) ;
818
819
} ) ;
819
820
@@ -855,7 +856,7 @@ describe('Titles support setting custom font properties', function() {
855
856
expectXAxisTitleFont ( '#333' , 'sans-serif' , 20 ) ;
856
857
expectYAxisTitleFont ( '#666' , 'Arial' , 16 ) ;
857
858
} )
858
- . catch ( fail )
859
+ . catch ( failTest )
859
860
. then ( done ) ;
860
861
} ) ;
861
862
} ) ;
@@ -983,7 +984,7 @@ describe('Title fonts can be updated', function() {
983
984
. then ( function ( ) {
984
985
expectChangedTitleFonts ( ) ;
985
986
} )
986
- . catch ( fail )
987
+ . catch ( failTest )
987
988
. then ( done ) ;
988
989
} ) ;
989
990
@@ -992,7 +993,7 @@ describe('Title fonts can be updated', function() {
992
993
. then ( function ( ) {
993
994
expectChangedTitleFonts ( ) ;
994
995
} )
995
- . catch ( fail )
996
+ . catch ( failTest )
996
997
. then ( done ) ;
997
998
} ) ;
998
999
} ) ;
@@ -1062,7 +1063,7 @@ describe('Titles for multiple axes', function() {
1062
1063
expect ( yTitleSel ( 2 ) . text ( ) ) . toBe ( 'Y-Axis 2' ) ;
1063
1064
expect ( yTitleSel ( 2 ) . node ( ) . style . fill ) . toBe ( rgb ( 'blue' ) ) ;
1064
1065
} )
1065
- . catch ( fail )
1066
+ . catch ( failTest )
1066
1067
. then ( done ) ;
1067
1068
} ) ;
1068
1069
@@ -1093,7 +1094,7 @@ describe('Titles for multiple axes', function() {
1093
1094
expect ( y2Style . fontFamily ) . toBe ( 'monospace' ) ;
1094
1095
expect ( y2Style . fontSize ) . toBe ( '5px' ) ;
1095
1096
} )
1096
- . catch ( fail )
1097
+ . catch ( failTest )
1097
1098
. then ( done ) ;
1098
1099
} ) ;
1099
1100
} ) ;
@@ -1287,7 +1288,7 @@ describe('Editable titles', function() {
1287
1288
checkTitle ( 'g' , 'Click to enter Plot title' , 0.2 , 0.2 )
1288
1289
] ) ;
1289
1290
} )
1290
- . catch ( fail )
1291
+ . catch ( failTest )
1291
1292
. then ( done ) ;
1292
1293
} ) ;
1293
1294
@@ -1304,7 +1305,7 @@ describe('Editable titles', function() {
1304
1305
checkTitle ( 'g' , 'Click to enter Plot title' , 0 , 1 )
1305
1306
] ) ;
1306
1307
} )
1307
- . catch ( fail )
1308
+ . catch ( failTest )
1308
1309
. then ( done ) ;
1309
1310
} ) ;
1310
1311
@@ -1330,7 +1331,7 @@ describe('Editable titles', function() {
1330
1331
checkTitle ( 'g' , 'TTT' , 1 , 1 )
1331
1332
] ) ;
1332
1333
} )
1333
- . catch ( fail )
1334
+ . catch ( failTest )
1334
1335
. then ( done ) ;
1335
1336
} ) ;
1336
1337
} ) ;
0 commit comments