Skip to content

Commit

Permalink
feat: 🎸 implement userEvent.click
Browse files Browse the repository at this point in the history
  • Loading branch information
Gpx committed Sep 20, 2018
1 parent e644a81 commit 992b1b2
Show file tree
Hide file tree
Showing 7 changed files with 13,779 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["env", "react"]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: node_js
cache:
directories:
- ~/.npm
notifications:
email: false
node_js:
- '10'
- '9'
- '8'
after_success:
- npm run build
- npm run travis-deploy-once "npm run semantic-release"
branches:
except:
- /^v\d+\.\d+\.\d+$/
27 changes: 27 additions & 0 deletions __tests__/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react'
import { render } from 'react-testing-library'
import 'jest-dom/extend-expect'
import userEvent from '../src'

test('fireEvent.click simulates a user click', () => {
const { getByTestId } = render(
<React.Fragment>
<input data-testid="A" />
<input data-testid="B" />
</React.Fragment>
)

const a = getByTestId('A')
const b = getByTestId('B')

expect(a).not.toHaveFocus()
expect(b).not.toHaveFocus()

userEvent.click(a)
expect(a).toHaveFocus()
expect(b).not.toHaveFocus()

userEvent.click(b)
expect(a).not.toHaveFocus()
expect(a).not.toHaveFocus()
})
Loading

0 comments on commit 992b1b2

Please sign in to comment.