-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 8618-reduce-enzyme-usage-in-unit-test-by-25-…
…--3-of-3
- Loading branch information
Showing
23 changed files
with
673 additions
and
158 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
51 changes: 0 additions & 51 deletions
51
...omponents/UI/BasicFunctionality/BasicFunctionalityModal/BasicFunctionalityModal.styles.ts
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import React from 'react'; | ||
import { View } from 'react-native'; | ||
import Checkbox from '../../../../component-library/components/Checkbox/Checkbox'; | ||
import Icon, { | ||
IconColor, | ||
IconName, | ||
IconSize, | ||
} from '../../../../component-library/components/Icons/Icon'; | ||
import Text, { | ||
TextVariant, | ||
} from '../../../../component-library/components/Texts/Text'; | ||
import Button, { | ||
ButtonSize, | ||
ButtonVariants, | ||
} from '../../../../component-library/components/Buttons/Button'; | ||
import createStyles from './styles'; | ||
import { useTheme } from '../../../../util/theme'; | ||
interface ModalContentProps { | ||
title: string; | ||
message: string; | ||
iconName: IconName; | ||
iconColor: IconColor; | ||
iconSize: IconSize; | ||
checkBoxLabel: string; | ||
btnLabelCancel: string; | ||
btnLabelCta: string; | ||
isChecked: boolean; | ||
setIsChecked: (isChecked: boolean) => void; | ||
hascheckBox?: boolean | null | ||
handleCta: () => void; | ||
handleCancel: () => void; | ||
loading?: boolean; | ||
} | ||
|
||
const ModalContent = ({ title, message, iconName, iconColor, iconSize, checkBoxLabel, btnLabelCancel, btnLabelCta, isChecked, setIsChecked, hascheckBox, handleCancel, handleCta, loading } :ModalContentProps) => { | ||
const { colors } = useTheme(); | ||
const styles = createStyles(colors); | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Icon | ||
name={iconName} | ||
color={iconColor} | ||
size={iconSize} | ||
style={styles.icon} | ||
/> | ||
<Text variant={TextVariant.HeadingMD} style={styles.title}> | ||
{title} | ||
</Text> | ||
<Text variant={TextVariant.BodyMD} style={styles.description}> | ||
{message} | ||
</Text> | ||
<View style={styles.bottom}> | ||
{hascheckBox && ( | ||
<Checkbox | ||
label={checkBoxLabel} | ||
isChecked={isChecked} | ||
onPress={() => setIsChecked(!isChecked)} | ||
/> | ||
)} | ||
<View style={styles.buttonsContainer}> | ||
<Button | ||
variant={ButtonVariants.Secondary} | ||
size={ButtonSize.Lg} | ||
style={styles.button} | ||
accessibilityRole={'button'} | ||
accessible | ||
label={btnLabelCancel} | ||
onPress={handleCancel} | ||
/> | ||
<View style={styles.spacer} /> | ||
<Button | ||
variant={ButtonVariants.Primary} | ||
isDisabled={hascheckBox ? !isChecked : false} | ||
isDanger={hascheckBox ?? false} | ||
size={ButtonSize.Lg} | ||
style={styles.button} | ||
accessibilityRole={'button'} | ||
accessible | ||
label={btnLabelCta} | ||
onPress={handleCta} | ||
loading={loading} | ||
/> | ||
</View> | ||
</View> | ||
</View> | ||
);}; | ||
|
||
|
||
export default ModalContent; |
This file contains 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
44 changes: 44 additions & 0 deletions
44
app/components/UI/Notification/ResetNotificationsModal/ResetNotificationsModal.test.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Third party dependencies. | ||
import React from 'react'; | ||
|
||
// Internal dependencies. | ||
import ResetNotificationsModal from '.'; | ||
import renderWithProvider from '../../../../util/test/renderWithProvider'; | ||
|
||
jest.mock('react-native-safe-area-context', () => { | ||
const inset = { top: 0, right: 0, bottom: 0, left: 0 }; | ||
const frame = { width: 0, height: 0, x: 0, y: 0 }; | ||
return { | ||
SafeAreaProvider: jest.fn().mockImplementation(({ children }) => children), | ||
SafeAreaConsumer: jest | ||
.fn() | ||
.mockImplementation(({ children }) => children(inset)), | ||
useSafeAreaInsets: jest.fn().mockImplementation(() => inset), | ||
useSafeAreaFrame: jest.fn().mockImplementation(() => frame), | ||
}; | ||
}); | ||
|
||
jest.mock('@react-navigation/native', () => { | ||
const actualReactNavigation = jest.requireActual('@react-navigation/native'); | ||
return { | ||
...actualReactNavigation, | ||
useNavigation: () => ({ | ||
navigate: jest.fn(), | ||
setOptions: jest.fn(), | ||
goBack: jest.fn(), | ||
reset: jest.fn(), | ||
dangerouslyGetParent: () => ({ | ||
pop: jest.fn(), | ||
}), | ||
}), | ||
}; | ||
}); | ||
|
||
describe('ProfileSyncingModal', () => { | ||
it('should render correctly', () => { | ||
const { toJSON } = renderWithProvider( | ||
<ResetNotificationsModal />, | ||
); | ||
expect(toJSON()).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.