Skip to content

Commit 434dc0e

Browse files
committed
standardize fail logic in bar test
1 parent a511bd2 commit 434dc0e

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

test/jasmine/tests/bar_test.js

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ var Plotly = require('@lib/index');
33
var Bar = require('@src/traces/bar');
44
var Lib = require('@src/lib');
55
var Plots = require('@src/plots/plots');
6+
var Drawing = require('@src/components/drawing');
67

7-
var PlotlyInternal = require('@src/plotly');
8-
var Axes = PlotlyInternal.Axes;
8+
var Axes = require('@src/plots/cartesian/axes');
99

1010
var createGraphDiv = require('../assets/create_graph_div');
1111
var destroyGraphDiv = require('../assets/destroy_graph_div');
1212
var fail = require('../assets/fail_test');
1313
var customMatchers = require('../assets/custom_matchers');
14-
var failTest = require('../assets/fail_test');
1514

1615
describe('Bar.supplyDefaults', function() {
1716
'use strict';
@@ -855,9 +854,9 @@ describe('A bar plot', function() {
855854
}
856855

857856
expect(foundTextNodes).toBe(true);
858-
859-
done();
860-
});
857+
})
858+
.catch(fail)
859+
.then(done);
861860
});
862861

863862
it('should show bar texts (outside case)', function(done) {
@@ -889,9 +888,9 @@ describe('A bar plot', function() {
889888
}
890889

891890
expect(foundTextNodes).toBe(true);
892-
893-
done();
894-
});
891+
})
892+
.catch(fail)
893+
.then(done);
895894
});
896895

897896
it('should show bar texts (horizontal case)', function(done) {
@@ -922,9 +921,9 @@ describe('A bar plot', function() {
922921
}
923922

924923
expect(foundTextNodes).toBe(true);
925-
926-
done();
927-
});
924+
})
925+
.catch(fail)
926+
.then(done);
928927
});
929928

930929
it('should show bar texts (barnorm case)', function(done) {
@@ -957,9 +956,9 @@ describe('A bar plot', function() {
957956
}
958957

959958
expect(foundTextNodes).toBe(true);
960-
961-
done();
962-
});
959+
})
960+
.catch(fail)
961+
.then(done);
963962
});
964963

965964
it('should be able to restyle', function(done) {
@@ -1107,9 +1106,9 @@ describe('A bar plot', function() {
11071106
assertTextIsInsidePath(text12, path12); // inside
11081107
assertTextIsInsidePath(text20, path20); // inside
11091108
assertTextIsInsidePath(text30, path30); // inside
1110-
1111-
done();
1112-
});
1109+
})
1110+
.catch(fail)
1111+
.then(done);
11131112
});
11141113

11151114
it('should coerce text-related attributes', function(done) {
@@ -1189,9 +1188,9 @@ describe('A bar plot', function() {
11891188
assertTextFont(textNodes[0], expected.insidetextfont, 0);
11901189
assertTextFont(textNodes[1], expected.outsidetextfont, 1);
11911190
assertTextFont(textNodes[2], expected.insidetextfont, 2);
1192-
1193-
done();
1194-
});
1191+
})
1192+
.catch(fail)
1193+
.then(done);
11951194
});
11961195
});
11971196

@@ -1248,7 +1247,9 @@ describe('bar hover', function() {
12481247

12491248
var mock = Lib.extendDeep({}, require('@mocks/11.json'));
12501249

1251-
Plotly.plot(gd, mock.data, mock.layout).then(done);
1250+
Plotly.plot(gd, mock.data, mock.layout)
1251+
.catch(fail)
1252+
.then(done);
12521253
});
12531254

12541255
it('should return the correct hover point data (case x)', function() {
@@ -1272,7 +1273,9 @@ describe('bar hover', function() {
12721273

12731274
var mock = Lib.extendDeep({}, require('@mocks/bar_attrs_group_norm.json'));
12741275

1275-
Plotly.plot(gd, mock.data, mock.layout).then(done);
1276+
Plotly.plot(gd, mock.data, mock.layout)
1277+
.catch(fail)
1278+
.then(done);
12761279
});
12771280

12781281
it('should return the correct hover point data (case y)', function() {
@@ -1387,7 +1390,7 @@ describe('bar hover', function() {
13871390
expect(out).toBe(false, hoverSpec);
13881391
});
13891392
})
1390-
.catch(failTest)
1393+
.catch(fail)
13911394
.then(done);
13921395
});
13931396

@@ -1425,7 +1428,7 @@ describe('bar hover', function() {
14251428
expect(out.style).toEqual([1, 'red', 200, 1]);
14261429
assertPos(out.pos, [203, 304, 168, 168]);
14271430
})
1428-
.catch(failTest)
1431+
.catch(fail)
14291432
.then(done);
14301433
});
14311434
});

0 commit comments

Comments
 (0)