Skip to content
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

Create testing examples #291

Open
4 tasks
claydiffrient opened this issue Dec 28, 2016 · 5 comments
Open
4 tasks

Create testing examples #291

claydiffrient opened this issue Dec 28, 2016 · 5 comments

Comments

@claydiffrient
Copy link
Contributor

Because testing seems to be less understood than many other things we should create a few examples of testing for people to see.

I think the biggest thing people want to test is opening the modal and asserting various facts about the contents of the modal.

We should create examples for the following:

  • Mocha
    • Enzyme
    • React TestUtils
  • Jest
@aziz
Copy link

aziz commented Jan 17, 2017

Please provide some examples on how to access the portal using enzyme

@hawyangpeng
Copy link

@ollwenjones
Copy link

"jest" involves snapshot example with react-test-renderer ?

@ollwenjones
Copy link

if this helps anyone, I had to add a dummy app element to get around the App element is not defined error in Jest:

  let app = document.createElement('div');
  app.id = 'app';

  document
    .getElementsByTagName('body')
    .item(0)
    .appendChild(app);

  Modal.setAppElement('#app');

@ollwenjones
Copy link

@aziz I ended up piping some innerHTML to jest snapshots, but I did find this helpful:

http://remarkablemark.org/blog/2017/05/17/testing-react-modal/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants