Skip to content

Commit 1de4322

Browse files
authored
Merge pull request #1 from Gpx/deploy
feat: 🎸 implement userEvent.click
2 parents e644a81 + 992b1b2 commit 1de4322

File tree

7 files changed

+13779
-4
lines changed

7 files changed

+13779
-4
lines changed

.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["env", "react"]
3+
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.travis.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: node_js
2+
cache:
3+
directories:
4+
- ~/.npm
5+
notifications:
6+
email: false
7+
node_js:
8+
- '10'
9+
- '9'
10+
- '8'
11+
after_success:
12+
- npm run build
13+
- npm run travis-deploy-once "npm run semantic-release"
14+
branches:
15+
except:
16+
- /^v\d+\.\d+\.\d+$/

__tests__/events.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react'
2+
import { render } from 'react-testing-library'
3+
import 'jest-dom/extend-expect'
4+
import userEvent from '../src'
5+
6+
test('fireEvent.click simulates a user click', () => {
7+
const { getByTestId } = render(
8+
<React.Fragment>
9+
<input data-testid="A" />
10+
<input data-testid="B" />
11+
</React.Fragment>
12+
)
13+
14+
const a = getByTestId('A')
15+
const b = getByTestId('B')
16+
17+
expect(a).not.toHaveFocus()
18+
expect(b).not.toHaveFocus()
19+
20+
userEvent.click(a)
21+
expect(a).toHaveFocus()
22+
expect(b).not.toHaveFocus()
23+
24+
userEvent.click(b)
25+
expect(a).not.toHaveFocus()
26+
expect(a).not.toHaveFocus()
27+
})

0 commit comments

Comments
 (0)