@@ -3,34 +3,29 @@ import {setupSelect, addListeners} from './helpers/utils'
3
3
4
4
test ( 'fires correct events' , async ( ) => {
5
5
const { select, options, getEventSnapshot} = setupSelect ( )
6
- await userEvent . selectOptions ( select , '1 ' )
6
+ await userEvent . selectOptions ( select , '2 ' )
7
7
expect ( getEventSnapshot ( ) ) . toMatchInlineSnapshot ( `
8
- Events fired on: select[name="select"][value="1 "]
8
+ Events fired on: select[name="select"][value="2 "]
9
9
10
+ select[name="select"][value="1"] - pointerover
11
+ select[name="select"][value="1"] - pointerenter
12
+ select[name="select"][value="1"] - mouseover: Left (0)
13
+ select[name="select"][value="1"] - mouseenter: Left (0)
14
+ select[name="select"][value="1"] - pointermove
15
+ select[name="select"][value="1"] - mousemove: Left (0)
10
16
select[name="select"][value="1"] - pointerdown
11
- selectedOptions: ["1"] -> ["1"]
12
17
select[name="select"][value="1"] - mousedown: Left (0)
13
- selectedOptions: ["1"] -> ["1"]
14
18
select[name="select"][value="1"] - focus
15
19
select[name="select"][value="1"] - focusin
16
- selectedOptions: ["1"] -> ["1"]
17
20
select[name="select"][value="1"] - pointerup
18
- selectedOptions: ["1"] -> ["1"]
19
21
select[name="select"][value="1"] - mouseup: Left (0)
20
- selectedOptions: ["1"] -> ["1"]
21
22
select[name="select"][value="1"] - click: Left (0)
22
- selectedOptions: ["1"] -> ["1"]
23
- option[value="1"] - mouseover: Left (0)
24
- option[value="1"] - mousemove: Left (0)
25
- option[value="1"] - mousedown: Left (0)
26
- option[value="1"] - mouseup: Left (0)
27
- option[value="1"] - click: Left (0)
28
- select[name="select"][value="1"] - change
29
- selectedOptions: ["1"] -> ["1"]
23
+ select[name="select"][value="2"] - input
24
+ select[name="select"][value="2"] - change
30
25
` )
31
26
const [ o1 , o2 , o3 ] = options
32
- expect ( o1 . selected ) . toBe ( true )
33
- expect ( o2 . selected ) . toBe ( false )
27
+ expect ( o1 . selected ) . toBe ( false )
28
+ expect ( o2 . selected ) . toBe ( true )
34
29
expect ( o3 . selected ) . toBe ( false )
35
30
} )
36
31
@@ -40,33 +35,34 @@ test('fires correct events on multi-selects', async () => {
40
35
expect ( getEventSnapshot ( ) ) . toMatchInlineSnapshot ( `
41
36
Events fired on: select[name="select"][value=["1","3"]]
42
37
43
- select[name="select"][value=[]] - pointerdown
44
- selectedOptions: [] -> []
45
- select[name="select"][value=[]] - mousedown: Left (0)
46
- selectedOptions: [] -> []
47
- select[name="select"][value=[]] - focus
48
- select[name="select"][value=[]] - focusin
49
- selectedOptions: [] -> []
50
- select[name="select"][value=[]] - pointerup
51
- selectedOptions: [] -> []
52
- select[name="select"][value=[]] - mouseup: Left (0)
53
- selectedOptions: [] -> []
54
- select[name="select"][value=[]] - click: Left (0)
55
- selectedOptions: [] -> []
38
+ option[value="1"] - pointerover
39
+ select[name="select"][value=[]] - pointerenter
56
40
option[value="1"] - mouseover: Left (0)
41
+ select[name="select"][value=[]] - mouseenter: Left (0)
42
+ option[value="1"] - pointermove
57
43
option[value="1"] - mousemove: Left (0)
44
+ option[value="1"] - pointerdown
58
45
option[value="1"] - mousedown: Left (0)
46
+ select[name="select"][value=[]] - focus
47
+ select[name="select"][value=[]] - focusin
48
+ option[value="1"] - pointerup
59
49
option[value="1"] - mouseup: Left (0)
60
- option[ value="1"] - click: Left (0)
50
+ select[name="select"][ value=[ "1"]] - input
61
51
select[name="select"][value=["1"]] - change
62
- selectedOptions: ["1"] -> ["1"]
52
+ option[value="1"] - click: Left (0)
53
+ option[value="3"] - pointerover
54
+ select[name="select"][value=["1"]] - pointerenter
63
55
option[value="3"] - mouseover: Left (0)
56
+ select[name="select"][value=["1"]] - mouseenter: Left (0)
57
+ option[value="3"] - pointermove
64
58
option[value="3"] - mousemove: Left (0)
59
+ option[value="3"] - pointerdown
65
60
option[value="3"] - mousedown: Left (0)
61
+ option[value="3"] - pointerup
66
62
option[value="3"] - mouseup: Left (0)
67
- option[ value=" 3"] - click: Left (0)
63
+ select[name="select"][ value=["1"," 3"]] - input
68
64
select[name="select"][value=["1","3"]] - change
69
- selectedOptions: ["1"," 3"] -> ["1","3"]
65
+ option[value=" 3"] - click: Left (0)
70
66
` )
71
67
const [ o1 , o2 , o3 ] = options
72
68
expect ( o1 . selected ) . toBe ( true )
0 commit comments