@@ -17,7 +17,7 @@ describe('range selector defaults:', function() {
1717
1818 var handleDefaults = RangeSelector . handleDefaults ;
1919
20- function supply ( containerIn , containerOut ) {
20+ function supply ( containerIn , containerOut , calendar ) {
2121 containerOut . domain = [ 0 , 1 ] ;
2222
2323 var layout = {
@@ -26,7 +26,7 @@ describe('range selector defaults:', function() {
2626
2727 var counterAxes = [ 'yaxis' ] ;
2828
29- handleDefaults ( containerIn , containerOut , layout , counterAxes ) ;
29+ handleDefaults ( containerIn , containerOut , layout , counterAxes , calendar ) ;
3030 }
3131
3232 it ( 'should set \'visible\' to false when no buttons are present' , function ( ) {
@@ -94,7 +94,7 @@ describe('range selector defaults:', function() {
9494 } ;
9595 var containerOut = { } ;
9696
97- supply ( containerIn , containerOut , { } , [ ] ) ;
97+ supply ( containerIn , containerOut ) ;
9898
9999 expect ( containerOut . rangeselector . visible ) . toBe ( true ) ;
100100 expect ( containerOut . rangeselector . buttons ) . toEqual ( [
@@ -114,7 +114,7 @@ describe('range selector defaults:', function() {
114114 } ;
115115 var containerOut = { } ;
116116
117- supply ( containerIn , containerOut , { } , [ ] ) ;
117+ supply ( containerIn , containerOut ) ;
118118
119119 expect ( containerOut . rangeselector . buttons ) . toEqual ( [ {
120120 step : 'all' ,
@@ -176,6 +176,53 @@ describe('range selector defaults:', function() {
176176 expect ( containerOut . rangeselector . x ) . toEqual ( 0.5 ) ;
177177 expect ( containerOut . rangeselector . y ) . toBeCloseTo ( 0.87 ) ;
178178 } ) ;
179+
180+ it ( 'should not allow month/year todate with calendars other than Gregorian' , function ( ) {
181+ var containerIn = {
182+ rangeselector : {
183+ buttons : [ {
184+ step : 'year' ,
185+ count : 1 ,
186+ stepmode : 'todate'
187+ } , {
188+ step : 'month' ,
189+ count : 6 ,
190+ stepmode : 'todate'
191+ } , {
192+ step : 'day' ,
193+ count : 1 ,
194+ stepmode : 'todate'
195+ } , {
196+ step : 'hour' ,
197+ count : 1 ,
198+ stepmode : 'todate'
199+ } ]
200+ }
201+ } ;
202+ var containerOut ;
203+ function getStepmode ( button ) { return button . stepmode ; }
204+
205+ containerOut = { } ;
206+ supply ( containerIn , containerOut ) ;
207+
208+ expect ( containerOut . rangeselector . buttons . map ( getStepmode ) ) . toEqual ( [
209+ 'todate' , 'todate' , 'todate' , 'todate'
210+ ] ) ;
211+
212+ containerOut = { } ;
213+ supply ( containerIn , containerOut , 'gregorian' ) ;
214+
215+ expect ( containerOut . rangeselector . buttons . map ( getStepmode ) ) . toEqual ( [
216+ 'todate' , 'todate' , 'todate' , 'todate'
217+ ] ) ;
218+
219+ containerOut = { } ;
220+ supply ( containerIn , containerOut , 'chinese' ) ;
221+
222+ expect ( containerOut . rangeselector . buttons . map ( getStepmode ) ) . toEqual ( [
223+ 'backward' , 'backward' , 'todate' , 'todate'
224+ ] ) ;
225+ } ) ;
179226} ) ;
180227
181228describe ( 'range selector getUpdateObject:' , function ( ) {
0 commit comments