Add tooltip for the inactive tab in the create expense page when the tab title is hidden#55216
Conversation
|
@ahmedGaber93 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosAndroid: Native20250116101155474.mp4Android: mWeb Chrome20250116101443270.mp4iOS: NativeiOS: mWeb Safari20250116101659951.mp4MacOS: Chrome / Safari20250116101757101.mp4MacOS: Desktop20250116102113791.mp4 |
| screen.findByText(tooltipText).then((tooltip) => { | ||
| expect(tooltip).toBeTruthy(); | ||
| }); |
There was a problem hiding this comment.
I think you should use async await instead of promise here because the below lines will call before promise onResolve
There was a problem hiding this comment.
Thanks for the review, I will update it.
|
@ahmedGaber93 I’ve added the changes. |
| jest.mock('@components/Tooltip', () => { | ||
| return jest.fn(({children, shouldRender, text}: {children: React.ReactNode; shouldRender: boolean; text: string}) => { | ||
| return ( | ||
| <> | ||
| {shouldRender && <div data-testid="tooltip">{text}</div>} | ||
| {children} | ||
| </> | ||
| ); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Since we just test with toHaveBeenCalledWith, I think we can simply mock with empty jest.fn
jest.mock('@components/Tooltip', () => jest.fn());
jest.mock('@components/Tooltip'); // factory param already have empty function as a default| const button = screen.getByRole(CONST.ROLE.BUTTON, {name: defaultProps.title}); | ||
| fireEvent(button, 'hoverIn'); |
There was a problem hiding this comment.
I think hoverIn will not trigger anything because we mocked up the Tooltip. Also, it looks related to Tooltip test not TabSelectorItem test.
Let's remove it, the below test that check the Tooltip is called with the correct props is a good enough.
There was a problem hiding this comment.
Thanks for the valuable feedback, updated.
| const defaultProps = { | ||
| title: 'Test Tab', | ||
| icon: 'icon-home', | ||
| onPress: jest.fn(), | ||
| }; |
There was a problem hiding this comment.
Unused parameters, we just use the title here.
There was a problem hiding this comment.
Also use it below as a const instead of duplicate initialization in title="Test Tab"
|
@Shahidullah-Muffakir could you please add screenshots for native apps to confirm the UI is not broken? |
@ahmedGaber93 Sure, just to confirm, we're not expecting the tooltip to appear on mWeb and native apps, correct? |
|
Yeah, that's correct. The purpose of testing native apps is to confirm everything is still working and UI is not broken . |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/NikkiWines in version: 9.0.87-0 🚀
|
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.0.87-3 🚀
|

Explanation of Change
Add tooltip for the inactive tab in the create expense page when the tab title is hidden
Fixed Issues
$ #55032
PROPOSAL: #55032 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.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
Screen.Recording.2025-01-16.at.7.21.21.PM.mov
Android: mWeb Chrome
Screen.Recording.2025-01-16.at.5.58.33.PM.mov
iOS: Native
ios.native.mov
iOS: mWeb Safari
ios.safari.mov
MacOS: Chrome / Safari
macos.web.mov
MacOS: Desktop
desktop.mov