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

how to test touch in my project #107

Open
wendy-92 opened this issue Aug 15, 2017 · 0 comments
Open

how to test touch in my project #107

wendy-92 opened this issue Aug 15, 2017 · 0 comments

Comments

@wendy-92
Copy link

when i test my component with onTouchTap I got ReactWrapper::simulate() event 'touchTap' does not exist
and if run test with simulate('click'),i will can't get anything
here is my test code

injectTapEventPlugin();

const expect = chai.expect;
// let store;
let app;
describe('login', () => {
  beforeEach(() => {
    app = mount (
      <Provider store={store}>
          <App>
            <LoginWrapper />
          </App>
      </Provider>
    )
  })
  describe('Enzyme Mount', function () {
    it('Add a new Todo', function (done) {
      const nameInput = app.find(TextField).get(0);
      const passwordInput = app.find(TextField).get(1);
      nameInput.setState({'uid':'demo'});
      passwordInput.setState({'pwd':'daemon'})
      app.find(ArrowRight).simulate('touchTap');
      const check = () => {
        console.log(JSON.parse((localStorage.getItem('AUTH'))).loggedIn,'))');
        expect(JSON.parse((localStorage.getItem('AUTH'))).loggedIn).to.equal(true);
        //expect(JSON.parse((localStorage.getItem('AUTH'))).loggedIn).to.equal(true);
        done();
      }
      setTimeout(check, 4000);
      console.log(JSON.parse((localStorage.getItem('AUTH'))).loggedIn);

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

No branches or pull requests

1 participant