Skip to content

Commit bcc0ca1

Browse files
committed
use beforeEach(createGraphDiv) pattern in transform_multi
1 parent b2e5486 commit bcc0ca1

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

test/jasmine/tests/transform_multi_test.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ describe('user-defined transforms:', function() {
232232
describe('multiple transforms:', function() {
233233
'use strict';
234234

235+
var gd;
236+
237+
beforeEach(function() { gd = createGraphDiv(); });
238+
235239
var mockData0 = [{
236240
mode: 'markers',
237241
x: [1, -1, -2, 0, 1, 2, 3],
@@ -278,8 +282,6 @@ describe('multiple transforms:', function() {
278282
it('Plotly.plot should plot the transform traces', function(done) {
279283
var data = Lib.extendDeep([], mockData0);
280284

281-
var gd = createGraphDiv();
282-
283285
Plotly.plot(gd, data).then(function() {
284286
expect(gd.data.length).toEqual(1);
285287
expect(gd.data[0].x).toEqual([1, -1, -2, 0, 1, 2, 3]);
@@ -302,8 +304,6 @@ describe('multiple transforms:', function() {
302304

303305
data[0].transforms.slice().reverse();
304306

305-
var gd = createGraphDiv();
306-
307307
Plotly.plot(gd, data).then(function() {
308308
expect(gd.data.length).toEqual(1);
309309
expect(gd.data[0].x).toEqual([1, -1, -2, 0, 1, 2, 3]);
@@ -325,7 +325,6 @@ describe('multiple transforms:', function() {
325325
var data = Lib.extendDeep([], mockData0);
326326
data[0].marker = { size: 20 };
327327

328-
var gd = createGraphDiv();
329328
var dims = [2, 2];
330329

331330
Plotly.plot(gd, data).then(function() {
@@ -377,8 +376,6 @@ describe('multiple transforms:', function() {
377376
it('Plotly.extendTraces should work', function(done) {
378377
var data = Lib.extendDeep([], mockData0);
379378

380-
var gd = createGraphDiv();
381-
382379
Plotly.plot(gd, data).then(function() {
383380
expect(gd.data[0].x.length).toEqual(7);
384381
expect(gd._fullData[0].x.length).toEqual(2);
@@ -405,8 +402,6 @@ describe('multiple transforms:', function() {
405402
it('Plotly.deleteTraces should work', function(done) {
406403
var data = Lib.extendDeep([], mockData1);
407404

408-
var gd = createGraphDiv();
409-
410405
Plotly.plot(gd, data).then(function() {
411406
assertDims([2, 2, 2, 2]);
412407

@@ -425,8 +420,6 @@ describe('multiple transforms:', function() {
425420
it('toggling trace visibility should work', function(done) {
426421
var data = Lib.extendDeep([], mockData1);
427422

428-
var gd = createGraphDiv();
429-
430423
Plotly.plot(gd, data).then(function() {
431424
assertDims([2, 2, 2, 2]);
432425

0 commit comments

Comments
 (0)