Skip to content

Commit 17655c1

Browse files
committed
test: pull userEvent from the public interface
1 parent 2263b1b commit 17655c1

File tree

11 files changed

+11
-39
lines changed

11 files changed

+11
-39
lines changed

src/user-event/__tests__/clear.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as userEvent from '..'
1+
import {userEvent} from '../../'
22
import {setup} from './helpers/utils'
33

44
test('clears text', async () => {
@@ -14,7 +14,6 @@ test('clears text', async () => {
1414
input[value="hello"] - keydown: Delete (46)
1515
input[value="hello"] - input
1616
"{SELECTION}hello{/SELECTION}" -> "{CURSOR}"
17-
input[value=""] - select
1817
input[value=""] - keyup: Delete (46)
1918
`)
2019
})

src/user-event/__tests__/click.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as userEvent from '..'
1+
import {userEvent} from '../../'
22
import {setup, addEventListener, addListeners} from './helpers/utils'
33

44
test('click in input', async () => {

src/user-event/__tests__/dblclick.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as userEvent from '..'
1+
import {userEvent} from '../../'
22
import {setup, addEventListener, addListeners} from './helpers/utils'
33

44
test('fires the correct events on buttons', async () => {

src/user-event/__tests__/hover.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as userEvent from '..'
1+
import {userEvent} from '../../'
22
import {setup} from './helpers/utils'
33

44
test('hover', async () => {

src/user-event/__tests__/select-options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as userEvent from '..'
1+
import {userEvent} from '../../'
22
import {setupSelect, addListeners} from './helpers/utils'
33

44
test('fires correct events', async () => {

src/user-event/__tests__/tab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as userEvent from '..'
1+
import {userEvent} from '../../'
22
import {setup} from './helpers/utils'
33

44
test('should cycle elements in document tab order', async () => {

src/user-event/__tests__/toggle-selectoptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as userEvent from '..'
1+
import {userEvent} from '../../'
22
import {addListeners, setupSelect, setup} from './helpers/utils'
33

44
test('should fire the correct events for multiple select', async () => {

src/user-event/__tests__/type-modifiers.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as userEvent from '..'
1+
import {userEvent} from '../../'
22
import {setup} from './helpers/utils'
33

44
// Note, use the setup function at the bottom of the file...
@@ -42,12 +42,10 @@ test('a{backspace}', async () => {
4242
input[value=""] - keypress: a (97)
4343
input[value=""] - input
4444
"{CURSOR}" -> "a{CURSOR}"
45-
input[value="a"] - select
4645
input[value="a"] - keyup: a (97)
4746
input[value="a"] - keydown: Backspace (8)
4847
input[value="a"] - input
4948
"a{CURSOR}" -> "{CURSOR}"
50-
input[value=""] - select
5149
input[value=""] - keyup: Backspace (8)
5250
`)
5351
})
@@ -66,7 +64,6 @@ test('{backspace}a', async () => {
6664
input[value=""] - keypress: a (97)
6765
input[value=""] - input
6866
"{CURSOR}" -> "a{CURSOR}"
69-
input[value="a"] - select
7067
input[value="a"] - keyup: a (97)
7168
`)
7269
})
@@ -166,7 +163,6 @@ test('{alt}a{/alt}', async () => {
166163
input[value=""] - keypress: a (97) {alt}
167164
input[value=""] - input
168165
"{CURSOR}" -> "a{CURSOR}"
169-
input[value="a"] - select
170166
input[value="a"] - keyup: a (97) {alt}
171167
input[value="a"] - keyup: Alt (18)
172168
`)
@@ -187,7 +183,6 @@ test('{meta}a{/meta}', async () => {
187183
input[value=""] - keypress: a (97) {meta}
188184
input[value=""] - input
189185
"{CURSOR}" -> "a{CURSOR}"
190-
input[value="a"] - select
191186
input[value="a"] - keyup: a (97) {meta}
192187
input[value="a"] - keyup: Meta (93)
193188
`)
@@ -208,7 +203,6 @@ test('{ctrl}a{/ctrl}', async () => {
208203
input[value=""] - keypress: a (97) {ctrl}
209204
input[value=""] - input
210205
"{CURSOR}" -> "a{CURSOR}"
211-
input[value="a"] - select
212206
input[value="a"] - keyup: a (97) {ctrl}
213207
input[value="a"] - keyup: Control (17)
214208
`)
@@ -229,7 +223,6 @@ test('{shift}a{/shift}', async () => {
229223
input[value=""] - keypress: a (97) {shift}
230224
input[value=""] - input
231225
"{CURSOR}" -> "a{CURSOR}"
232-
input[value="a"] - select
233226
input[value="a"] - keyup: a (97) {shift}
234227
input[value="a"] - keyup: Shift (16)
235228
`)
@@ -249,7 +242,6 @@ test('a{enter}', async () => {
249242
input[value=""] - keypress: a (97)
250243
input[value=""] - input
251244
"{CURSOR}" -> "a{CURSOR}"
252-
input[value="a"] - select
253245
input[value="a"] - keyup: a (97)
254246
input[value="a"] - keydown: Enter (13)
255247
input[value="a"] - keypress: Enter (13)
@@ -306,7 +298,6 @@ test('{enter} on a textarea', async () => {
306298
textarea[value=""] - keypress: Enter (13)
307299
textarea[value=""] - input
308300
"{CURSOR}" -> "\\n{CURSOR}"
309-
textarea[value="\\n"] - select
310301
textarea[value="\\n"] - keyup: Enter (13)
311302
`)
312303
})
@@ -346,7 +337,6 @@ test('{meta}{alt}{ctrl}a{/ctrl}{/alt}{/meta}', async () => {
346337
input[value=""] - keypress: a (97) {alt}{meta}{ctrl}
347338
input[value=""] - input
348339
"{CURSOR}" -> "a{CURSOR}"
349-
input[value="a"] - select
350340
input[value="a"] - keyup: a (97) {alt}{meta}{ctrl}
351341
input[value="a"] - keyup: Control (17) {alt}{meta}
352342
input[value="a"] - keyup: Alt (18) {meta}

src/user-event/__tests__/type.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as userEvent from '..'
1+
import {userEvent} from '../../'
22
import {setup, addListeners} from './helpers/utils'
33
import './helpers/custom-element'
44

@@ -14,19 +14,16 @@ test('types text in input', async () => {
1414
input[value=""] - keypress: S (83)
1515
input[value=""] - input
1616
"{CURSOR}" -> "S{CURSOR}"
17-
input[value="S"] - select
1817
input[value="S"] - keyup: S (83)
1918
input[value="S"] - keydown: u (117)
2019
input[value="S"] - keypress: u (117)
2120
input[value="S"] - input
2221
"S{CURSOR}" -> "Su{CURSOR}"
23-
input[value="Su"] - select
2422
input[value="Su"] - keyup: u (117)
2523
input[value="Su"] - keydown: p (112)
2624
input[value="Su"] - keypress: p (112)
2725
input[value="Su"] - input
2826
"Su{CURSOR}" -> "Sup{CURSOR}"
29-
input[value="Sup"] - select
3027
input[value="Sup"] - keyup: p (112)
3128
`)
3229
})
@@ -41,7 +38,6 @@ test('types text in input with allAtOnce', async () => {
4138
input[value=""] - select
4239
input[value=""] - input
4340
"{CURSOR}" -> "Sup{CURSOR}"
44-
input[value="Sup"] - select
4541
`)
4642
})
4743

@@ -61,19 +57,16 @@ test('types text inside custom element', async () => {
6157
input[value=""] - keypress: S (83)
6258
input[value=""] - input
6359
"{CURSOR}" -> "S{CURSOR}"
64-
input[value="S"] - select
6560
input[value="S"] - keyup: S (83)
6661
input[value="S"] - keydown: u (117)
6762
input[value="S"] - keypress: u (117)
6863
input[value="S"] - input
6964
"S{CURSOR}" -> "Su{CURSOR}"
70-
input[value="Su"] - select
7165
input[value="Su"] - keyup: u (117)
7266
input[value="Su"] - keydown: p (112)
7367
input[value="Su"] - keypress: p (112)
7468
input[value="Su"] - input
7569
"Su{CURSOR}" -> "Sup{CURSOR}"
76-
input[value="Sup"] - select
7770
input[value="Sup"] - keyup: p (112)
7871
`)
7972
})
@@ -90,19 +83,16 @@ test('types text in textarea', async () => {
9083
textarea[value=""] - keypress: S (83)
9184
textarea[value=""] - input
9285
"{CURSOR}" -> "S{CURSOR}"
93-
textarea[value="S"] - select
9486
textarea[value="S"] - keyup: S (83)
9587
textarea[value="S"] - keydown: u (117)
9688
textarea[value="S"] - keypress: u (117)
9789
textarea[value="S"] - input
9890
"S{CURSOR}" -> "Su{CURSOR}"
99-
textarea[value="Su"] - select
10091
textarea[value="Su"] - keyup: u (117)
10192
textarea[value="Su"] - keydown: p (112)
10293
textarea[value="Su"] - keypress: p (112)
10394
textarea[value="Su"] - input
10495
"Su{CURSOR}" -> "Sup{CURSOR}"
105-
textarea[value="Sup"] - select
10696
textarea[value="Sup"] - keyup: p (112)
10797
`)
10898
})
@@ -117,7 +107,6 @@ test('should append text all at once', async () => {
117107
input[value=""] - select
118108
input[value=""] - input
119109
"{CURSOR}" -> "Sup{CURSOR}"
120-
input[value="Sup"] - select
121110
`)
122111
})
123112

@@ -235,13 +224,11 @@ test('honors maxlength', async () => {
235224
input[value=""] - keypress: 1 (49)
236225
input[value=""] - input
237226
"{CURSOR}" -> "1{CURSOR}"
238-
input[value="1"] - select
239227
input[value="1"] - keyup: 1 (49)
240228
input[value="1"] - keydown: 2 (50)
241229
input[value="1"] - keypress: 2 (50)
242230
input[value="1"] - input
243231
"1{CURSOR}" -> "12{CURSOR}"
244-
input[value="12"] - select
245232
input[value="12"] - keyup: 2 (50)
246233
input[value="12"] - keydown: 3 (51)
247234
input[value="12"] - keypress: 3 (51)
@@ -346,7 +333,6 @@ test('typing into a controlled input works', async () => {
346333
input[value="$2"] - keypress: 3 (51)
347334
input[value="$2"] - input
348335
"$2{CURSOR}" -> "$23{CURSOR}"
349-
input[value="$23"] - select
350336
input[value="$23"] - keyup: 3 (51)
351337
`)
352338
})
@@ -402,7 +388,6 @@ test('ignored {backspace} in controlled input', async () => {
402388
input[value="$23"] - keypress: 4 (52)
403389
input[value="$23"] - input
404390
"$23{CURSOR}" -> "$234{CURSOR}"
405-
input[value="$234"] - select
406391
input[value="$234"] - keyup: 4 (52)
407392
`)
408393
})
@@ -421,13 +406,11 @@ test('typing in a textarea with existing text', async () => {
421406
textarea[value="Hello, "] - keypress: 1 (49)
422407
textarea[value="Hello, "] - input
423408
"Hello, {CURSOR}" -> "Hello, 1{CURSOR}"
424-
textarea[value="Hello, 1"] - select
425409
textarea[value="Hello, 1"] - keyup: 1 (49)
426410
textarea[value="Hello, 1"] - keydown: 2 (50)
427411
textarea[value="Hello, 1"] - keypress: 2 (50)
428412
textarea[value="Hello, 1"] - input
429413
"Hello, 1{CURSOR}" -> "Hello, 12{CURSOR}"
430-
textarea[value="Hello, 12"] - select
431414
textarea[value="Hello, 12"] - keyup: 2 (50)
432415
`)
433416
expect(element).toHaveValue('Hello, 12')

src/user-event/__tests__/unhover.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as userEvent from '..'
1+
import {userEvent} from '../../'
22
import {setup} from './helpers/utils'
33

44
test('unhover', async () => {

src/user-event/__tests__/upload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as userEvent from '..'
1+
import {userEvent} from '../../'
22
import {setup, addListeners} from './helpers/utils'
33

44
test('should fire the correct events for input', async () => {

0 commit comments

Comments
 (0)