@@ -190,6 +190,41 @@ describe('Test colorscale:', function() {
190
190
expect ( hasColorscale ( trace , 'marker' ) ) . toBe ( true ) ;
191
191
expect ( hasColorscale ( trace , 'marker.line' ) ) . toBe ( true ) ;
192
192
} ) ;
193
+
194
+ it ( 'should return true when marker color is a typed array with at least one non-NaN' , function ( ) {
195
+ trace = {
196
+ marker : {
197
+ color : new Float32Array ( [ 1 , 2 , 3 ] ) ,
198
+ line : {
199
+ color : new Float32Array ( [ 2 , 3 , 4 ] )
200
+ }
201
+ }
202
+ } ;
203
+ expect ( hasColorscale ( trace , 'marker' ) ) . toBe ( true ) ;
204
+ expect ( hasColorscale ( trace , 'marker.line' ) ) . toBe ( true ) ;
205
+
206
+ trace = {
207
+ marker : {
208
+ color : new Float32Array ( [ 1 , NaN , 3 ] ) ,
209
+ line : {
210
+ color : new Float32Array ( [ 2 , 3 , NaN ] )
211
+ }
212
+ }
213
+ } ;
214
+ expect ( hasColorscale ( trace , 'marker' ) ) . toBe ( true ) ;
215
+ expect ( hasColorscale ( trace , 'marker.line' ) ) . toBe ( true ) ;
216
+
217
+ trace = {
218
+ marker : {
219
+ color : new Float32Array ( [ NaN , undefined , 'not-a-number' ] ) ,
220
+ line : {
221
+ color : new Float32Array ( [ 'not-a-number' , NaN , undefined ] )
222
+ }
223
+ }
224
+ } ;
225
+ expect ( hasColorscale ( trace , 'marker' ) ) . toBe ( false ) ;
226
+ expect ( hasColorscale ( trace , 'marker.line' ) ) . toBe ( false ) ;
227
+ } ) ;
193
228
} ) ;
194
229
195
230
describe ( 'handleDefaults (heatmap-like version)' , function ( ) {
0 commit comments