@@ -130,6 +130,54 @@ describe('range selector', function() {
130130 'xaxis.range' : null
131131 } ) ;
132132 } ) ;
133+
134+ it ( 'should return update object (10 day backward case)' , function ( ) {
135+ var buttonLayout = {
136+ step : 'day' ,
137+ stepmode : 'backward' ,
138+ count : 10
139+ } ;
140+
141+ var update = getUpdateObject ( axisLayout , buttonLayout ) ;
142+
143+ assertRanges ( update , new Date ( 2015 , 10 , 20 ) , new Date ( 2015 , 10 , 30 ) ) ;
144+ } ) ;
145+
146+ it ( 'should return update object (5 hour backward case)' , function ( ) {
147+ var buttonLayout = {
148+ step : 'hour' ,
149+ stepmode : 'backward' ,
150+ count : 5
151+ } ;
152+
153+ var update = getUpdateObject ( axisLayout , buttonLayout ) ;
154+
155+ assertRanges ( update , new Date ( 2015 , 10 , 29 , 19 ) , new Date ( 2015 , 10 , 30 ) ) ;
156+ } ) ;
157+
158+ it ( 'should return update object (15 minute backward case)' , function ( ) {
159+ var buttonLayout = {
160+ step : 'minute' ,
161+ stepmode : 'backward' ,
162+ count : 15
163+ } ;
164+
165+ var update = getUpdateObject ( axisLayout , buttonLayout ) ;
166+
167+ assertRanges ( update , new Date ( 2015 , 10 , 29 , 23 , 45 ) , new Date ( 2015 , 10 , 30 ) ) ;
168+ } ) ;
169+
170+ it ( 'should return update object (10 second backward case)' , function ( ) {
171+ var buttonLayout = {
172+ step : 'second' ,
173+ stepmode : 'backward' ,
174+ count : 10
175+ } ;
176+
177+ var update = getUpdateObject ( axisLayout , buttonLayout ) ;
178+
179+ assertRanges ( update , new Date ( 2015 , 10 , 29 , 23 , 59 , 50 ) , new Date ( 2015 , 10 , 30 ) ) ;
180+ } ) ;
133181 } ) ;
134182
135183
0 commit comments