@@ -222,6 +222,43 @@ describe('TextInput Tests', () => {
222222 const search = await app . findElementByTestID ( 'example_search' ) ;
223223 await search . setValue ( '' ) ;
224224 } ) ;
225+ test ( 'TextInput triggers onPressOut and updates state text' , async ( ) => {
226+ // Scroll the example into view
227+ await searchBox ( 'onPressIn' ) ;
228+ const component = await app . findElementByTestID ( 'textinput-press' ) ;
229+ await component . waitForDisplayed ( { timeout : 5000 } ) ;
230+ const dump = await dumpVisualTree ( 'textinput-press' ) ;
231+ expect ( dump ) . toMatchSnapshot ( ) ;
232+
233+ // Get reference to state display element
234+ const stateText = await app . findElementByTestID ( 'textinput-state-display' ) ;
235+
236+ // Trigger onPressIn followed by onPressOut (using touchAction for press and release)
237+ await component . touchAction ( [
238+ { action : 'press' , x : 0 , y : 0 } ,
239+ { action : 'wait' , ms : 100 } ,
240+ { action : 'release' } ,
241+ ] ) ;
242+
243+ // Wait for onPressOut to update the state text
244+ await app . waitUntil (
245+ async ( ) => {
246+ const currentText = await stateText . getText ( ) ;
247+ return currentText === 'Released click/touch' ;
248+ } ,
249+ {
250+ timeout : 5000 ,
251+ timeoutMsg : 'State text not updated after onPressOut.' ,
252+ } ,
253+ ) ;
254+
255+ // Assertion
256+ expect ( await stateText . getText ( ) ) . toBe ( 'Released click/touch' ) ;
257+
258+ // Clean up by unfocusing the input
259+ const search = await app . findElementByTestID ( 'example_search' ) ;
260+ await search . setValue ( '' ) ;
261+ } ) ;
225262 test ( 'TextInputs can have attributed text' , async ( ) => {
226263 const component = await app . findElementByTestID ( 'text-input' ) ;
227264 await component . waitForDisplayed ( { timeout : 5000 } ) ;
0 commit comments