Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 05f4722

Browse files
committed
check_texttemplate: put @gl tests in its own it block
1 parent 2d50269 commit 05f4722

File tree

1 file changed

+34
-18
lines changed

1 file changed

+34
-18
lines changed

test/jasmine/assets/check_texttemplate.js

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ module.exports = function checkTextTemplate(mock, selector, tests) {
3131
mock[0].customdata = customdata;
3232
tests.push(['%{customdata}', customdata]);
3333

34-
tests.forEach(function(test) {
35-
it(isGL ? '@gl' : '' + 'should support texttemplate', function(done) {
36-
var gd = createGraphDiv();
37-
var mockCopy = Lib.extendDeep(mock, {});
38-
mockCopy[0].texttemplate = test[0];
39-
Plotly.newPlot(gd, mockCopy)
40-
.then(function() {
41-
if(isGL) {
34+
if(isGL) {
35+
tests.forEach(function(test) {
36+
it('@gl should support texttemplate', function(done) {
37+
var gd = createGraphDiv();
38+
var mockCopy = Lib.extendDeep(mock, {});
39+
mockCopy[0].texttemplate = test[0];
40+
Plotly.newPlot(gd, mockCopy)
41+
.then(function() {
4242
var glText;
4343
if(isPolar) {
4444
glText = gd._fullLayout.polar._subplot._scene.glText;
@@ -54,20 +54,36 @@ module.exports = function checkTextTemplate(mock, selector, tests) {
5454
var text = glText[0].text.slice(from, to);
5555
expect(text).toEqual(test[1][i]);
5656
}
57-
} else {
57+
})
58+
.catch(failTest)
59+
.finally(function() {
60+
Plotly.purge(gd);
61+
destroyGraphDiv();
62+
})
63+
.then(done);
64+
});
65+
});
66+
} else {
67+
tests.forEach(function(test) {
68+
it('should support texttemplate', function(done) {
69+
var gd = createGraphDiv();
70+
var mockCopy = Lib.extendDeep(mock, {});
71+
mockCopy[0].texttemplate = test[0];
72+
Plotly.newPlot(gd, mockCopy)
73+
.then(function() {
5874
var pts = Plotly.d3.selectAll(selector);
5975
expect(pts.size()).toBe(test[1].length);
6076
pts.each(function() {
6177
expect(test[1]).toContain(Plotly.d3.select(this).text());
6278
});
63-
}
64-
})
65-
.catch(failTest)
66-
.finally(function() {
67-
Plotly.purge(gd);
68-
destroyGraphDiv();
69-
})
70-
.then(done);
79+
})
80+
.catch(failTest)
81+
.finally(function() {
82+
Plotly.purge(gd);
83+
destroyGraphDiv();
84+
})
85+
.then(done);
86+
});
7187
});
72-
});
88+
}
7389
};

0 commit comments

Comments
 (0)