@@ -5206,16 +5206,14 @@ describe('Test axes', function() {
52065206
52075207 afterEach ( destroyGraphDiv ) ;
52085208
5209- function _assertPositions ( msg , exp ) {
5209+ function _assert ( msg , expPositions , expLabels ) {
52105210 var ax = gd . _fullLayout . xaxis ;
5211+
52115212 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 ) ;
52145214
5215- function _assertLabels ( msg , exp ) {
5216- var ax = gd . _fullLayout . xaxis ;
52175215 var labels = ax . _vals . map ( function ( d ) { return d . text ; } ) ;
5218- expect ( labels ) . withContext ( msg ) . toEqual ( exp ) ;
5216+ expect ( labels ) . withContext ( msg ) . toEqual ( expLabels ) ;
52195217 }
52205218
52215219 [ '%Y' , '%y' ] . forEach ( function ( tickformat , i ) {
@@ -5233,7 +5231,7 @@ describe('Test axes', function() {
52335231 }
52345232 } )
52355233 . then ( function ( ) {
5236- _assertPositions ( '' , [
5234+ _assert ( '' , [
52375235 '2019-07-02 15:00' ,
52385236 '2020-07-01 15:00' ,
52395237 '2021-07-02 15:00' ,
@@ -5242,10 +5240,7 @@ describe('Test axes', function() {
52425240 '2024-07-01 15:00' ,
52435241 '2025-07-02 15:00' ,
52445242 '2026-07-02 15:00'
5245- ] ) ;
5246- } )
5247- . then ( function ( ) {
5248- _assertLabels ( '' , [
5243+ ] , [
52495244 [ '' , '2020' , '2021' , '2022' , '2023' , '2024' , '2025' , '' ] ,
52505245 [ '' , '20' , '21' , '22' , '23' , '24' , '25' , '' ]
52515246 ] [ i ] ) ;
@@ -5269,7 +5264,7 @@ describe('Test axes', function() {
52695264 }
52705265 } )
52715266 . then ( function ( ) {
5272- _assertPositions ( '' , [
5267+ _assert ( '' , [
52735268 '2019-11-15 15:45' ,
52745269 '2020-02-15 15:45' ,
52755270 '2020-05-16 15:45' ,
@@ -5280,10 +5275,7 @@ describe('Test axes', function() {
52805275 '2021-08-15 15:45' ,
52815276 '2021-11-15 15:45' ,
52825277 '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' , '' ] ) ;
52875279 } )
52885280 . catch ( failTest )
52895281 . then ( done ) ;
@@ -5304,7 +5296,7 @@ describe('Test axes', function() {
53045296 }
53055297 } )
53065298 . then ( function ( ) {
5307- _assertPositions ( '' , [
5299+ _assert ( '' , [
53085300 '2019-12-16 05:15' ,
53095301 '2020-01-16 05:15' ,
53105302 '2020-02-16 05:15' ,
@@ -5313,10 +5305,7 @@ describe('Test axes', function() {
53135305 '2020-05-16 05:15' ,
53145306 '2020-06-16 05:15' ,
53155307 '2020-07-16 05:15'
5316- ] ) ;
5317- } )
5318- . then ( function ( ) {
5319- _assertLabels ( '' , [
5308+ ] , [
53205309 [ '' , '1-January' , '1-February' , '1-March' , '2-April' , '2-May' , '2-June' , '' ] ,
53215310 [ '' , '1-Jan' , '1-Feb' , '1-Mar' , '2-Apr' , '2-May' , '2-Jun' , '' ] ,
53225311 [ '' , '1-01' , '1-02' , '1-03' , '2-04' , '2-05' , '2-06' , '' ]
@@ -5341,7 +5330,7 @@ describe('Test axes', function() {
53415330 }
53425331 } )
53435332 . then ( function ( ) {
5344- _assertPositions ( '' , [
5333+ _assert ( '' , [
53455334 '2020-01-29 12:00' ,
53465335 '2020-02-05 12:00' ,
53475336 '2020-02-12 12:00' ,
@@ -5352,10 +5341,7 @@ describe('Test axes', function() {
53525341 '2020-03-18 12:00' ,
53535342 '2020-03-25 12:00' ,
53545343 '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' ] ) ;
53595345 } )
53605346 . catch ( failTest )
53615347 . then ( done ) ;
@@ -5376,7 +5362,7 @@ describe('Test axes', function() {
53765362 }
53775363 } )
53785364 . then ( function ( ) {
5379- _assertPositions ( '' , [
5365+ _assert ( '' , [
53805366 '2020-01-30 12:00' ,
53815367 '2020-02-06 12:00' ,
53825368 '2020-02-13 12:00' ,
@@ -5387,10 +5373,7 @@ describe('Test axes', function() {
53875373 '2020-03-19 12:00' ,
53885374 '2020-03-26 12:00' ,
53895375 '2020-04-02 12:00'
5390- ] ) ;
5391- } )
5392- . then ( function ( ) {
5393- _assertLabels ( '' , [
5376+ ] , [
53945377 [ 'Jan-05' , 'Feb-06' , 'Feb-07' , 'Feb-08' , 'Feb-09' , 'Mar-10' , 'Mar-11' , 'Mar-12' , 'Mar-13' , 'Mar-14' ] ,
53955378 [ 'Jan-04' , 'Feb-05' , 'Feb-06' , 'Feb-07' , 'Feb-08' , 'Mar-09' , 'Mar-10' , 'Mar-11' , 'Mar-12' , 'Mar-13' ]
53965379 ] [ i ] ) ;
@@ -5415,7 +5398,7 @@ describe('Test axes', function() {
54155398 }
54165399 } )
54175400 . then ( function ( ) {
5418- _assertPositions ( '' , [
5401+ _assert ( '' , [
54195402 '2019-12-31 12:00' ,
54205403 '2020-01-01 12:00' ,
54215404 '2020-01-02 12:00' ,
@@ -5425,10 +5408,7 @@ describe('Test axes', function() {
54255408 '2020-01-06 12:00' ,
54265409 '2020-01-07 12:00' ,
54275410 '2020-01-08 12:00'
5428- ] ) ;
5429- } )
5430- . then ( function ( ) {
5431- _assertLabels ( '' , [
5411+ ] , [
54325412 [ '' , 'Jan-Wednesday' , 'Jan-Thursday' , 'Jan-Friday' , 'Jan-Saturday' , 'Jan-Sunday' , 'Jan-Monday' , 'Jan-Tuesday' , '' ] ,
54335413 [ '' , 'Jan-Wed' , 'Jan-Thu' , 'Jan-Fri' , 'Jan-Sat' , 'Jan-Sun' , 'Jan-Mon' , 'Jan-Tue' , '' ] ,
54345414 [ '' , 'Jan-01' , 'Jan-02' , 'Jan-03' , 'Jan-04' , 'Jan-05' , 'Jan-06' , 'Jan-07' , '' ] ,
@@ -5459,7 +5439,7 @@ describe('Test axes', function() {
54595439 }
54605440 } )
54615441 . then ( function ( ) {
5462- _assertPositions ( '' , [
5442+ _assert ( '' , [
54635443 '2019-12-31 21:00' ,
54645444 '2020-01-01' ,
54655445 '2020-01-01 03:00' ,
@@ -5470,10 +5450,7 @@ describe('Test axes', function() {
54705450 '2020-01-01 18:00' ,
54715451 '2020-01-01 21:00' ,
54725452 '2020-01-02'
5473- ] ) ;
5474- } )
5475- . then ( function ( ) {
5476- _assertLabels ( '' , [
5453+ ] , [
54775454 [ '' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Wed-0' , 'Thu-0' ] ,
54785455 [ '' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Wed-000' , 'Thu-000' ] ,
54795456 [ '' , 'Wed-1577836800000' , 'Wed-1577847600000' , 'Wed-1577858400000' , 'Wed-1577869200000' , 'Wed-1577880000000' , 'Wed-1577890800000' , 'Wed-1577901600000' , 'Wed-1577912400000' , 'Thu-1577923200000' ] ,
0 commit comments