Uh oh!
There was an error while loading. Please reload this page.
Unit tests with Jest + Enzyme and updates to Tabs component - #315
Conversation
| "plugins": ["transform-object-rest-spread", "styled-jsx/babel"] | ||
| }, | ||
| "test": { | ||
| "plugins": ["transform-object-rest-spread", "styled-jsx/babel-test"] |
There was a problem hiding this comment.
Here we use (a brand new) plugin babel-test, so that Jest will use Babel and styled-jsx, but won't parse the classes to jsx-1324 or whatever, so that we can make assertions on them!
| command: | | ||
| . venv/bin/activate | ||
| python --version | ||
| npm run test-unit |
There was a problem hiding this comment.
This is the only real difference apart from formatting - running the new unit tests in CircleCI.
| this.NoChildrenError = { | ||
| name: 'NoChildrenError', | ||
| message: 'Tabs did not have any children Tab components!', | ||
| }; |
There was a problem hiding this comment.
Not really sure about this - if you have suggestions on how to do error handling here in a better way, please let me know!
chriddyp
commented
Sep 26, 2018
Just curious, what bugs did you find that weren't covered in the integration tests? |
rmarren1
commented
Sep 26, 2018
I was getting an exception when the |
T4rk1n
commented
Sep 26, 2018
I think I broke dash 0.28.0 😞 |
valentijnnieman
commented
Sep 26, 2018
@rmarren1 Actually no it doesn't. I was thinking about it, and thought that the Tabs component should throw an error if there are no children. What would it render? Thinking about it now, perhaps the Tabs component should not throw an exception when there are no children, in the cases where you set the children later through a callback... |
rmarren1
commented
Sep 26, 2018
I think either would be acceptable, but let's use |
valentijnnieman
commented
Sep 26, 2018
@rmarren1 Ah you're right, thanks! I'll update that. |
valentijnnieman
commented
Sep 26, 2018
The Selenium tests are failing here because of this issue: plotly/dash-renderer#84 |
valentijnnieman
commented
Sep 26, 2018
@rmarren1 So I can remove these errors I'm throwing in favour of |
rmarren1
commented
Sep 26, 2018
If you have |
valentijnnieman
commented
Oct 15, 2018
@rmarren1 Yeah that's what I expected, but if I set it to |
a9b3b40 to
e7272a9Compare| tox-pyenv | ||
| six | ||
| plotly>=2.0.8 | ||
| urllib3<=1.22 |
There was a problem hiding this comment.
This caused the Python 2.7 tests to fail, got this fix from #333
| * The tab's label | ||
| */ | ||
| label: PropTypes.children, | ||
| label: PropTypes.string, |
There was a problem hiding this comment.
Support for components/something else than a string for label will have to come later, anything else than a string doesn't really work now anyways, so best to set it to string for now.
chriddyp
left a comment
There was a problem hiding this comment.
Let's also bump the versions and ship a release as soon as this is merged


This is a work-in-progress PR, rebased of off #299 - that needs to be merged first.
I'm comparing this branch to the
update_scriptsbranch, so the commits are easier to reason about.This adds support for Jest, a JS test runner, and Enzyme, testing tools for React. It allows us to write unit tests in JS for the components, hopefully lightening the load/dependency on our Selenium integration tests, and allowing for a more test-driven approach by running Jest in watch mode or as a VS-Code/Atom plugin.
I've written some basic unit tests for the Tabs component, and caught a couple of bugs that I've also fixed.
@plotly/dash