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

Rework type #581

Merged
merged 43 commits into from
Mar 16, 2021
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
66d80e3
chore: configure repo for typescript modules
ph-fritsche Mar 9, 2021
153aca8
refactor: convert and restructure utils
ph-fritsche Mar 9, 2021
fb61f97
refactor: convert and restructure type
ph-fritsche Mar 9, 2021
423595d
wip: keyboard mapping
ph-fritsche Mar 10, 2021
492493e
wip: new type implementation
ph-fritsche Mar 11, 2021
9863138
wip: fix textarea
ph-fritsche Mar 11, 2021
d078392
wip: fix bracketed key descriptor
ph-fritsche Mar 11, 2021
7dcd1a5
wip: delay before first char
ph-fritsche Mar 11, 2021
2b9ec50
wip: get activeElement before default keydown behavior
ph-fritsche Mar 11, 2021
3944223
fix: activeElement is never disabled
ph-fritsche Mar 11, 2021
421afee
wip: fix change event on date/time
ph-fritsche Mar 11, 2021
8497533
wip: fix value for date/number
ph-fritsche Mar 11, 2021
18f48c3
wip: keypress plugins
ph-fritsche Mar 11, 2021
a7cc548
test: do not expect bug
ph-fritsche Mar 11, 2021
a28f1c7
wip: add backspace
ph-fritsche Mar 11, 2021
61631a1
wip: add enter
ph-fritsche Mar 11, 2021
defe327
wip: add navigation keys
ph-fritsche Mar 11, 2021
eb8280b
wip: fix special keys
ph-fritsche Mar 11, 2021
eec73dd
wip: add space
ph-fritsche Mar 11, 2021
b22dc33
wip: fix selectall
ph-fritsche Mar 11, 2021
3c94d7b
test: fix expected events
ph-fritsche Mar 11, 2021
294409c
wip: add del
ph-fritsche Mar 11, 2021
2308fd7
wip: fix meta keys on mouseevents
ph-fritsche Mar 11, 2021
4fbfae6
wip: add autoclose
ph-fritsche Mar 11, 2021
a389ccc
wip: remove obsolete code
ph-fritsche Mar 11, 2021
e77dfb3
wip: fix escaped bracket
ph-fritsche Mar 12, 2021
514e0d2
wip: bump test coverage
ph-fritsche Mar 12, 2021
362c105
wip: reorganize files
ph-fritsche Mar 12, 2021
7f7bd62
feat: introduce keyboard API
ph-fritsche Mar 13, 2021
7cc8460
test: continue keyboard with state
ph-fritsche Mar 13, 2021
a1c78bc
fix: typings
ph-fritsche Mar 13, 2021
810c9a2
test: clear expected mock calls
ph-fritsche Mar 13, 2021
b8a78c8
chore: clean up config
ph-fritsche Mar 13, 2021
ab8461d
docs: add userEvent.keyboard
ph-fritsche Mar 13, 2021
c528645
docs: KeyboardEvent.code
ph-fritsche Mar 13, 2021
39b1d08
fix: relative import
ph-fritsche Mar 16, 2021
3d76f0f
docs: closing modifier
ph-fritsche Mar 16, 2021
3fae3bc
fix: annotate deprecated keyCode property
ph-fritsche Mar 16, 2021
781e0d6
refactor: remove TODO
ph-fritsche Mar 16, 2021
b409062
refactor: use jest-in-case
ph-fritsche Mar 16, 2021
64ffb17
fix: remove obsolete delay
ph-fritsche Mar 16, 2021
db00fe1
chore: disable @typescript-eslint/non-nullable-type-assertion-style
ph-fritsche Mar 16, 2021
f6c533e
chore: lint fix
ph-fritsche Mar 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: remove obsolete delay
  • Loading branch information
ph-fritsche committed Mar 16, 2021
commit 64ffb173f3366d1fa8a13ab666fe017c0be12571
2 changes: 1 addition & 1 deletion src/__tests__/type.js
Original file line number Diff line number Diff line change
@@ -246,7 +246,7 @@ test('should delay the typing when opts.delay is not 0', async () => {
await userEvent.type(element, text, {delay})

expect(onInput).toHaveBeenCalledTimes(text.length)
for (let index = 1; index < inputValues.length; index++) {
for (let index = 2; index < inputValues.length; index++) {
const {timestamp, value} = inputValues[index]
expect(timestamp - inputValues[index - 1].timestamp).toBeGreaterThanOrEqual(
delay,
7 changes: 0 additions & 7 deletions src/type/typeImplementation.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import {
getValue,
isContentEditable,
getActiveElement,
wait,
} from '../utils'
import {click} from '../click'
import {keyboardImplementationWrapper} from '../keyboard'
@@ -67,12 +66,6 @@ export async function typeImplementation(
)
}

// previous implementation did wait before the first character
// this probably can be removed
if (delay > 0) {
await wait(delay)
}

const {promise, releaseAllKeys} = keyboardImplementationWrapper(text, {
delay,
document: element.ownerDocument,