@@ -591,17 +591,15 @@ describe('legend anchor utils:', function() {
591
591
} ) ;
592
592
593
593
describe ( 'legend relayout update' , function ( ) {
594
- 'use strict' ;
595
594
var gd ;
596
- var mock = require ( '@mocks/0.json' ) ;
597
595
598
596
beforeEach ( function ( ) {
599
597
gd = createGraphDiv ( ) ;
600
598
} ) ;
601
599
afterEach ( destroyGraphDiv ) ;
602
600
603
601
it ( 'should hide and show the legend' , function ( done ) {
604
- var mockCopy = Lib . extendDeep ( { } , mock , { layout : {
602
+ var mockCopy = Lib . extendDeep ( { } , require ( '@mocks/0.json' ) , { layout : {
605
603
legend : { x : 1.1 , xanchor : 'left' } ,
606
604
margin : { l : 50 , r : 50 , pad : 0 } ,
607
605
width : 500
@@ -633,7 +631,7 @@ describe('legend relayout update', function() {
633
631
} ) ;
634
632
635
633
it ( 'should update border styling' , function ( done ) {
636
- var mockCopy = Lib . extendDeep ( { } , mock ) ;
634
+ var mockCopy = Lib . extendDeep ( { } , require ( '@mocks/0.json' ) ) ;
637
635
638
636
function assertLegendStyle ( bgColor , borderColor , borderWidth ) {
639
637
var node = d3 . select ( 'g.legend' ) . select ( 'rect' ) . node ( ) ;
@@ -670,21 +668,13 @@ describe('legend relayout update', function() {
670
668
} ) ;
671
669
672
670
describe ( 'should update legend valign' , function ( ) {
673
- var mock = require ( '@mocks/legend_valign_top.json' ) ;
674
- var gd ;
675
-
676
- beforeEach ( function ( ) {
677
- gd = createGraphDiv ( ) ;
678
- } ) ;
679
- afterEach ( destroyGraphDiv ) ;
680
-
681
671
function markerOffsetY ( ) {
682
672
var translate = Drawing . getTranslate ( d3 . select ( '.legend .traces .layers' ) ) ;
683
673
return translate . y ;
684
674
}
685
675
686
676
it ( 'it should translate markers' , function ( done ) {
687
- var mockCopy = Lib . extendDeep ( { } , mock ) ;
677
+ var mockCopy = Lib . extendDeep ( { } , require ( '@mocks/legend_valign_top.json' ) ) ;
688
678
689
679
var top , middle , bottom ;
690
680
Plotly . plot ( gd , mockCopy . data , mockCopy . layout )
@@ -707,16 +697,8 @@ describe('legend relayout update', function() {
707
697
} ) ;
708
698
709
699
describe ( 'with legendgroup' , function ( ) {
710
- var mock = require ( '@mocks/legendgroup_horizontal_wrapping.json' ) ;
711
- var gd ;
712
-
713
- beforeEach ( function ( ) {
714
- gd = createGraphDiv ( ) ;
715
- } ) ;
716
- afterEach ( destroyGraphDiv ) ;
717
-
718
700
it ( 'changes the margin size to fit tracegroupgap' , function ( done ) {
719
- var mockCopy = Lib . extendDeep ( { } , mock ) ;
701
+ var mockCopy = Lib . extendDeep ( { } , require ( '@mocks/legendgroup_horizontal_wrapping.json' ) ) ;
720
702
Plotly . newPlot ( gd , mockCopy )
721
703
. then ( function ( ) {
722
704
expect ( gd . _fullLayout . _size . b ) . toBe ( 113 ) ;
0 commit comments