@@ -86,7 +86,7 @@ describe('Select.Tags', () => {
86
86
expectOpen ( wrapper , false ) ;
87
87
} ) ;
88
88
89
- it ( "shounld't separate words when compositing" , ( ) => {
89
+ it ( 'should not separate words when compositing but trigger after composition end' , ( ) => {
90
90
const handleChange = jest . fn ( ) ;
91
91
const handleSelect = jest . fn ( ) ;
92
92
const wrapper = mount (
@@ -96,13 +96,16 @@ describe('Select.Tags', () => {
96
96
</ Select > ,
97
97
) ;
98
98
99
- wrapper . find ( 'input' ) . simulate ( 'compositionstart' ) ;
99
+ // composition start
100
+ wrapper . find ( 'input' ) . simulate ( 'compositionStart' ) ;
100
101
wrapper . find ( 'input' ) . simulate ( 'change' , { target : { value : '2,3,4' } } ) ;
101
102
expect ( handleChange ) . not . toHaveBeenCalled ( ) ;
102
103
handleChange . mockReset ( ) ;
103
- wrapper . find ( 'input' ) . simulate ( 'compositionend' ) ;
104
- wrapper . find ( 'input' ) . simulate ( 'change' , { target : { value : '2,3,4' } } ) ;
104
+
105
+ // composition end
106
+ wrapper . find ( 'input' ) . simulate ( 'compositionEnd' ) ;
105
107
expect ( handleChange ) . toHaveBeenCalledWith ( [ '2' , '3' , '4' ] , expect . anything ( ) ) ;
108
+
106
109
expect ( handleSelect ) . toHaveBeenCalledTimes ( 3 ) ;
107
110
expect ( handleSelect ) . toHaveBeenLastCalledWith ( '4' , expect . anything ( ) ) ;
108
111
expect ( findSelection ( wrapper ) . text ( ) ) . toEqual ( '2' ) ;
0 commit comments