Clear the search input when the modal is closed#55277
Merged
mountiny merged 2 commits intoExpensify:mainfrom Jan 17, 2025
Merged
Clear the search input when the modal is closed#55277mountiny merged 2 commits intoExpensify:mainfrom
mountiny merged 2 commits intoExpensify:mainfrom
Conversation
Contributor
Author
|
Recordings of other usages. a.mp4b.mp4c.mp4d.mp4e.mp4 |
Contributor
Author
|
I was trying to create the UI test, but looks like codeimport {PortalProvider} from '@gorhom/portal';
import {fireEvent, render, screen, waitForElementToBeRemoved} from '@testing-library/react-native';
import PushRowModal from '@components/PushRowWithModal/PushRowModal';
import Navigation from '@libs/Navigation/Navigation';
jest.mock('@react-navigation/native', () => {
const actualNav = jest.requireActual<typeof Navigation>('@react-navigation/native');
return {
...actualNav,
useRoute: jest.fn(),
UNSTABLE_usePreventRemove: jest.fn(),
};
});
describe('PushRowModal', () => {
it('should clears the input when modal is closed', async () => {
// Given the component is rendered
const {rerender} = render(
<PortalProvider>
<PushRowModal
searchInputTitle="Search"
isVisible={true}
headerTitle=""
onClose={jest.fn()}
onOptionChange={jest.fn()}
optionsList={[] as any}
selectedOption=""
/>
</PortalProvider>,
);
// When the user types on the search input and closes the modal
fireEvent(screen.getByTestId('selection-list-text-input'), 'changeText', 'test');
expect(screen.getByDisplayValue('test')).toBeDefined();
rerender(
<PortalProvider>
<PushRowModal
searchInputTitle="Search"
isVisible={false}
headerTitle=""
onClose={jest.fn()}
onOptionChange={jest.fn()}
optionsList={[] as any}
selectedOption=""
/>
</PortalProvider>,
);
await waitForElementToBeRemoved(() => screen.getByTestId('selection-list-text-input'));
rerender(
<PortalProvider>
<PushRowModal
searchInputTitle="Search"
isVisible={true}
headerTitle=""
onClose={jest.fn()}
onOptionChange={jest.fn()}
optionsList={[] as any}
selectedOption=""
/>
</PortalProvider>,
);
// Then the search input should be cleared
expect(screen.queryByDisplayValue('test')).toBeNull();
});
}); |
Contributor
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / SafariScreen.Recording.2025-01-16.at.00.06.34.movScreen.Recording.2025-01-16.at.00.13.18.movScreen.Recording.2025-01-16.at.00.13.32.movScreen.Recording.2025-01-16.at.00.11.58.movMacOS: DesktopScreen.Recording.2025-01-16.at.00.14.40.movAndroid: NativeScreen.Recording.2025-01-16.at.01.30.59.movScreen.Recording.2025-01-16.at.00.22.00.movAndroid: mWeb ChromeScreen.Recording.2025-01-16.at.00.22.00.moviOS: NativeScreen.Recording.2025-01-16.at.00.39.05.moviOS: mWeb SafariScreen.Recording.2025-01-16.at.00.18.29.mov |
suneox
approved these changes
Jan 17, 2025
Contributor
suneox
left a comment
There was a problem hiding this comment.
The change set LGTM. I've verified other places using this component.
Contributor
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Contributor
Performance Comparison Report 📊Significant Changes To Duration
Show details
Meaningless Changes To DurationShow entries
Show details
|
Contributor
|
@Expensify/mobile-deployers 📣 Please look into this performance regression as it's a deploy blocker. |
60 tasks
Contributor
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.87-0 🚀
|
Contributor
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.0.87-3 🚀
|
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
Fixed Issues
$ #55073
PROPOSAL: #55073 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4