@@ -420,25 +420,54 @@ describe('Test geo interactions', function() {
420420 } ) ;
421421
422422 describe ( 'scattergeo hover labels' , function ( ) {
423- beforeEach ( function ( ) {
424- mouseEventScatterGeo ( 'mousemove' ) ;
425- } ) ;
426-
427423 it ( 'should show one hover text group' , function ( ) {
424+ mouseEventScatterGeo ( 'mousemove' ) ;
428425 expect ( d3 . selectAll ( 'g.hovertext' ) . size ( ) ) . toEqual ( 1 ) ;
429426 } ) ;
430427
431428 it ( 'should show longitude and latitude values' , function ( ) {
432- var node = d3 . selectAll ( 'g.hovertext' ) . selectAll ( 'tspan' ) [ 0 ] [ 0 ] ;
429+ mouseEventScatterGeo ( 'mousemove' ) ;
433430
431+ var node = d3 . selectAll ( 'g.hovertext' ) . selectAll ( 'tspan' ) [ 0 ] [ 0 ] ;
434432 expect ( node . innerHTML ) . toEqual ( '(0°, 0°)' ) ;
435433 } ) ;
436434
437435 it ( 'should show the trace name' , function ( ) {
438- var node = d3 . selectAll ( 'g.hovertext' ) . selectAll ( 'text' ) [ 0 ] [ 0 ] ;
436+ mouseEventScatterGeo ( 'mousemove' ) ;
439437
438+ var node = d3 . selectAll ( 'g.hovertext' ) . selectAll ( 'text' ) [ 0 ] [ 0 ] ;
440439 expect ( node . innerHTML ) . toEqual ( 'trace 0' ) ;
441440 } ) ;
441+
442+ it ( 'should show *text* (case 1)' , function ( done ) {
443+ Plotly . restyle ( gd , 'text' , [ [ 'A' , 'B' ] ] ) . then ( function ( ) {
444+ mouseEventScatterGeo ( 'mousemove' ) ;
445+
446+ var node = d3 . selectAll ( 'g.hovertext' ) . selectAll ( 'tspan' ) [ 0 ] [ 1 ] ;
447+ expect ( node . innerHTML ) . toEqual ( 'A' ) ;
448+ } )
449+ . then ( done ) ;
450+ } ) ;
451+
452+ it ( 'should show *text* (case 2)' , function ( done ) {
453+ Plotly . restyle ( gd , 'text' , [ [ null , 'B' ] ] ) . then ( function ( ) {
454+ mouseEventScatterGeo ( 'mousemove' ) ;
455+
456+ var node = d3 . selectAll ( 'g.hovertext' ) . selectAll ( 'tspan' ) [ 0 ] [ 1 ] ;
457+ expect ( node ) . toBeUndefined ( ) ;
458+ } )
459+ . then ( done ) ;
460+ } ) ;
461+
462+ it ( 'should show *text* (case 3)' , function ( done ) {
463+ Plotly . restyle ( gd , 'text' , [ [ '' , 'B' ] ] ) . then ( function ( ) {
464+ mouseEventScatterGeo ( 'mousemove' ) ;
465+
466+ var node = d3 . selectAll ( 'g.hovertext' ) . selectAll ( 'tspan' ) [ 0 ] [ 1 ] ;
467+ expect ( node ) . toBeUndefined ( ) ;
468+ } )
469+ . then ( done ) ;
470+ } ) ;
442471 } ) ;
443472
444473 describe ( 'scattergeo hover events' , function ( ) {
0 commit comments