@@ -140,17 +140,26 @@ test('fireEvent.scroll', () => {
140
140
141
141
test ( 'fireEvent.changeText' , ( ) => {
142
142
const onChangeTextMock = jest . fn ( ) ;
143
- const CHANGE_TEXT = 'content' ;
144
143
145
144
render (
146
145
< View >
147
146
< TextInput placeholder = "Customer placeholder" onChangeText = { onChangeTextMock } />
148
147
</ View > ,
149
148
) ;
150
149
151
- fireEvent . changeText ( screen . getByPlaceholderText ( 'Customer placeholder' ) , CHANGE_TEXT ) ;
150
+ const input = screen . getByPlaceholderText ( 'Customer placeholder' ) ;
151
+ fireEvent . changeText ( input , 'content' ) ;
152
+ expect ( onChangeTextMock ) . toHaveBeenCalledWith ( 'content' ) ;
153
+ } ) ;
154
+
155
+ it ( 'sets native state value for unmanaged text inputs' , ( ) => {
156
+ render ( < TextInput testID = "input" /> ) ;
152
157
153
- expect ( onChangeTextMock ) . toHaveBeenCalledWith ( CHANGE_TEXT ) ;
158
+ const input = screen . getByTestId ( 'input' ) ;
159
+ expect ( input ) . toHaveDisplayValue ( '' ) ;
160
+
161
+ fireEvent . changeText ( input , 'abc' ) ;
162
+ expect ( input ) . toHaveDisplayValue ( 'abc' ) ;
154
163
} ) ;
155
164
156
165
test ( 'custom component with custom event name' , ( ) => {
@@ -444,14 +453,4 @@ describe('native events', () => {
444
453
fireEvent ( screen . getByTestId ( 'test-id' ) , 'onMomentumScrollEnd' ) ;
445
454
expect ( onMomentumScrollEndSpy ) . toHaveBeenCalled ( ) ;
446
455
} ) ;
447
-
448
- it ( 'sets native state value for unmanaged text inputs' , ( ) => {
449
- render ( < TextInput testID = "input" /> ) ;
450
-
451
- const input = screen . getByTestId ( 'input' ) ;
452
- expect ( input ) . toHaveDisplayValue ( '' ) ;
453
-
454
- fireEvent . changeText ( input , 'abc' ) ;
455
- expect ( input ) . toHaveDisplayValue ( 'abc' ) ;
456
- } ) ;
457
456
} ) ;
0 commit comments