@@ -528,19 +528,10 @@ describe('heatmap hover', function() {
528
528
529
529
var gd ;
530
530
531
- beforeAll ( function ( done ) {
531
+ beforeAll ( function ( ) {
532
532
jasmine . addMatchers ( customMatchers ) ;
533
-
534
- gd = createGraphDiv ( ) ;
535
-
536
- var mock = require ( '@mocks/heatmap_multi-trace.json' ) ,
537
- mockCopy = Lib . extendDeep ( { } , mock ) ;
538
-
539
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( done ) ;
540
533
} ) ;
541
534
542
- afterAll ( destroyGraphDiv ) ;
543
-
544
535
function _hover ( gd , xval , yval ) {
545
536
var fullLayout = gd . _fullLayout ,
546
537
calcData = gd . calcdata ,
@@ -563,24 +554,39 @@ describe('heatmap hover', function() {
563
554
return hoverData ;
564
555
}
565
556
566
- function assertLabels ( hoverPoint , xLabel , yLabel , zLabel ) {
557
+ function assertLabels ( hoverPoint , xLabel , yLabel , zLabel , text ) {
567
558
expect ( hoverPoint . xLabelVal ) . toEqual ( xLabel , 'have correct x label' ) ;
568
559
expect ( hoverPoint . yLabelVal ) . toEqual ( yLabel , 'have correct y label' ) ;
569
560
expect ( hoverPoint . zLabelVal ) . toEqual ( zLabel , 'have correct z label' ) ;
561
+ expect ( hoverPoint . text ) . toEqual ( text , 'have correct text label' ) ;
570
562
}
571
563
572
- it ( 'should find closest point (case 1) and should' , function ( ) {
573
- var pt = _hover ( gd , 0.5 , 0.5 ) [ 0 ] ;
564
+ describe ( 'for `heatmap_multi-trace`' , function ( ) {
574
565
575
- expect ( pt . index ) . toEqual ( [ 1 , 0 ] , 'have correct index' ) ;
576
- assertLabels ( pt , 1 , 1 , 4 ) ;
577
- } ) ;
566
+ beforeAll ( function ( done ) {
567
+ gd = createGraphDiv ( ) ;
578
568
579
- it ( 'should find closest point (case 2) and should' , function ( ) {
580
- var pt = _hover ( gd , 1.5 , 0.5 ) [ 0 ] ;
569
+ var mock = require ( '@mocks/heatmap_multi-trace.json' ) ,
570
+ mockCopy = Lib . extendDeep ( { } , mock ) ;
581
571
582
- expect ( pt . index ) . toEqual ( [ 0 , 0 ] , 'have correct index' ) ;
583
- assertLabels ( pt , 2 , 0.2 , 6 ) ;
572
+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( done ) ;
573
+ } ) ;
574
+
575
+ afterAll ( destroyGraphDiv ) ;
576
+
577
+ it ( 'should find closest point (case 1) and should' , function ( ) {
578
+ var pt = _hover ( gd , 0.5 , 0.5 ) [ 0 ] ;
579
+
580
+ expect ( pt . index ) . toEqual ( [ 1 , 0 ] , 'have correct index' ) ;
581
+ assertLabels ( pt , 1 , 1 , 4 ) ;
582
+ } ) ;
583
+
584
+ it ( 'should find closest point (case 2) and should' , function ( ) {
585
+ var pt = _hover ( gd , 1.5 , 0.5 ) [ 0 ] ;
586
+
587
+ expect ( pt . index ) . toEqual ( [ 0 , 0 ] , 'have correct index' ) ;
588
+ assertLabels ( pt , 2 , 0.2 , 6 ) ;
589
+ } ) ;
584
590
} ) ;
585
591
586
592
} ) ;
0 commit comments