fix:70995:removed blank space for Destination picker on Confirmation page#72187
Conversation
Codecov Report❌ Patch coverage is
... and 8 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
@Eskalifer1 do you think it's possible for us to create unit test here? Thanks. |
|
Hi @brunovjk , I don't think we can reproduce this result in a test environment, but we can write something similar that will check whether the value of import {render} from '@testing-library/react-native';
import React from 'react';
import type {ComponentType, ReactNode} from 'react';
import type Navigation from '@libs/Navigation/Navigation';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import type {MoneyRequestNavigatorParamList} from '@libs/Navigation/types';
import IOURequestStepDestination from '@pages/iou/request/step/IOURequestStepDestination';
import type {IOURequestStepDestinationProps} from '@pages/iou/request/step/IOURequestStepDestination';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import type SCREENS from '@src/SCREENS';
jest.mock('@components/ScreenWrapper', () => {
return jest.fn(({keyboardVerticalOffset}) => {
return `keyboardVerticalOffset:${keyboardVerticalOffset}`;
});
});
jest.mock('@pages/iou/request/step/StepScreenWrapper.tsx', () => jest.fn(({children}: {children?: ReactNode}) => children));
jest.mock('@pages/iou/request/step/withFullTransactionOrNotFound', () => (Component: ComponentType<IOURequestStepDestinationProps>) => Component);
jest.mock('@pages/iou/request/step/withWritableReportOrNotFound', () => (Component: ComponentType<IOURequestStepDestinationProps>) => Component);
jest.mock('@react-navigation/native', () => {
const actualNav = jest.requireActual<typeof Navigation>('@react-navigation/native');
return {
...actualNav,
useIsFocused: jest.fn(),
};
});
describe('IOURequestStepDestination', () => {
it('sets keyboardVerticalOffset to 0 when openedFromStartPage = false', () => {
const {toJSON} = render(
<IOURequestStepDestination
route={
{params: {iouType: CONST.IOU.TYPE.SUBMIT, reportID: '1', transactionID: ''}} as PlatformStackScreenProps<
MoneyRequestNavigatorParamList,
typeof SCREENS.MONEY_REQUEST.CREATE
>['route']
}
navigation={{} as PlatformStackScreenProps<MoneyRequestNavigatorParamList, typeof SCREENS.MONEY_REQUEST.CREATE>['navigation']}
openedFromStartPage={false}
/>,
);
expect(toJSON()).toContain('keyboardVerticalOffset:0');
});
it('sets keyboardVerticalOffset to correct value when openedFromStartPage = true', () => {
jest.resetModules();
const {toJSON} = render(
<IOURequestStepDestination
route={
{params: {iouType: CONST.IOU.TYPE.SUBMIT, reportID: '1', transactionID: ''}} as PlatformStackScreenProps<
MoneyRequestNavigatorParamList,
typeof SCREENS.MONEY_REQUEST.CREATE
>['route']
}
navigation={{} as PlatformStackScreenProps<MoneyRequestNavigatorParamList, typeof SCREENS.MONEY_REQUEST.CREATE>['navigation']}
openedFromStartPage
/>,
);
// We do not include top here because this is a test environment and we cannot obtain this value.
const expectedOffset = variables.contentHeaderHeight + variables.tabSelectorButtonHeight + variables.tabSelectorButtonPadding;
expect(toJSON()).toContain(`keyboardVerticalOffset:${expectedOffset}`);
});
}); |
|
Thank you @Eskalifer1. I think we’re fine to skip adding a unit test here. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp72187_android_web.movAndroid: mWeb Chrome72187_android_web.moviOS: HybridApp72187_ios_native.moviOS: mWeb Safari72187_ios_web.movMacOS: Chrome / Safari72187_web_chrome.movMacOS: Desktop72187_web_desktop.mov |
|
✋ 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/chuckdries in version: 9.2.33-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.2.33-4 🚀
|
Explanation of Change
Fixed Issues
$#70995
PROPOSAL:#70995 (comment)
Tests
Precondition:
Workspace has imported per diem rates
Offline tests
Same as tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)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
70995-android-native.mp4
Android: mWeb Chrome
70995-android-web.mp4
iOS: Native
70995-ios-native.mp4
iOS: mWeb Safari
70995-ios-web.mp4
MacOS: Chrome / Safari
70995-web.mov
MacOS: Desktop
70995-desktop.mp4