@@ -142,6 +142,75 @@ describe('filter transforms calc:', function() {
142142 expect ( out [ 0 ] . z ) . toEqual ( [ '2016-10-21' , '2016-12-02' ] ) ;
143143 } ) ;
144144
145+ it ( 'should use the calendar from the target attribute if target is a string' , function ( ) {
146+ // this is the same data as in "filters should handle 3D *z* data"
147+ // but with different calendars
148+ var out = _transform ( [ Lib . extendDeep ( { } , base , {
149+ type : 'scatter3d' ,
150+ // the same array as above but in nanakshahi dates
151+ z : [ '0547-05-05' , '0548-05-17' , '0548-06-17' , '0548-08-07' , '0548-09-19' ] ,
152+ zcalendar : 'nanakshahi' ,
153+ transforms : [ {
154+ type : 'filter' ,
155+ operation : '>' ,
156+ value : '5776-06-28' ,
157+ valuecalendar : 'hebrew' ,
158+ target : 'z' ,
159+ // targetcalendar is ignored!
160+ targetcalendar : 'taiwan'
161+ } ]
162+ } ) ] ) ;
163+
164+ expect ( out [ 0 ] . x ) . toEqual ( [ 0 , 1 ] ) ;
165+ expect ( out [ 0 ] . y ) . toEqual ( [ 1 , 2 ] ) ;
166+ expect ( out [ 0 ] . z ) . toEqual ( [ '0548-08-07' , '0548-09-19' ] ) ;
167+ } ) ;
168+
169+ it ( 'should use targetcalendar anyway if there is no matching calendar attribute' , function ( ) {
170+ // this is the same data as in "filters should handle 3D *z* data"
171+ // but with different calendars
172+ var out = _transform ( [ Lib . extendDeep ( { } , base , {
173+ type : 'scatter' ,
174+ // the same array as above but in taiwanese dates
175+ text : [ '0104-07-20' , '0105-08-01' , '0105-09-01' , '0105-10-21' , '0105-12-02' ] ,
176+ transforms : [ {
177+ type : 'filter' ,
178+ operation : '>' ,
179+ value : '5776-06-28' ,
180+ valuecalendar : 'hebrew' ,
181+ target : 'text' ,
182+ targetcalendar : 'taiwan'
183+ } ]
184+ } ) ] ) ;
185+
186+ expect ( out [ 0 ] . x ) . toEqual ( [ 0 , 1 ] ) ;
187+ expect ( out [ 0 ] . y ) . toEqual ( [ 1 , 2 ] ) ;
188+ expect ( out [ 0 ] . text ) . toEqual ( [ '0105-10-21' , '0105-12-02' ] ) ;
189+ } ) ;
190+
191+ it ( 'should use targetcalendar if target is an array' , function ( ) {
192+ // this is the same data as in "filters should handle 3D *z* data"
193+ // but with different calendars
194+ var out = _transform ( [ Lib . extendDeep ( { } , base , {
195+ type : 'scatter3d' ,
196+ // the same array as above but in nanakshahi dates
197+ z : [ '0547-05-05' , '0548-05-17' , '0548-06-17' , '0548-08-07' , '0548-09-19' ] ,
198+ zcalendar : 'nanakshahi' ,
199+ transforms : [ {
200+ type : 'filter' ,
201+ operation : '>' ,
202+ value : '5776-06-28' ,
203+ valuecalendar : 'hebrew' ,
204+ target : [ '0104-07-20' , '0105-08-01' , '0105-09-01' , '0105-10-21' , '0105-12-02' ] ,
205+ targetcalendar : 'taiwan'
206+ } ]
207+ } ) ] ) ;
208+
209+ expect ( out [ 0 ] . x ) . toEqual ( [ 0 , 1 ] ) ;
210+ expect ( out [ 0 ] . y ) . toEqual ( [ 1 , 2 ] ) ;
211+ expect ( out [ 0 ] . z ) . toEqual ( [ '0548-08-07' , '0548-09-19' ] ) ;
212+ } ) ;
213+
145214 it ( 'filters should handle geographical *lon* data' , function ( ) {
146215 var trace0 = {
147216 type : 'scattergeo' ,
0 commit comments