@@ -259,7 +259,7 @@ describe('scattermapbox convert', function() {
259
259
lat : [ 20 , 20 , '10' , null , 10 , 10 , 20 ]
260
260
} ;
261
261
262
- it ( 'for markers + circle bubbles traces, should ' , function ( ) {
262
+ it ( 'should generate correct output for markers + circle bubbles traces' , function ( ) {
263
263
var opts = _convert ( Lib . extendFlat ( { } , base , {
264
264
mode : 'markers' ,
265
265
marker : {
@@ -276,12 +276,12 @@ describe('scattermapbox convert', function() {
276
276
stops : [
277
277
[ 0 , 'rgb(220, 220, 220)' ] , [ 1 , '#444' ] , [ 2 , 'rgb(178, 10, 28)' ]
278
278
]
279
- } , 'have correct circle-color stops' ) ;
279
+ } , 'circle-color stops' ) ;
280
280
281
281
expect ( opts . circle . paint [ 'circle-radius' ] ) . toEqual ( {
282
282
property : 'circle-radius' ,
283
283
stops : [ [ 0 , 5 ] , [ 1 , 10 ] , [ 2 , 0 ] ]
284
- } , 'have correct circle-radius stops' ) ;
284
+ } , 'circle-radius stops' ) ;
285
285
286
286
var circleProps = opts . circle . geojson . features . map ( function ( f ) {
287
287
return f . properties ;
@@ -294,10 +294,10 @@ describe('scattermapbox convert', function() {
294
294
{ 'circle-color' : 2 , 'circle-radius' : 2 } ,
295
295
{ 'circle-color' : 1 , 'circle-radius' : 2 } ,
296
296
{ 'circle-color' : 1 , 'circle-radius' : 2 }
297
- ] , 'have correct geojson feature properties' ) ;
297
+ ] , 'geojson feature properties' ) ;
298
298
} ) ;
299
299
300
- it ( 'fill + markers + lines traces, should ' , function ( ) {
300
+ it ( 'should generate correct output for fill + markers + lines traces' , function ( ) {
301
301
var opts = _convert ( Lib . extendFlat ( { } , base , {
302
302
mode : 'markers+lines' ,
303
303
marker : { symbol : 'circle' } ,
@@ -312,19 +312,19 @@ describe('scattermapbox convert', function() {
312
312
var lineCoords = [ segment1 , segment2 ] ,
313
313
fillCoords = [ [ segment1 ] , [ segment2 ] ] ;
314
314
315
- expect ( opts . line . geojson . coordinates ) . toEqual ( lineCoords , 'have correct line coords' ) ;
316
- expect ( opts . fill . geojson . coordinates ) . toEqual ( fillCoords , 'have correct fill coords' ) ;
315
+ expect ( opts . line . geojson . coordinates ) . toEqual ( lineCoords , 'line coords' ) ;
316
+ expect ( opts . fill . geojson . coordinates ) . toEqual ( fillCoords , 'fill coords' ) ;
317
317
318
318
var circleCoords = opts . circle . geojson . features . map ( function ( f ) {
319
319
return f . geometry . coordinates ;
320
320
} ) ;
321
321
322
322
expect ( circleCoords ) . toEqual ( [
323
323
[ 10 , 20 ] , [ 20 , 20 ] , [ 30 , 10 ] , [ 20 , 10 ] , [ 10 , 20 ]
324
- ] , 'have correct circle coords' ) ;
324
+ ] , 'circle coords' ) ;
325
325
} ) ;
326
326
327
- it ( 'for markers + non-circle traces, should ' , function ( ) {
327
+ it ( 'should generate correct output for markers + non-circle traces' , function ( ) {
328
328
var opts = _convert ( Lib . extendFlat ( { } , base , {
329
329
mode : 'markers' ,
330
330
marker : { symbol : 'monument' }
@@ -340,10 +340,10 @@ describe('scattermapbox convert', function() {
340
340
return [ 'monument' , '' ] ;
341
341
} ) ;
342
342
343
- expect ( symbolProps ) . toEqual ( expected , 'have correct geojson properties' ) ;
343
+ expect ( symbolProps ) . toEqual ( expected , 'geojson properties' ) ;
344
344
} ) ;
345
345
346
- it ( 'for text + lines traces, should ' , function ( ) {
346
+ it ( 'should generate correct output for text + lines traces' , function ( ) {
347
347
var opts = _convert ( Lib . extendFlat ( { } , base , {
348
348
mode : 'lines+text' ,
349
349
connectgaps : true ,
@@ -356,7 +356,7 @@ describe('scattermapbox convert', function() {
356
356
[ 10 , 20 ] , [ 20 , 20 ] , [ 30 , 10 ] , [ 20 , 10 ] , [ 10 , 20 ]
357
357
] ;
358
358
359
- expect ( opts . line . geojson . coordinates ) . toEqual ( lineCoords , 'have correct line coords' ) ;
359
+ expect ( opts . line . geojson . coordinates ) . toEqual ( lineCoords , 'line coords' ) ;
360
360
361
361
var actualText = opts . symbol . geojson . features . map ( function ( f ) {
362
362
return f . properties . text ;
@@ -365,6 +365,23 @@ describe('scattermapbox convert', function() {
365
365
expect ( actualText ) . toEqual ( [ 'A' , 'B' , 'C' , 'F' , '' ] ) ;
366
366
} ) ;
367
367
368
+ it ( 'should generate correct output for lines traces with trailing gaps' , function ( ) {
369
+ var opts = _convert ( Lib . extendFlat ( { } , base , {
370
+ mode : 'lines' ,
371
+ lon : [ 10 , '20' , 30 , 20 , null , 20 , 10 , null , null ] ,
372
+ lat : [ 20 , 20 , '10' , null , 10 , 10 , 20 , null ]
373
+ } ) ) ;
374
+
375
+ assertVisibility ( opts , [ 'none' , 'visible' , 'none' , 'none' ] ) ;
376
+
377
+ var lineCoords = [
378
+ [ [ 10 , 20 ] , [ 20 , 20 ] , [ 30 , 10 ] ] ,
379
+ [ [ 20 , 10 ] , [ 10 , 20 ] ]
380
+ ] ;
381
+
382
+ expect ( opts . line . geojson . coordinates ) . toEqual ( lineCoords , 'have correct line coords' ) ;
383
+ } ) ;
384
+
368
385
it ( 'should correctly convert \'textposition\' to \'text-anchor\' and \'text-offset\'' , function ( ) {
369
386
var specs = {
370
387
'top left' : [ 'top-right' , [ - 0.65 , - 1.65 ] ] ,
@@ -395,15 +412,15 @@ describe('scattermapbox convert', function() {
395
412
} ) ;
396
413
} ) ;
397
414
398
- it ( 'for markers + circle bubbles traces with repeated values, should ' , function ( ) {
415
+ it ( 'should generate correct output for markers + circle bubbles traces with repeated values' , function ( ) {
399
416
var opts = _convert ( Lib . extendFlat ( { } , base , {
400
417
lon : [ '-96.796988' , '-81.379236' , '-85.311819' , '' ] ,
401
418
lat : [ '32.776664' , '28.538335' , '35.047157' , '' ] ,
402
419
marker : { size : [ '5' , '49' , '5' , '' ] }
403
420
} ) ) ;
404
421
405
422
expect ( opts . circle . paint [ 'circle-radius' ] . stops )
406
- . toBeCloseTo2DArray ( [ [ 0 , 2.5 ] , [ 1 , 24.5 ] ] , 'not replicate stops' ) ;
423
+ . toBeCloseTo2DArray ( [ [ 0 , 2.5 ] , [ 1 , 24.5 ] ] , 'no replicate stops' ) ;
407
424
408
425
var radii = opts . circle . geojson . features . map ( function ( f ) {
409
426
return f . properties [ 'circle-radius' ] ;
@@ -412,7 +429,7 @@ describe('scattermapbox convert', function() {
412
429
expect ( radii ) . toBeCloseToArray ( [ 0 , 1 , 0 ] , 'link features to correct stops' ) ;
413
430
} ) ;
414
431
415
- it ( 'for input only blank pts ' , function ( ) {
432
+ it ( 'should generate correct output for traces with only blank points ' , function ( ) {
416
433
var opts = _convert ( Lib . extendFlat ( { } , base , {
417
434
mode : 'lines' ,
418
435
lon : [ '' , null ] ,
@@ -422,18 +439,16 @@ describe('scattermapbox convert', function() {
422
439
423
440
assertVisibility ( opts , [ 'none' , 'none' , 'none' , 'none' ] ) ;
424
441
425
- expect ( opts . line . geojson . coordinates ) . toEqual ( [ ] , 'have correct line coords' ) ;
426
- expect ( opts . fill . geojson . coordinates ) . toEqual ( [ ] , 'have correct fill coords' ) ;
442
+ expect ( opts . line . geojson . coordinates ) . toEqual ( [ ] , 'line coords' ) ;
443
+ expect ( opts . fill . geojson . coordinates ) . toEqual ( [ ] , 'fill coords' ) ;
427
444
} ) ;
428
445
429
446
function assertVisibility ( opts , expectations ) {
430
447
var actual = [ 'fill' , 'line' , 'circle' , 'symbol' ] . map ( function ( l ) {
431
448
return opts [ l ] . layout . visibility ;
432
449
} ) ;
433
450
434
- var msg = 'set layer visibility properly' ;
435
-
436
- expect ( actual ) . toEqual ( expectations , msg ) ;
451
+ expect ( actual ) . toEqual ( expectations , 'layer visibility' ) ;
437
452
}
438
453
} ) ;
439
454
0 commit comments