File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,45 @@ describe('one-to-one transforms:', function() {
9797 } , '- trace second' ) ;
9898 } ) ;
9999
100+ it ( 'should pass correctly arguments to transform methods' , function ( ) {
101+ var transformIn = { type : 'fake' } ;
102+ var transformOut = { } ;
103+
104+ var dataIn = [ {
105+ transforms : [ transformIn ]
106+ } ] ;
107+
108+ var layout = { } ;
109+
110+ function assertSupplyDefaultsArgs ( _transformIn , traceOut , _layout ) {
111+ expect ( _transformIn ) . toBe ( transformIn ) ;
112+ expect ( _layout ) . toBe ( layout ) ;
113+
114+ return transformOut ;
115+ }
116+
117+ function assertTransformArgs ( dataOut , opts ) {
118+ expect ( dataOut [ 0 ] . _input ) . toBe ( dataIn [ 0 ] ) ;
119+ expect ( opts . transform ) . toBe ( transformOut ) ;
120+ expect ( opts . fullTrace . _input ) . toBe ( dataIn [ 0 ] ) ;
121+ expect ( opts . layout ) . toBe ( layout ) ;
122+
123+ return dataOut ;
124+ }
125+
126+ var fakeTransformModule = {
127+ moduleType : 'transform' ,
128+ name : 'fake' ,
129+ attributes : { } ,
130+ supplyDefaults : assertSupplyDefaultsArgs ,
131+ transform : assertTransformArgs
132+ } ;
133+
134+ Plotly . register ( fakeTransformModule ) ;
135+ Plots . supplyDataDefaults ( dataIn , [ ] , layout ) ;
136+ delete Plots . transformsRegistry . fake ;
137+ } ) ;
138+
100139 it ( 'supplyDataDefaults should apply the transform while' , function ( ) {
101140 var dataIn = [ {
102141 x : [ - 2 , - 2 , 1 , 2 , 3 ] ,
You can’t perform that action at this time.
0 commit comments