@@ -5206,16 +5206,14 @@ describe('Test axes', function() {
5206
5206
5207
5207
afterEach ( destroyGraphDiv ) ;
5208
5208
5209
- function _assertPositions ( msg , exp ) {
5209
+ function _assert ( msg , expPositions , expLabels ) {
5210
5210
var ax = gd . _fullLayout . xaxis ;
5211
+
5211
5212
var positions = ax . _vals . map ( function ( d ) { return ax . c2d ( d . periodX ) ; } ) ;
5212
- expect ( positions ) . withContext ( msg ) . toEqual ( exp ) ;
5213
- }
5213
+ expect ( positions ) . withContext ( msg ) . toEqual ( expPositions ) ;
5214
5214
5215
- function _assertLabels ( msg , exp ) {
5216
- var ax = gd . _fullLayout . xaxis ;
5217
5215
var labels = ax . _vals . map ( function ( d ) { return d . text ; } ) ;
5218
- expect ( labels ) . withContext ( msg ) . toEqual ( exp ) ;
5216
+ expect ( labels ) . withContext ( msg ) . toEqual ( expLabels ) ;
5219
5217
}
5220
5218
5221
5219
[ '%Y' , '%y' ] . forEach ( function ( tickformat , i ) {
@@ -5233,7 +5231,7 @@ describe('Test axes', function() {
5233
5231
}
5234
5232
} )
5235
5233
. then ( function ( ) {
5236
- _assertPositions ( '' , [
5234
+ _assert ( '' , [
5237
5235
'2019-07-02 15:00' ,
5238
5236
'2020-07-01 15:00' ,
5239
5237
'2021-07-02 15:00' ,
@@ -5242,10 +5240,7 @@ describe('Test axes', function() {
5242
5240
'2024-07-01 15:00' ,
5243
5241
'2025-07-02 15:00' ,
5244
5242
'2026-07-02 15:00'
5245
- ] ) ;
5246
- } )
5247
- . then ( function ( ) {
5248
- _assertLabels ( '' , [
5243
+ ] , [
5249
5244
[ '' , '2020' , '2021' , '2022' , '2023' , '2024' , '2025' , '' ] ,
5250
5245
[ '' , '20' , '21' , '22' , '23' , '24' , '25' , '' ]
5251
5246
] [ i ] ) ;
@@ -5269,7 +5264,7 @@ describe('Test axes', function() {
5269
5264
}
5270
5265
} )
5271
5266
. then ( function ( ) {
5272
- _assertPositions ( '' , [
5267
+ _assert ( '' , [
5273
5268
'2019-11-15 15:45' ,
5274
5269
'2020-02-15 15:45' ,
5275
5270
'2020-05-16 15:45' ,
@@ -5280,10 +5275,7 @@ describe('Test axes', function() {
5280
5275
'2021-08-15 15:45' ,
5281
5276
'2021-11-15 15:45' ,
5282
5277
'2022-02-15 15:45'
5283
- ] ) ;
5284
- } )
5285
- . then ( function ( ) {
5286
- _assertLabels ( '' , [ '' , '2020-1' , '2020-2' , '2020-3' , '2020-4' , '2021-1' , '2021-2' , '2021-3' , '2021-4' , '' ] ) ;
5278
+ ] , [ '' , '2020-1' , '2020-2' , '2020-3' , '2020-4' , '2021-1' , '2021-2' , '2021-3' , '2021-4' , '' ] ) ;
5287
5279
} )
5288
5280
. catch ( failTest )
5289
5281
. then ( done ) ;
@@ -5304,7 +5296,7 @@ describe('Test axes', function() {
5304
5296
}
5305
5297
} )
5306
5298
. then ( function ( ) {
5307
- _assertPositions ( '' , [
5299
+ _assert ( '' , [
5308
5300
'2019-12-16 05:15' ,
5309
5301
'2020-01-16 05:15' ,
5310
5302
'2020-02-16 05:15' ,
@@ -5313,10 +5305,7 @@ describe('Test axes', function() {
5313
5305
'2020-05-16 05:15' ,
5314
5306
'2020-06-16 05:15' ,
5315
5307
'2020-07-16 05:15'
5316
- ] ) ;
5317
- } )
5318
- . then ( function ( ) {
5319
- _assertLabels ( '' , [
5308
+ ] , [
5320
5309
[ '' , '1-January' , '1-February' , '1-March' , '2-April' , '2-May' , '2-June' , '' ] ,
5321
5310
[ '' , '1-Jan' , '1-Feb' , '1-Mar' , '2-Apr' , '2-May' , '2-Jun' , '' ] ,
5322
5311
[ '' , '1-01' , '1-02' , '1-03' , '2-04' , '2-05' , '2-06' , '' ]
@@ -5341,7 +5330,7 @@ describe('Test axes', function() {
5341
5330
}
5342
5331
} )
5343
5332
. then ( function ( ) {
5344
- _assertPositions ( '' , [
5333
+ _assert ( '' , [
5345
5334
'2020-01-29 12:00' ,
5346
5335
'2020-02-05 12:00' ,
5347
5336
'2020-02-12 12:00' ,
@@ -5352,10 +5341,7 @@ describe('Test axes', function() {
5352
5341
'2020-03-18 12:00' ,
5353
5342
'2020-03-25 12:00' ,
5354
5343
'2020-04-01 12:00'
5355
- ] ) ;
5356
- } )
5357
- . then ( function ( ) {
5358
- _assertLabels ( '' , [ 'Jan-04' , 'Feb-05' , 'Feb-06' , 'Feb-07' , 'Feb-08' , 'Mar-09' , 'Mar-10' , 'Mar-11' , 'Mar-12' , 'Mar-13' ] ) ;
5344
+ ] , [ 'Jan-04' , 'Feb-05' , 'Feb-06' , 'Feb-07' , 'Feb-08' , 'Mar-09' , 'Mar-10' , 'Mar-11' , 'Mar-12' , 'Mar-13' ] ) ;
5359
5345
} )
5360
5346
. catch ( failTest )
5361
5347
. then ( done ) ;
@@ -5376,7 +5362,7 @@ describe('Test axes', function() {
5376
5362
}
5377
5363
} )
5378
5364
. then ( function ( ) {
5379
- _assertPositions ( '' , [
5365
+ _assert ( '' , [
5380
5366
'2020-01-30 12:00' ,
5381
5367
'2020-02-06 12:00' ,
5382
5368
'2020-02-13 12:00' ,
@@ -5387,10 +5373,7 @@ describe('Test axes', function() {
5387
5373
'2020-03-19 12:00' ,
5388
5374
'2020-03-26 12:00' ,
5389
5375
'2020-04-02 12:00'
5390
- ] ) ;
5391
- } )
5392
- . then ( function ( ) {
5393
- _assertLabels ( '' , [
5376
+ ] , [
5394
5377
[ 'Jan-05' , 'Feb-06' , 'Feb-07' , 'Feb-08' , 'Feb-09' , 'Mar-10' , 'Mar-11' , 'Mar-12' , 'Mar-13' , 'Mar-14' ] ,
5395
5378
[ 'Jan-04' , 'Feb-05' , 'Feb-06' , 'Feb-07' , 'Feb-08' , 'Mar-09' , 'Mar-10' , 'Mar-11' , 'Mar-12' , 'Mar-13' ]
5396
5379
] [ i ] ) ;
@@ -5415,7 +5398,7 @@ describe('Test axes', function() {
5415
5398
}
5416
5399
} )
5417
5400
. then ( function ( ) {
5418
- _assertPositions ( '' , [
5401
+ _assert ( '' , [
5419
5402
'2019-12-31 12:00' ,
5420
5403
'2020-01-01 12:00' ,
5421
5404
'2020-01-02 12:00' ,
@@ -5425,10 +5408,7 @@ describe('Test axes', function() {
5425
5408
'2020-01-06 12:00' ,
5426
5409
'2020-01-07 12:00' ,
5427
5410
'2020-01-08 12:00'
5428
- ] ) ;
5429
- } )
5430
- . then ( function ( ) {
5431
- _assertLabels ( '' , [
5411
+ ] , [
5432
5412
[ '' , 'Jan-Wednesday' , 'Jan-Thursday' , 'Jan-Friday' , 'Jan-Saturday' , 'Jan-Sunday' , 'Jan-Monday' , 'Jan-Tuesday' , '' ] ,
5433
5413
[ '' , 'Jan-Wed' , 'Jan-Thu' , 'Jan-Fri' , 'Jan-Sat' , 'Jan-Sun' , 'Jan-Mon' , 'Jan-Tue' , '' ] ,
5434
5414
[ '' , 'Jan-01' , 'Jan-02' , 'Jan-03' , 'Jan-04' , 'Jan-05' , 'Jan-06' , 'Jan-07' , '' ] ,
@@ -5459,7 +5439,7 @@ describe('Test axes', function() {
5459
5439
}
5460
5440
} )
5461
5441
. then ( function ( ) {
5462
- _assertPositions ( '' , [
5442
+ _assert ( '' , [
5463
5443
'2019-12-31 21:00' ,
5464
5444
'2020-01-01' ,
5465
5445
'2020-01-01 03:00' ,
@@ -5470,10 +5450,7 @@ describe('Test axes', function() {
5470
5450
'2020-01-01 18:00' ,
5471
5451
'2020-01-01 21:00' ,
5472
5452
'2020-01-02'
5473
- ] ) ;
5474
- } )
5475
- . then ( function ( ) {
5476
- _assertLabels ( '' , [
5453
+ ] , [
5477
5454
[ '' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Thu-0' ] ,
5478
5455
[ '' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Thu-000' ] ,
5479
5456
[ '' , 'Wed-1577836800000' , 'Wed-1577847600000' , 'Wed-1577858400000' , 'Wed-1577869200000' , 'Wed-1577880000000' , 'Wed-1577890800000' , 'Wed-1577901600000' , 'Wed-1577912400000' , 'Thu-1577923200000' ] ,
0 commit comments