@@ -71,10 +71,6 @@ describe('Test choroplethmapbox defaults:', function() {
7171 ] ) ;
7272 expectVisibleFalse ( ) ;
7373 } ) ;
74-
75- it ( 'should accept typed arrays' , function ( ) {
76-
77- } ) ;
7874} ) ;
7975
8076describe ( 'Test choroplethmapbox convert:' , function ( ) {
@@ -219,6 +215,48 @@ describe('Test choroplethmapbox convert:', function() {
219215 expect ( Lib . log ) . toHaveBeenCalledWith ( 'Location with id d does not have a matching feature' ) ;
220216 } ) ;
221217
218+ describe ( 'should accept numbers as *locations* items' , function ( ) {
219+ function _assert ( act ) {
220+ expect ( act . fill . layout . visibility ) . toBe ( 'visible' , 'fill layer visibility' ) ;
221+ expect ( act . line . layout . visibility ) . toBe ( 'visible' , 'line layer visibility' ) ;
222+ expect ( act . geojson . features . length ) . toBe ( 3 , '# of visible features' ) ;
223+ expect ( extract ( act , 'fc' ) )
224+ . toEqual ( [ 'rgb(178, 10, 28)' , 'rgb(220, 220, 220)' , 'rgb(240, 149, 99)' ] ) ;
225+ }
226+
227+ it ( '- regular array case' , function ( ) {
228+ var trace = {
229+ locations : [ 1 , 2 , 3 ] ,
230+ z : [ 20 , 10 , 2 ] ,
231+ geojson : {
232+ type : 'FeatureCollection' ,
233+ features : [
234+ { type : 'Feature' , id : '1' , geometry : { type : 'Polygon' , coordinates : [ ] } } ,
235+ { type : 'Feature' , id : '3' , geometry : { type : 'Polygon' , coordinates : [ ] } } ,
236+ { type : 'Feature' , id : '2' , geometry : { type : 'Polygon' , coordinates : [ ] } }
237+ ]
238+ }
239+ } ;
240+ _assert ( _convert ( trace ) ) ;
241+ } ) ;
242+
243+ it ( '- typed array case' , function ( ) {
244+ var trace = {
245+ locations : new Float32Array ( [ 1 , 2 , 3 ] ) ,
246+ z : new Float32Array ( [ 20 , 10 , 2 ] ) ,
247+ geojson : {
248+ type : 'FeatureCollection' ,
249+ features : [
250+ { type : 'Feature' , id : 1 , geometry : { type : 'Polygon' , coordinates : [ ] } } ,
251+ { type : 'Feature' , id : 3 , geometry : { type : 'Polygon' , coordinates : [ ] } } ,
252+ { type : 'Feature' , id : 2 , geometry : { type : 'Polygon' , coordinates : [ ] } }
253+ ]
254+ }
255+ } ;
256+ _assert ( _convert ( trace ) ) ;
257+ } ) ;
258+ } ) ;
259+
222260 it ( 'should handle *Feature* on 1-item *FeatureCollection* the same way' , function ( ) {
223261 var locations = [ 'a' ] ;
224262 var z = [ 1 ] ;
0 commit comments