Skip to content

Commit 92e46e3

Browse files
committed
Update shapes test
* Count the number of paths in the shape layer after relayout.
1 parent f8dbdd1 commit 92e46e3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/jasmine/tests/shapes_test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,28 +75,33 @@ describe('Test shapes:', function() {
7575

7676
describe('Plotly.relayout', function() {
7777
it('should be able to add a shape', function(done) {
78+
var pathCount = countShapePaths();
7879
var index = countShapes(gd);
7980
var shape = getRandomShape();
8081

8182
Plotly.relayout(gd, 'shapes[' + index + ']', shape).then(function() {
8283
expect(countShapeLayers()).toEqual(1);
84+
expect(countShapePaths()).toEqual(pathCount + 1);
8385
expect(getLastShape(gd)).toEqual(shape);
8486
expect(countShapes(gd)).toEqual(index + 1);
8587
}).then(done);
8688
});
8789

8890
it('should be able to remove a shape', function(done) {
91+
var pathCount = countShapePaths();
8992
var index = countShapes(gd);
9093
var shape = getRandomShape();
9194

9295
Plotly.relayout(gd, 'shapes[' + index + ']', shape).then(function() {
9396
expect(countShapeLayers()).toEqual(1);
97+
expect(countShapePaths()).toEqual(pathCount + 1);
9498
expect(getLastShape(gd)).toEqual(shape);
9599
expect(countShapes(gd)).toEqual(index + 1);
96100
}).then(function() {
97101
Plotly.relayout(gd, 'shapes[' + index + ']', 'remove');
98102
}).then(function() {
99103
expect(countShapeLayers()).toEqual(1);
104+
expect(countShapePaths()).toEqual(pathCount);
100105
expect(countShapes(gd)).toEqual(index);
101106
}).then(done);
102107
});

0 commit comments

Comments
 (0)