File tree Expand file tree Collapse file tree 1 file changed +40
-2
lines changed
Expand file tree Collapse file tree 1 file changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,10 @@ var Cartesian = require('@src/plots/cartesian');
1313var Axes = require ( '@src/plots/cartesian/axes' ) ;
1414var Fx = require ( '@src/components/fx' ) ;
1515var supplyLayoutDefaults = require ( '@src/plots/cartesian/layout_defaults' ) ;
16- var BADNUM = require ( '@src/constants/numerical' ) . BADNUM ;
17- var ONEDAY = require ( '@src/constants/numerical' ) . ONEDAY ;
16+ var numerical = require ( '@src/constants/numerical' ) ;
17+ var BADNUM = numerical . BADNUM ;
18+ var ONEDAY = numerical . ONEDAY ;
19+ var ONEWEEK = numerical . ONEWEEK ;
1820
1921var createGraphDiv = require ( '../assets/create_graph_div' ) ;
2022var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
@@ -6020,6 +6022,42 @@ describe('Test axes', function() {
60206022 . then ( done ) ;
60216023 } ) ;
60226024 } ) ;
6025+
6026+ [ undefined , '%U' , '%V' , '%W' ] . forEach ( function ( tickformat ) {
6027+ it ( 'with ' + tickformat + ' tickformat, should default tick0 on a Sunday when dtick is a round number of weeks' , function ( done ) {
6028+ var fig = {
6029+ data : [
6030+ {
6031+ showlegend : false ,
6032+ type : 'bar' ,
6033+ width : ONEWEEK ,
6034+ xperiod : ONEWEEK ,
6035+ x : [
6036+ '2020-09-16' ,
6037+ '2020-09-24' ,
6038+ '2020-09-30'
6039+ ] ,
6040+ y : [ 3 , 2 , 4 ]
6041+ }
6042+ ] ,
6043+ layout : {
6044+ xaxis : {
6045+ tickformat : tickformat ,
6046+ dtick : ONEWEEK ,
6047+ ticklabelmode : 'period' ,
6048+ showgrid : true ,
6049+ }
6050+ }
6051+ } ;
6052+
6053+ Plotly . newPlot ( gd , fig )
6054+ . then ( function ( ) {
6055+ expect ( gd . _fullLayout . xaxis . tick0 ) . toBe ( '2000-01-02' ) ;
6056+ } )
6057+ . catch ( failTest )
6058+ . then ( done ) ;
6059+ } ) ;
6060+ } ) ;
60236061 } ) ;
60246062} ) ;
60256063
You can’t perform that action at this time.
0 commit comments