@@ -259,7 +259,7 @@ describe('scattermapbox convert', function() {
259259 lat : [ 20 , 20 , '10' , null , 10 , 10 , 20 ]
260260 } ;
261261
262- it ( 'for markers + circle bubbles traces, should ' , function ( ) {
262+ it ( 'should generate correct output for markers + circle bubbles traces' , function ( ) {
263263 var opts = _convert ( Lib . extendFlat ( { } , base , {
264264 mode : 'markers' ,
265265 marker : {
@@ -276,12 +276,12 @@ describe('scattermapbox convert', function() {
276276 stops : [
277277 [ 0 , 'rgb(220, 220, 220)' ] , [ 1 , '#444' ] , [ 2 , 'rgb(178, 10, 28)' ]
278278 ]
279- } , 'have correct circle-color stops' ) ;
279+ } , 'circle-color stops' ) ;
280280
281281 expect ( opts . circle . paint [ 'circle-radius' ] ) . toEqual ( {
282282 property : 'circle-radius' ,
283283 stops : [ [ 0 , 5 ] , [ 1 , 10 ] , [ 2 , 0 ] ]
284- } , 'have correct circle-radius stops' ) ;
284+ } , 'circle-radius stops' ) ;
285285
286286 var circleProps = opts . circle . geojson . features . map ( function ( f ) {
287287 return f . properties ;
@@ -294,10 +294,10 @@ describe('scattermapbox convert', function() {
294294 { 'circle-color' : 2 , 'circle-radius' : 2 } ,
295295 { 'circle-color' : 1 , 'circle-radius' : 2 } ,
296296 { 'circle-color' : 1 , 'circle-radius' : 2 }
297- ] , 'have correct geojson feature properties' ) ;
297+ ] , 'geojson feature properties' ) ;
298298 } ) ;
299299
300- it ( 'fill + markers + lines traces, should ' , function ( ) {
300+ it ( 'should generate correct output for fill + markers + lines traces' , function ( ) {
301301 var opts = _convert ( Lib . extendFlat ( { } , base , {
302302 mode : 'markers+lines' ,
303303 marker : { symbol : 'circle' } ,
@@ -312,19 +312,19 @@ describe('scattermapbox convert', function() {
312312 var lineCoords = [ segment1 , segment2 ] ,
313313 fillCoords = [ [ segment1 ] , [ segment2 ] ] ;
314314
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' ) ;
317317
318318 var circleCoords = opts . circle . geojson . features . map ( function ( f ) {
319319 return f . geometry . coordinates ;
320320 } ) ;
321321
322322 expect ( circleCoords ) . toEqual ( [
323323 [ 10 , 20 ] , [ 20 , 20 ] , [ 30 , 10 ] , [ 20 , 10 ] , [ 10 , 20 ]
324- ] , 'have correct circle coords' ) ;
324+ ] , 'circle coords' ) ;
325325 } ) ;
326326
327- it ( 'for markers + non-circle traces, should ' , function ( ) {
327+ it ( 'should generate correct output for markers + non-circle traces' , function ( ) {
328328 var opts = _convert ( Lib . extendFlat ( { } , base , {
329329 mode : 'markers' ,
330330 marker : { symbol : 'monument' }
@@ -340,10 +340,10 @@ describe('scattermapbox convert', function() {
340340 return [ 'monument' , '' ] ;
341341 } ) ;
342342
343- expect ( symbolProps ) . toEqual ( expected , 'have correct geojson properties' ) ;
343+ expect ( symbolProps ) . toEqual ( expected , 'geojson properties' ) ;
344344 } ) ;
345345
346- it ( 'for text + lines traces, should ' , function ( ) {
346+ it ( 'should generate correct output for text + lines traces' , function ( ) {
347347 var opts = _convert ( Lib . extendFlat ( { } , base , {
348348 mode : 'lines+text' ,
349349 connectgaps : true ,
@@ -356,7 +356,7 @@ describe('scattermapbox convert', function() {
356356 [ 10 , 20 ] , [ 20 , 20 ] , [ 30 , 10 ] , [ 20 , 10 ] , [ 10 , 20 ]
357357 ] ;
358358
359- expect ( opts . line . geojson . coordinates ) . toEqual ( lineCoords , 'have correct line coords' ) ;
359+ expect ( opts . line . geojson . coordinates ) . toEqual ( lineCoords , 'line coords' ) ;
360360
361361 var actualText = opts . symbol . geojson . features . map ( function ( f ) {
362362 return f . properties . text ;
@@ -365,6 +365,23 @@ describe('scattermapbox convert', function() {
365365 expect ( actualText ) . toEqual ( [ 'A' , 'B' , 'C' , 'F' , '' ] ) ;
366366 } ) ;
367367
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+
368385 it ( 'should correctly convert \'textposition\' to \'text-anchor\' and \'text-offset\'' , function ( ) {
369386 var specs = {
370387 'top left' : [ 'top-right' , [ - 0.65 , - 1.65 ] ] ,
@@ -395,15 +412,15 @@ describe('scattermapbox convert', function() {
395412 } ) ;
396413 } ) ;
397414
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 ( ) {
399416 var opts = _convert ( Lib . extendFlat ( { } , base , {
400417 lon : [ '-96.796988' , '-81.379236' , '-85.311819' , '' ] ,
401418 lat : [ '32.776664' , '28.538335' , '35.047157' , '' ] ,
402419 marker : { size : [ '5' , '49' , '5' , '' ] }
403420 } ) ) ;
404421
405422 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' ) ;
407424
408425 var radii = opts . circle . geojson . features . map ( function ( f ) {
409426 return f . properties [ 'circle-radius' ] ;
@@ -412,7 +429,7 @@ describe('scattermapbox convert', function() {
412429 expect ( radii ) . toBeCloseToArray ( [ 0 , 1 , 0 ] , 'link features to correct stops' ) ;
413430 } ) ;
414431
415- it ( 'for input only blank pts ' , function ( ) {
432+ it ( 'should generate correct output for traces with only blank points ' , function ( ) {
416433 var opts = _convert ( Lib . extendFlat ( { } , base , {
417434 mode : 'lines' ,
418435 lon : [ '' , null ] ,
@@ -422,18 +439,16 @@ describe('scattermapbox convert', function() {
422439
423440 assertVisibility ( opts , [ 'none' , 'none' , 'none' , 'none' ] ) ;
424441
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' ) ;
427444 } ) ;
428445
429446 function assertVisibility ( opts , expectations ) {
430447 var actual = [ 'fill' , 'line' , 'circle' , 'symbol' ] . map ( function ( l ) {
431448 return opts [ l ] . layout . visibility ;
432449 } ) ;
433450
434- var msg = 'set layer visibility properly' ;
435-
436- expect ( actual ) . toEqual ( expectations , msg ) ;
451+ expect ( actual ) . toEqual ( expectations , 'layer visibility' ) ;
437452 }
438453} ) ;
439454
0 commit comments