Reproduction example
https://codesandbox.io/s/happy-ritchie-tq2fbg?file=/src/App.test.tsx
edit: https://codesandbox.io/s/clever-sea-ocux0n?file=/src/App.js
Prerequisites
Have a textarea which handles new line by holding "alt" and pressing "enter"
Expected behavior
In the test, for the second scenario (alt + enter) I would expect to see the new line added to the textarea value.
const sentence1 = 'here im the first sentence.';
const sentence2 = 'i should be after a new line.';
await userEvent.type(input, `${sentence1}{Alt>}{Enter}{/Alt}${sentence2}`)
expect(input).toHaveValue(`${sentence1}\n${sentence2}`) // it should not fail
Expected text result
here im the first sentence.
i should be after a new line.
Actual behavior
To make a newline inside the textarea you should be able to manually :
- Hold "shift" and then press "enter"
- Hold "alt" and then press "enter"
Now if you run the test suites you can see that the test asserting the second scenario (alt+enter) will fail.
const sentence1 = 'here im the first sentence.';
const sentence2 = 'i should be after a new line.';
await userEvent.type(input, `${sentence1}{Alt>}{Enter}{/Alt}${sentence2}`)
expect(input).toHaveValue(`${sentence1}\n${sentence2}`) // this fails
The new line is not appended. Im getting the following text as the textarea value:
here im the first sentence.i should be after a new line.
User-event version
14.0.4
Environment
Testing Library framework: @testing-library/[email protected]
JS framework: [email protected]
Test environment: [email protected]
DOM implementation: [email protected]
Additional context
The test was working on [email protected], it seems to fail since we migrate to the 14.0.4
Reproduction example
https://codesandbox.io/s/happy-ritchie-tq2fbg?file=/src/App.test.tsx
edit: https://codesandbox.io/s/clever-sea-ocux0n?file=/src/App.js
Prerequisites
Have a textarea which handles new line by holding "alt" and pressing "enter"
Expected behavior
In the test, for the second scenario (alt + enter) I would expect to see the new line added to the textarea value.
Expected text result
Actual behavior
To make a newline inside the textarea you should be able to manually :
Now if you run the test suites you can see that the test asserting the second scenario (alt+enter) will fail.
The new line is not appended. Im getting the following text as the textarea value:
User-event version
14.0.4
Environment
Testing Library framework:
@testing-library/[email protected]JS framework:
[email protected]Test environment:
[email protected]DOM implementation:
[email protected]Additional context
The test was working on [email protected], it seems to fail since we migrate to the 14.0.4