@@ -1165,15 +1165,19 @@ describe('Test axes', function() {
11651165
11661166 it ( 'should validate inputs in respect to *day of week* pattern' , function ( ) {
11671167 layoutIn = {
1168- xaxis : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ '6.999 ' , '0' ] } ] } ,
1168+ xaxis : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ '6' , '0' ] } ] } ,
11691169 xaxis2 : { type : 'date' , rangebreaks : [ { bounds : [ 'Sunday' ] } ] } ,
11701170 xaxis3 : { type : 'date' , rangebreaks : [ { bounds : [ 'sun' , 'mon' , 'tue' ] } ] } ,
11711171 xaxis4 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , '-1' ] } ] } ,
1172- xaxis5 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , '-.001 ' ] } ] } ,
1172+ xaxis5 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , '-.25 ' ] } ] } ,
11731173 xaxis6 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , '7' ] } ] } ,
1174- xaxis7 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , '6.999' ] } ] }
1174+ xaxis7 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , '6.75' ] } ] } ,
1175+ xaxis8 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , '' ] } ] } ,
1176+ xaxis9 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , null ] } ] } ,
1177+ xaxis10 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , false ] } ] } ,
1178+ xaxis11 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , true ] } ] }
11751179 } ;
1176- layoutOut . _subplots . xaxis . push ( 'x2' , 'x3' , 'x4' , 'x5' , 'x6' , 'x7' ) ;
1180+ layoutOut . _subplots . xaxis . push ( 'x2' , 'x3' , 'x4' , 'x5' , 'x6' , 'x7' , 'x8' , 'x9' , 'x10' , 'x11' ) ;
11771181 supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
11781182
11791183 expect ( layoutOut . xaxis . rangebreaks [ 0 ] . enabled ) . toBe ( true , 'valid' ) ;
@@ -1185,34 +1189,44 @@ describe('Test axes', function() {
11851189 expect ( layoutOut . xaxis4 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject bound < 0' ) ;
11861190 expect ( layoutOut . xaxis5 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject bound < 0' ) ;
11871191 expect ( layoutOut . xaxis6 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject bound >= 7' ) ;
1188- expect ( layoutOut . xaxis7 . rangebreaks [ 0 ] . enabled ) . toBe ( true , 'do not reject bound < 7' ) ;
1192+ expect ( layoutOut . xaxis7 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject bound < 7 - not supported yet' ) ;
1193+ expect ( layoutOut . xaxis8 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject blank string' ) ;
1194+ expect ( layoutOut . xaxis9 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject null' ) ;
1195+ expect ( layoutOut . xaxis10 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject false' ) ;
1196+ expect ( layoutOut . xaxis11 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject true' ) ;
11891197 } ) ;
11901198
11911199 it ( 'should validate inputs in respect to *hour* pattern' , function ( ) {
11921200 layoutIn = {
1193- xaxis : { type : 'date' , rangebreaks : [ { pattern : 'hour' , bounds : [ '23.999 ' , '0 ' ] } ] } ,
1201+ xaxis : { type : 'date' , rangebreaks : [ { pattern : 'hour' , bounds : [ '24 ' , '1e-3 ' ] } ] } ,
11941202 xaxis2 : { type : 'date' , rangebreaks : [ { pattern : 'hour' , bounds : [ 1 ] } ] } ,
11951203 xaxis3 : { type : 'date' , rangebreaks : [ { pattern : 'hour' , bounds : [ 1 , 2 , 3 ] } ] } ,
11961204 xaxis4 : { type : 'date' , rangebreaks : [ { pattern : 'hour' , bounds : [ 1 , '-1' ] } ] } ,
11971205 xaxis5 : { type : 'date' , rangebreaks : [ { pattern : 'hour' , bounds : [ 1 , '-.001' ] } ] } ,
11981206 xaxis6 : { type : 'date' , rangebreaks : [ { pattern : 'hour' , bounds : [ 1 , '24.001' ] } ] } ,
11991207 xaxis7 : { type : 'date' , rangebreaks : [ { pattern : 'hour' , bounds : [ 1 , '23.999' ] } ] } ,
1200- xaxis8 : { type : 'date' , rangebreaks : [ { pattern : 'hour' , bounds : [ 1 , '24' ] } ] }
1208+ xaxis8 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , '' ] } ] } ,
1209+ xaxis9 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , null ] } ] } ,
1210+ xaxis10 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , false ] } ] } ,
1211+ xaxis11 : { type : 'date' , rangebreaks : [ { pattern : 'day of week' , bounds : [ 1 , true ] } ] }
12011212 } ;
1202- layoutOut . _subplots . xaxis . push ( 'x2' , 'x3' , 'x4' , 'x5' , 'x6' , 'x7' , 'x8' ) ;
1213+ layoutOut . _subplots . xaxis . push ( 'x2' , 'x3' , 'x4' , 'x5' , 'x6' , 'x7' , 'x8' , 'x9' , 'x10' , 'x11' ) ;
12031214 supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
12041215
12051216 expect ( layoutOut . xaxis . rangebreaks [ 0 ] . enabled ) . toBe ( true , 'valid' ) ;
1206- expect ( layoutOut . xaxis . rangebreaks [ 0 ] . bounds [ 0 ] ) . toBe ( '23.999' , 'do not cast float to int ' ) ;
1207- expect ( layoutOut . xaxis . rangebreaks [ 0 ] . bounds [ 1 ] ) . toBe ( '0' , 'do not cast string to int ' ) ;
1217+ expect ( layoutOut . xaxis . rangebreaks [ 0 ] . bounds [ 0 ] ) . toBe ( 24 , 'accept 24 ' ) ;
1218+ expect ( layoutOut . xaxis . rangebreaks [ 0 ] . bounds [ 1 ] ) . toBe ( 0.001 , 'cast string to float ' ) ;
12081219 expect ( layoutOut . xaxis2 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject bounds.length < 2' ) ;
12091220 expect ( layoutOut . xaxis3 . rangebreaks [ 0 ] . enabled ) . toBe ( true , 'do not reject bounds.length > 2' ) ;
12101221 expect ( layoutOut . xaxis3 . rangebreaks [ 0 ] . bounds . length ) . toBe ( 2 , 'pick first two' ) ;
12111222 expect ( layoutOut . xaxis4 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject bound < 0' ) ;
12121223 expect ( layoutOut . xaxis5 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject bound < 0' ) ;
12131224 expect ( layoutOut . xaxis6 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject bound > 24' ) ;
12141225 expect ( layoutOut . xaxis7 . rangebreaks [ 0 ] . enabled ) . toBe ( true , 'do not reject bound <= 24' ) ;
1215- expect ( layoutOut . xaxis8 . rangebreaks [ 0 ] . enabled ) . toBe ( true , 'do not reject 24' ) ;
1226+ expect ( layoutOut . xaxis8 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject blank string' ) ;
1227+ expect ( layoutOut . xaxis9 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject null' ) ;
1228+ expect ( layoutOut . xaxis10 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject false' ) ;
1229+ expect ( layoutOut . xaxis11 . rangebreaks [ 0 ] . enabled ) . toBe ( false , 'reject true' ) ;
12161230 } ) ;
12171231 } ) ;
12181232
0 commit comments