diff --git a/src/user-event/__tests__/paste.js b/src/user-event/__tests__/paste.js new file mode 100644 index 00000000..4d1a0f75 --- /dev/null +++ b/src/user-event/__tests__/paste.js @@ -0,0 +1,96 @@ +import {userEvent} from '../../' +import {setup} from './helpers/utils' + +test('should paste text in input', async () => { + const {element, getEventSnapshot} = setup('') + + const text = 'Hello, world!' + await userEvent.paste(element, text) + expect(element).toHaveValue(text) + expect(getEventSnapshot()).toMatchInlineSnapshot(` + Events fired on: input[value="Hello, world!"] + + input[value=""] - focus + input[value=""] - select + input[value="Hello, world!"] - input + "{CURSOR}" -> "Hello, world!{CURSOR}" + input[value="Hello, world!"] - select + `) +}) + +test('should paste text in textarea', async () => { + const {element, getEventSnapshot} = setup('