Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { brandColor, darkTheme } from '@metamask/design-tokens';
import { AppThemeKey, Theme } from '../../../../../util/theme/models';

const MOCK_ELEVATED_SURFACE_COLOR = 'mock-elevated-surface-color';

jest.mock('../../../../../util/theme/themeUtils', () => ({
getElevatedSurfaceColor: jest.fn(() => MOCK_ELEVATED_SURFACE_COLOR),
}));

import styleSheet from './confirm-component.styles';

const darkThemeModel: Theme = {
colors: darkTheme.colors,
themeAppearance: AppThemeKey.dark,
typography: darkTheme.typography,
shadows: darkTheme.shadows,
brandColors: brandColor,
};

describe('confirm-component.styles', () => {
it('uses elevated surface color for the full-screen flat container', () => {
const styles = styleSheet({
theme: darkThemeModel,
vars: { isFullScreenConfirmation: true },
});

expect(styles.flatContainer.backgroundColor).toBe(
MOCK_ELEVATED_SURFACE_COLOR,
);
});

it('uses elevated surface color for the default loader spinner container', () => {
const styles = styleSheet({
theme: darkThemeModel,
vars: { isFullScreenConfirmation: true },
});

expect(styles.spinnerContainer.backgroundColor).toBe(
MOCK_ELEVATED_SURFACE_COLOR,
);
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { StyleSheet } from 'react-native';
import { Theme } from '../../../../../util/theme/models';
import { getElevatedSurfaceColor } from '../../../../../util/theme/themeUtils';

const styleSheet = (params: {
theme: Theme;
Expand All @@ -11,17 +12,15 @@
const { theme, vars } = params;

return StyleSheet.create({
bottomSheetDialogSheet: {
backgroundColor: theme.colors.background.default,
},
confirmContainer: {
display: 'flex',
maxHeight: '100%',
},
flatContainer: {
flex: 1,
zIndex: 9999,
backgroundColor: theme.colors.background.default,
// TODO(Pure Black): Remove once MMDS ships pure-black-aware surface tokens.

Check warning on line 22 in app/components/Views/confirmations/components/confirm/confirm-component.styles.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=MetaMask_metamask-mobile&issues=AZ9nLVDW-bz6XtERJzFS&open=AZ9nLVDW-bz6XtERJzFS&pullRequest=33378
backgroundColor: getElevatedSurfaceColor(theme),
justifyContent: 'space-between',
},
scrollView: {
Expand All @@ -31,7 +30,8 @@
flexGrow: vars.isFullScreenConfirmation ? 1 : undefined,
},
spinnerContainer: {
backgroundColor: theme.colors.background.default,
// TODO(Pure Black): Remove once MMDS ships pure-black-aware surface tokens.

Check warning on line 33 in app/components/Views/confirmations/components/confirm/confirm-component.styles.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=MetaMask_metamask-mobile&issues=AZ9nLVDW-bz6XtERJzFT&open=AZ9nLVDW-bz6XtERJzFT&pullRequest=33378
backgroundColor: getElevatedSurfaceColor(theme),
width: '100%',
height: '100%',
justifyContent: 'center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ export const Confirm = ({
<BottomSheet
onClose={() => onReject()}
shouldNavigateBack={false}
style={styles.bottomSheetDialogSheet}
testID={ConfirmationUIType.MODAL}
>
<View testID={approvalRequest?.type} style={styles.confirmContainer}>
Expand Down
Loading