Skip to content

Commit 69345fc

Browse files
committed
Eliminate unnecesary closure in parameterized test
1 parent 095ce0c commit 69345fc

File tree

1 file changed

+42
-44
lines changed

1 file changed

+42
-44
lines changed

test/jasmine/tests/axes_test.js

+42-44
Original file line numberDiff line numberDiff line change
@@ -8253,50 +8253,48 @@ fdescribe('test tickmode calculator', function() {
82538253
}
82548254

82558255
describe('arrayTicks', function() {
8256-
for(let i = 0; i < 4; i++) {
8257-
(function(i) {
8258-
it('should return the specified correct number of major ticks and minor ticks', function(done) {
8259-
const BOTH = 0;
8260-
const MAJOR = 1;
8261-
const MINOR = 2;
8262-
const NEITHER = 3;
8263-
var xMajorConfig = ticksOff;
8264-
var xMinorConfig = ticksOff;
8265-
if(i == BOTH) {
8266-
xMajorConfig = generateTickConfig();
8267-
xMinorConfig = generateTickConfig();
8268-
} else if(i == MAJOR) {
8269-
xMajorConfig = generateTickConfig();
8270-
} else if(i==MINOR) {
8271-
xMinorConfig = generateTickConfig();
8272-
} else if(i == NEITHER) {
8273-
// Do nothing, all ticks off
8256+
it('should return the specified correct number of major ticks and minor ticks', function(done) {
8257+
for(let i = 0; i < 4; i++) {
8258+
const BOTH = 0;
8259+
const MAJOR = 1;
8260+
const MINOR = 2;
8261+
const NEITHER = 3;
8262+
var xMajorConfig = ticksOff;
8263+
var xMinorConfig = ticksOff;
8264+
if(i == BOTH) {
8265+
xMajorConfig = generateTickConfig();
8266+
xMinorConfig = generateTickConfig();
8267+
} else if(i == MAJOR) {
8268+
xMajorConfig = generateTickConfig();
8269+
} else if(i==MINOR) {
8270+
xMinorConfig = generateTickConfig();
8271+
} else if(i == NEITHER) {
8272+
// Do nothing, all ticks off
8273+
}
8274+
Plotly.newPlot(gd, {
8275+
data: [{
8276+
x: [0, 1],
8277+
y: [0, 1]
8278+
}],
8279+
layout: {
8280+
width: 400,
8281+
height: 400,
8282+
margin: {
8283+
t: 40,
8284+
b: 40,
8285+
l: 40,
8286+
r: 40
8287+
},
8288+
xaxis: {
8289+
range: [0, 1000],
8290+
...xMajorConfig,
8291+
minor: xMinorConfig,
8292+
},
82748293
}
8275-
Plotly.newPlot(gd, {
8276-
data: [{
8277-
x: [0, 1],
8278-
y: [0, 1]
8279-
}],
8280-
layout: {
8281-
width: 400,
8282-
height: 400,
8283-
margin: {
8284-
t: 40,
8285-
b: 40,
8286-
l: 40,
8287-
r: 40
8288-
},
8289-
xaxis: {
8290-
range: [0, 1000],
8291-
...xMajorConfig,
8292-
minor: xMinorConfig,
8293-
},
8294-
}
8295-
}).then(function() {
8296-
_assert(xMajorConfig.tickvals.length + xMinorConfig.tickvals.length);
8297-
}).then(done, done.fail);
8298-
});
8299-
})(i);
8300-
}
8294+
}).then(function() {
8295+
_assert(xMajorConfig.tickvals.length + xMinorConfig.tickvals.length);
8296+
}).then(done, done.fail);
8297+
}
8298+
});
83018299
});
83028300
});

0 commit comments

Comments
 (0)