Skip to content

Add check for failed binding comparison #1176

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

Merged
merged 5 commits into from
Nov 21, 2016
Merged

Conversation

rreusser
Copy link
Contributor

A simple fix for #1169. The fix is more straightforward than the test, which I'm adding now.

it('udpates bound components when the value changes', function(done) {
expect(gd.layout.sliders[0].active).toBe(0);

Plotly.restyle(gd, 'marker.color', 'ecru').then(function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the different between this test case and the one above?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... apart from 'ecru' not being a valid value.

Copy link
Contributor Author

@rreusser rreusser Nov 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, of course. My mistake. It's an end-to-end test, not a unit test. I added black which is valid but not present. I also modified the test name to read does not update the component if the value is not present.

Copy link
Contributor Author

@rreusser rreusser Nov 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this is the danger of development-driven tests vs. test-driven development.)

@etpinard etpinard added the bug something broken label Nov 21, 2016
@@ -462,6 +462,52 @@ describe('update menus interactions', function() {
});
});

it('should update correctly on failed binding comparisons', function(done) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might as well, right @rreusser ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, a full end to end test of the specific failing case. Thanks! 👍

To elaborate, the specific difficulty is knowing when to dive into array contents. It's a little unpleasant since… do you do a deep comparison? Limit the deep comparison to when there aren't 1000 elements?

To limit the intelligence (which correlates with bugginess), my solution was to only compare arrays if they're length 1. I think that's a reasonable compromise since overall there are quite a few tests here (though this case was missed, obv 😞 )

@etpinard etpinard merged commit 63f455d into master Nov 21, 2016
@etpinard etpinard deleted the fix-command-api-bug branch November 21, 2016 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants