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

feat(userEvent): build-in @testing-library/user-event #616

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ff8261c
feat(userEvent): build-in @testing-library/user-event
kentcdodds Jun 11, 2020
37474a2
fix(userEvent): actually export userEvent
kentcdodds Jun 11, 2020
c61d22e
fix: make everything async
kentcdodds Jun 11, 2020
277d0c8
test: add all event types as listeners
kentcdodds Jun 11, 2020
faaf8dc
feat(userEvent): add {del} and {selectall}
kentcdodds Jun 11, 2020
78af873
fix(clear): make re-use type
kentcdodds Jun 11, 2020
02c5018
chore: move things to individual files
kentcdodds Jun 11, 2020
6956fa8
fix(hover): correctness audit on hover
kentcdodds Jun 11, 2020
80872ea
fix(type): allow typing decimal numbers
kentcdodds Jun 11, 2020
4a3381a
Update src/user-event/__tests__/tab.js
kentcdodds Jun 11, 2020
2e253be
test: get coverage up
kentcdodds Jun 11, 2020
1ef19ab
test: improve test title
kentcdodds Jun 11, 2020
8b1482b
test: improve test title
kentcdodds Jun 11, 2020
d0ff606
test: rework snapshot tests
kentcdodds Jun 11, 2020
0812854
tests: fix snapshot serializers stuff
kentcdodds Jun 12, 2020
81ae650
refactor(type): move things out of type
kentcdodds Jun 12, 2020
3cffc38
fix(type): do not select if not needed
kentcdodds Jun 12, 2020
d9dc068
test: pull userEvent from the public interface
kentcdodds Jun 12, 2020
30398cc
fix(clear): correctness audit
kentcdodds Jun 12, 2020
a012090
fix(userEvent): correct events fired for several things
kentcdodds Jun 12, 2020
5d1cc0a
userEvent(click): improve correctness for clicks
kentcdodds Jun 12, 2020
e14ae9b
fix(upload): improve correctness
kentcdodds Jun 12, 2020
b470cb4
fix(tab): make the events more correct
kentcdodds Jun 12, 2020
0ebcba3
fix(type): improve accurracy, remove allAtOnce, and use click
kentcdodds Jun 12, 2020
55964d7
fix(selectOptions): improve correctness
kentcdodds Jun 12, 2020
9ae603f
fix(deselectOptions): remove toggle and use explicit select and deselect
kentcdodds Jun 13, 2020
6dc8fd4
chore: fix comment
kentcdodds Jun 13, 2020
6981612
fix(click): remove unused exports
kentcdodds Jun 13, 2020
52efb3b
feat(type): automatically release modifiers
kentcdodds Jun 13, 2020
d46f52a
chore: fix comment correctness
kentcdodds Jun 14, 2020
480fe24
fix(userEvent): don't select option if select is disabled (#641)
nickmccurdy Jun 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions jest.config.js
Expand Up @@ -6,6 +6,7 @@ const {
} = require('kcd-scripts/jest')

module.exports = {
resetMocks: true,
collectCoverageFrom,
coveragePathIgnorePatterns: [
...coveragePathIgnorePatterns,
Expand Down
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -51,6 +51,7 @@
"jest-watch-select-projects": "^2.0.0",
"jsdom": "^16.2.2",
"kcd-scripts": "^6.2.0",
"redent": "^3.0.0",
"typescript": "^3.9.5"
},
"eslintConfig": {
Expand All @@ -59,7 +60,8 @@
"import/prefer-default-export": "off",
"import/no-unassigned-import": "off",
"import/no-useless-path-segments": "off",
"no-console": "off"
"no-console": "off",
"no-func-assign": "off"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule seems fairly reasonable to me. Any reasons you can't use function expressions over function declarations?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule bugs me a bit. I prefer this:

function foo() {
}
foo = wrap(foo)

Over this:

const foo = wrap(function foo() { // don't want this to be anonymous because I want the name
})

Applies to all HOCs I use in React (like React.memo). In here we have this wrapAsync function which wraps all of our utilities in the config's asyncWrapper and I just like the way it looks better when we reassign the function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you prefer the first one? Because I definitely didn't know you can re-assign function declarations. I wouldn't think this is valid which is exactly the rationale of this rule. The second pattern looks fine to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case: If you like it why not disable it in kcd-scripts and explain the rationale? If you only have a personal, stylistic preference I'd always favor the default ruleset which makes onboarding easier.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been meaning to disable it in eslint-config-kentcdodds for a while now 😅 Just haven't gotten around to it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that was possible either

}
},
"eslintIgnore": [
Expand Down