@@ -101,20 +101,23 @@ describe('scatterternary defaults', function() {
101101 expect ( traceOut . visible ) . toBe ( false ) ;
102102 } ) ;
103103
104- it ( 'should truncate data arrays to the same length (\'c\' is shortest case)' , function ( ) {
104+ it ( 'should not truncate data arrays to the same length (\'c\' is shortest case)' , function ( ) {
105+ // this is handled at the calc step now via _length.
105106 traceIn = {
106107 a : [ 1 , 2 , 3 ] ,
107108 b : [ 1 , 2 ] ,
108109 c : [ 1 ]
109110 } ;
110111
111112 supplyDefaults ( traceIn , traceOut , defaultColor , layout ) ;
112- expect ( traceOut . a ) . toEqual ( [ 1 ] ) ;
113- expect ( traceOut . b ) . toEqual ( [ 1 ] ) ;
113+ expect ( traceOut . a ) . toEqual ( [ 1 , 2 , 3 ] ) ;
114+ expect ( traceOut . b ) . toEqual ( [ 1 , 2 ] ) ;
114115 expect ( traceOut . c ) . toEqual ( [ 1 ] ) ;
116+ expect ( traceOut . _length ) . toBe ( 1 ) ;
115117 } ) ;
116118
117- it ( 'should truncate data arrays to the same length (\'a\' is shortest case)' , function ( ) {
119+ it ( 'should not truncate data arrays to the same length (\'a\' is shortest case)' , function ( ) {
120+ // this is handled at the calc step now via _length.
118121 traceIn = {
119122 a : [ 1 ] ,
120123 b : [ 1 , 2 , 3 ] ,
@@ -123,21 +126,24 @@ describe('scatterternary defaults', function() {
123126
124127 supplyDefaults ( traceIn , traceOut , defaultColor , layout ) ;
125128 expect ( traceOut . a ) . toEqual ( [ 1 ] ) ;
126- expect ( traceOut . b ) . toEqual ( [ 1 ] ) ;
127- expect ( traceOut . c ) . toEqual ( [ 1 ] ) ;
129+ expect ( traceOut . b ) . toEqual ( [ 1 , 2 , 3 ] ) ;
130+ expect ( traceOut . c ) . toEqual ( [ 1 , 2 ] ) ;
131+ expect ( traceOut . _length ) . toBe ( 1 ) ;
128132 } ) ;
129133
130- it ( 'should truncate data arrays to the same length (\'a\' is shortest case)' , function ( ) {
134+ it ( 'should not truncate data arrays to the same length (\'a\' is shortest case)' , function ( ) {
135+ // this is handled at the calc step now via _length.
131136 traceIn = {
132137 a : [ 1 , 2 ] ,
133138 b : [ 1 ] ,
134139 c : [ 1 , 2 , 3 ]
135140 } ;
136141
137142 supplyDefaults ( traceIn , traceOut , defaultColor , layout ) ;
138- expect ( traceOut . a ) . toEqual ( [ 1 ] ) ;
143+ expect ( traceOut . a ) . toEqual ( [ 1 , 2 ] ) ;
139144 expect ( traceOut . b ) . toEqual ( [ 1 ] ) ;
140- expect ( traceOut . c ) . toEqual ( [ 1 ] ) ;
145+ expect ( traceOut . c ) . toEqual ( [ 1 , 2 , 3 ] ) ;
146+ expect ( traceOut . _length ) . toBe ( 1 ) ;
141147 } ) ;
142148
143149 it ( 'should include \'name\' in \'hoverinfo\' default if multi trace graph' , function ( ) {
@@ -218,32 +224,39 @@ describe('scatterternary calc', function() {
218224
219225 trace = {
220226 subplot : 'ternary' ,
221- sum : 1
227+ sum : 1 ,
228+ _length : 3
222229 } ;
223230 } ) ;
224231
232+ function get ( cd , component ) {
233+ return cd . map ( function ( v ) {
234+ return v [ component ] ;
235+ } ) ;
236+ }
237+
225238 it ( 'should fill in missing component (case \'c\')' , function ( ) {
226239 trace . a = [ 0.1 , 0.3 , 0.6 ] ;
227240 trace . b = [ 0.3 , 0.6 , 0.1 ] ;
228241
229- calc ( gd , trace ) ;
230- expect ( trace . c ) . toBeCloseToArray ( [ 0.6 , 0.1 , 0.3 ] ) ;
242+ cd = calc ( gd , trace ) ;
243+ expect ( get ( cd , 'c' ) ) . toBeCloseToArray ( [ 0.6 , 0.1 , 0.3 ] ) ;
231244 } ) ;
232245
233246 it ( 'should fill in missing component (case \'b\')' , function ( ) {
234247 trace . a = [ 0.1 , 0.3 , 0.6 ] ;
235248 trace . c = [ 0.1 , 0.3 , 0.2 ] ;
236249
237- calc ( gd , trace ) ;
238- expect ( trace . b ) . toBeCloseToArray ( [ 0.8 , 0.4 , 0.2 ] ) ;
250+ cd = calc ( gd , trace ) ;
251+ expect ( get ( cd , 'b' ) ) . toBeCloseToArray ( [ 0.8 , 0.4 , 0.2 ] ) ;
239252 } ) ;
240253
241254 it ( 'should fill in missing component (case \'a\')' , function ( ) {
242255 trace . b = [ 0.1 , 0.3 , 0.6 ] ;
243256 trace . c = [ 0.8 , 0.4 , 0.1 ] ;
244257
245- calc ( gd , trace ) ;
246- expect ( trace . a ) . toBeCloseToArray ( [ 0.1 , 0.3 , 0.3 ] ) ;
258+ cd = calc ( gd , trace ) ;
259+ expect ( get ( cd , 'a' ) ) . toBeCloseToArray ( [ 0.1 , 0.3 , 0.3 ] ) ;
247260 } ) ;
248261
249262 it ( 'should skip over non-numeric values' , function ( ) {
0 commit comments