-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement onPressOut property for TextInput in fabric #14754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
080419b
0c7ede5
456f8dc
1e2d12e
e8b9967
a72aa8a
4a94045
50da6f2
8d1fa43
ce1f79e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,6 +222,43 @@ describe('TextInput Tests', () => { | |
const search = await app.findElementByTestID('example_search'); | ||
await search.setValue(''); | ||
}); | ||
test('TextInput triggers onPressOut and updates state text', async () => { | ||
// Scroll the example into view | ||
await searchBox('onPressIn'); | ||
const component = await app.findElementByTestID('textinput-press'); | ||
await component.waitForDisplayed({timeout: 5000}); | ||
const dump = await dumpVisualTree('textinput-press'); | ||
expect(dump).toMatchSnapshot(); | ||
|
||
// Get reference to state display element | ||
const stateText = await app.findElementByTestID('textinput-state-display'); | ||
|
||
// Trigger onPressIn followed by onPressOut (using touchAction for press and release) | ||
await component.touchAction([ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. touchAction is not triggering anything There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right that |
||
{action: 'press', x: 0, y: 0}, | ||
{action: 'wait', ms: 100}, | ||
{action: 'release'}, | ||
]); | ||
|
||
// Wait for onPressOut to update the state text | ||
await app.waitUntil( | ||
async () => { | ||
const currentText = await stateText.getText(); | ||
return currentText === 'Released click/touch'; | ||
}, | ||
{ | ||
timeout: 5000, | ||
timeoutMsg: 'State text not updated after onPressOut.', | ||
}, | ||
); | ||
|
||
// Assertion | ||
expect(await stateText.getText()).toBe('Released click/touch'); | ||
|
||
// Clean up by unfocusing the input | ||
const search = await app.findElementByTestID('example_search'); | ||
await search.setValue(''); | ||
}); | ||
test('TextInputs can have attributed text', async () => { | ||
const component = await app.findElementByTestID('text-input'); | ||
await component.waitForDisplayed({timeout: 5000}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot won't this hinder the test for onpressin as click instantly releases and then onpressout gets triggered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right about the test interference. The onPressIn test was using
click()
which triggers both press and release events, causing the state to immediately change to "Released click/touch" instead of staying at "Holding down the click/touch".I've fixed this by modifying the onPressIn test to use
touchAction
with separate press and release actions, ensuring proper isolation between the tests. Fixed in 4a94045.