@@ -17,7 +17,7 @@ describe('range selector defaults:', function() {
17
17
18
18
var handleDefaults = RangeSelector . handleDefaults ;
19
19
20
- function supply ( containerIn , containerOut ) {
20
+ function supply ( containerIn , containerOut , calendar ) {
21
21
containerOut . domain = [ 0 , 1 ] ;
22
22
23
23
var layout = {
@@ -26,7 +26,7 @@ describe('range selector defaults:', function() {
26
26
27
27
var counterAxes = [ 'yaxis' ] ;
28
28
29
- handleDefaults ( containerIn , containerOut , layout , counterAxes ) ;
29
+ handleDefaults ( containerIn , containerOut , layout , counterAxes , calendar ) ;
30
30
}
31
31
32
32
it ( 'should set \'visible\' to false when no buttons are present' , function ( ) {
@@ -94,7 +94,7 @@ describe('range selector defaults:', function() {
94
94
} ;
95
95
var containerOut = { } ;
96
96
97
- supply ( containerIn , containerOut , { } , [ ] ) ;
97
+ supply ( containerIn , containerOut ) ;
98
98
99
99
expect ( containerOut . rangeselector . visible ) . toBe ( true ) ;
100
100
expect ( containerOut . rangeselector . buttons ) . toEqual ( [
@@ -114,7 +114,7 @@ describe('range selector defaults:', function() {
114
114
} ;
115
115
var containerOut = { } ;
116
116
117
- supply ( containerIn , containerOut , { } , [ ] ) ;
117
+ supply ( containerIn , containerOut ) ;
118
118
119
119
expect ( containerOut . rangeselector . buttons ) . toEqual ( [ {
120
120
step : 'all' ,
@@ -176,6 +176,53 @@ describe('range selector defaults:', function() {
176
176
expect ( containerOut . rangeselector . x ) . toEqual ( 0.5 ) ;
177
177
expect ( containerOut . rangeselector . y ) . toBeCloseTo ( 0.87 ) ;
178
178
} ) ;
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
+ } ) ;
179
226
} ) ;
180
227
181
228
describe ( 'range selector getUpdateObject:' , function ( ) {
0 commit comments