-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Shape clean up #378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shape clean up #378
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,28 +75,33 @@ describe('Test shapes:', function() { | |
|
||
describe('Plotly.relayout', function() { | ||
it('should be able to add a shape', function(done) { | ||
var pathCount = countShapePaths(); | ||
var index = countShapes(gd); | ||
var shape = getRandomShape(); | ||
|
||
Plotly.relayout(gd, 'shapes[' + index + ']', shape).then(function() { | ||
expect(countShapeLayers()).toEqual(1); | ||
expect(countShapePaths()).toEqual(pathCount + 1); | ||
expect(getLastShape(gd)).toEqual(shape); | ||
expect(countShapes(gd)).toEqual(index + 1); | ||
}).then(done); | ||
}); | ||
|
||
it('should be able to remove a shape', function(done) { | ||
var pathCount = countShapePaths(); | ||
var index = countShapes(gd); | ||
var shape = getRandomShape(); | ||
|
||
Plotly.relayout(gd, 'shapes[' + index + ']', shape).then(function() { | ||
expect(countShapeLayers()).toEqual(1); | ||
expect(countShapePaths()).toEqual(pathCount + 1); | ||
expect(getLastShape(gd)).toEqual(shape); | ||
expect(countShapes(gd)).toEqual(index + 1); | ||
}).then(function() { | ||
Plotly.relayout(gd, 'shapes[' + index + ']', 'remove'); | ||
}).then(function() { | ||
expect(countShapeLayers()).toEqual(1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops. My bad. I meant But testing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh... that makes sense. I should've guessed you meant that. |
||
expect(countShapePaths()).toEqual(pathCount); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 |
||
expect(countShapes(gd)).toEqual(index); | ||
}).then(done); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@n-riesco nice test. Thanks.
Could you also add an
expect(countShapeLayers())
to make sure that the shapes are drawn correctly onrelayout
?