@@ -1135,6 +1135,33 @@ describe('Test axes', function() {
1135
1135
expect ( layoutOut . xaxis2 . rangebreaks [ 0 ] . pattern ) . toBe ( 'day of week' , 'coerced' ) ;
1136
1136
expect ( layoutOut . xaxis3 . rangebreaks [ 0 ] . pattern ) . toBe ( undefined , 'not coerce, using *values*' ) ;
1137
1137
} ) ;
1138
+
1139
+ it ( 'should auto default rangebreaks.pattern to *day of week* when *bounds* include a weekday string and convert bounds to integer days' , function ( ) {
1140
+ layoutIn = {
1141
+ xaxis : { type : 'date' , rangebreaks : [
1142
+ { bounds : [ 'Saturday' , 'Monday' ] }
1143
+ ] } ,
1144
+ xaxis2 : { type : 'date' , rangebreaks : [
1145
+ { bounds : [ 'sun' , 'thu' ] } ,
1146
+ { bounds : [ 'mon' , 'fri' ] } ,
1147
+ { bounds : [ 'tue' , 'sat' ] } ,
1148
+ { bounds : [ 'wed' , '-1' ] }
1149
+ ] }
1150
+ } ;
1151
+ layoutOut . _subplots . xaxis . push ( 'x2' ) ;
1152
+ supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
1153
+
1154
+ expect ( layoutOut . xaxis . rangebreaks [ 0 ] . pattern ) . toBe ( 'day of week' , 'complete Capital' ) ;
1155
+ expect ( layoutOut . xaxis2 . rangebreaks [ 0 ] . pattern ) . toBe ( 'day of week' , '3-letter case' ) ;
1156
+ expect ( layoutOut . xaxis2 . rangebreaks [ 0 ] . bounds [ 0 ] ) . toBe ( 0 , 'convert sun' ) ;
1157
+ expect ( layoutOut . xaxis2 . rangebreaks [ 1 ] . bounds [ 0 ] ) . toBe ( 1 , 'convert mon' ) ;
1158
+ expect ( layoutOut . xaxis2 . rangebreaks [ 2 ] . bounds [ 0 ] ) . toBe ( 2 , 'convert tue' ) ;
1159
+ expect ( layoutOut . xaxis2 . rangebreaks [ 3 ] . bounds [ 0 ] ) . toBe ( 3 , 'convert wed' ) ;
1160
+ expect ( layoutOut . xaxis2 . rangebreaks [ 0 ] . bounds [ 1 ] ) . toBe ( 4 , 'convert thu' ) ;
1161
+ expect ( layoutOut . xaxis2 . rangebreaks [ 1 ] . bounds [ 1 ] ) . toBe ( 5 , 'convert fri' ) ;
1162
+ expect ( layoutOut . xaxis2 . rangebreaks [ 2 ] . bounds [ 1 ] ) . toBe ( 6 , 'convert sat' ) ;
1163
+ expect ( layoutOut . xaxis2 . rangebreaks [ 3 ] . bounds [ 1 ] ) . toBe ( '-1' , 'string' ) ;
1164
+ } ) ;
1138
1165
} ) ;
1139
1166
1140
1167
describe ( 'constraints relayout' , function ( ) {
0 commit comments