Skip to content

Commit e92ca98

Browse files
committed
cleanup legend relayout tests
1 parent 6b2b63b commit e92ca98

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

test/jasmine/tests/legend_test.js

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -591,17 +591,15 @@ describe('legend anchor utils:', function() {
591591
});
592592

593593
describe('legend relayout update', function() {
594-
'use strict';
595594
var gd;
596-
var mock = require('@mocks/0.json');
597595

598596
beforeEach(function() {
599597
gd = createGraphDiv();
600598
});
601599
afterEach(destroyGraphDiv);
602600

603601
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: {
605603
legend: {x: 1.1, xanchor: 'left'},
606604
margin: {l: 50, r: 50, pad: 0},
607605
width: 500
@@ -633,7 +631,7 @@ describe('legend relayout update', function() {
633631
});
634632

635633
it('should update border styling', function(done) {
636-
var mockCopy = Lib.extendDeep({}, mock);
634+
var mockCopy = Lib.extendDeep({}, require('@mocks/0.json'));
637635

638636
function assertLegendStyle(bgColor, borderColor, borderWidth) {
639637
var node = d3.select('g.legend').select('rect').node();
@@ -670,21 +668,13 @@ describe('legend relayout update', function() {
670668
});
671669

672670
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-
681671
function markerOffsetY() {
682672
var translate = Drawing.getTranslate(d3.select('.legend .traces .layers'));
683673
return translate.y;
684674
}
685675

686676
it('it should translate markers', function(done) {
687-
var mockCopy = Lib.extendDeep({}, mock);
677+
var mockCopy = Lib.extendDeep({}, require('@mocks/legend_valign_top.json'));
688678

689679
var top, middle, bottom;
690680
Plotly.plot(gd, mockCopy.data, mockCopy.layout)
@@ -707,16 +697,8 @@ describe('legend relayout update', function() {
707697
});
708698

709699
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-
718700
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'));
720702
Plotly.newPlot(gd, mockCopy)
721703
.then(function() {
722704
expect(gd._fullLayout._size.b).toBe(113);

0 commit comments

Comments
 (0)