Skip to content
Merged
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
Expand Up @@ -33,19 +33,6 @@ const styleSheet = (params: {
} as ViewStyle,
style,
) as ViewStyle,
underlay: {
...StyleSheet.absoluteFillObject,
flexDirection: 'row',
backgroundColor: colors.primary.muted,
width: 4,
},
underlayBar: {
marginVertical: 4,
marginLeft: 4,
width: 4,
borderRadius: 2,
backgroundColor: colors.primary.default,
},
listItem: {
paddingRight: 0,
paddingTop: 0,
Expand All @@ -69,7 +56,7 @@ const styleSheet = (params: {
},
container: {
backgroundColor: isSelected
? colors.primary.muted
? colors.background.muted
: colors.background.default,
flexDirection: 'row',
alignItems: 'center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,6 @@ describe('ListItemMultiSelectButton', () => {
expect(wrapper).toMatchSnapshot();
});

it('should not render the underlay view if isSelected is false', () => {
const { queryByRole } = render(
<ListItemMultiSelectButton>
<View />
</ListItemMultiSelectButton>,
);
expect(queryByRole('checkbox')).toBeNull();
});

it('should render the underlay view if isSelected is true', () => {
const { queryByRole } = render(
<ListItemMultiSelectButton isSelected>
<View />
</ListItemMultiSelectButton>,
);
expect(queryByRole('checkbox')).not.toBeNull();
});

it('should call onPress when the button is pressed', () => {
const mockOnPress = jest.fn();
const { getByRole } = render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ const ListItemMultiSelectButton: React.FC<ListItemMultiSelectButtonProps> = ({
<ListItem gap={gap} style={styles.containerColumn}>
{children}
</ListItem>
{isSelected && (
<View style={styles.underlay} accessibilityRole="checkbox" accessible>
<View style={styles.underlayBar} />
</View>
)}
</TouchableOpacity>
{showButtonIcon ? (
<View style={styles.buttonIcon}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ const styleSheet = (params: { theme: Theme; vars: unknown }) => {
verticalAlign: 'middle',
},
menuButton: {
backgroundColor: colors.background.muted,
borderRadius: 8,
height: 28,
width: 28,
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const styleSheet = (params: {
underlay: {
...StyleSheet.absoluteFillObject,
flexDirection: 'row',
backgroundColor: colors.primary.muted,
backgroundColor: colors.background.muted,
},
checkbox: {
marginRight: 8 - Number(gap),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import { ListItemSelectProps } from './ListItemSelect.types';
// Defaults
export const DEFAULT_SELECTITEM_GAP = 16;

// Test IDs
export const SELECTABLE_ITEM_UNDERLAY_ID = 'selectable-item-underlay';

// Sample consts
export const SAMPLE_SELECTITEM_PROPS: ListItemSelectProps = {
isSelected: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,11 @@ const styleSheet = (params: {
underlay: {
...StyleSheet.absoluteFillObject,
flexDirection: 'row',
backgroundColor: colors.primary.muted,
backgroundColor: colors.background.muted,
},
listItem: {
padding: 16,
},
underlayBar: {
marginVertical: 4,
marginLeft: 4,
width: 4,
borderRadius: 2,
backgroundColor: colors.primary.default,
},
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ const ListItemSelect: React.FC<ListItemSelectProps> = ({
{children}
</ListItem>
{isSelected && (
<View style={styles.underlay} accessibilityRole="checkbox" accessible>
<View style={styles.underlayBar} />
</View>
<View style={styles.underlay} accessibilityRole="checkbox" accessible />
)}
</TouchableOpacity>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ exports[`CaipAccountSelectorList renders all accounts with balances 1`] = `
style={
{
"alignItems": "center",
"backgroundColor": "#4459ff1a",
"backgroundColor": "#3c4d9d0f",
"flexDirection": "row",
}
}
Expand Down Expand Up @@ -248,34 +248,6 @@ exports[`CaipAccountSelectorList renders all accounts with balances 1`] = `
</View>
</View>
</View>
<View
accessibilityRole="checkbox"
accessible={true}
style={
{
"backgroundColor": "#4459ff1a",
"bottom": 0,
"flexDirection": "row",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
"width": 4,
}
}
>
<View
style={
{
"backgroundColor": "#4459ff",
"borderRadius": 2,
"marginLeft": 4,
"marginVertical": 4,
"width": 4,
}
}
/>
</View>
</TouchableOpacity>
<View
style={
Expand Down Expand Up @@ -627,7 +599,7 @@ exports[`CaipAccountSelectorList renders all accounts with right accessory 1`] =
style={
{
"alignItems": "center",
"backgroundColor": "#4459ff1a",
"backgroundColor": "#3c4d9d0f",
"flexDirection": "row",
}
}
Expand Down Expand Up @@ -770,34 +742,6 @@ exports[`CaipAccountSelectorList renders all accounts with right accessory 1`] =
</View>
</View>
</View>
<View
accessibilityRole="checkbox"
accessible={true}
style={
{
"backgroundColor": "#4459ff1a",
"bottom": 0,
"flexDirection": "row",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
"width": 4,
}
}
>
<View
style={
{
"backgroundColor": "#4459ff",
"borderRadius": 2,
"marginLeft": 4,
"marginVertical": 4,
"width": 4,
}
}
/>
</View>
</TouchableOpacity>
<View
style={
Expand Down Expand Up @@ -1112,7 +1056,7 @@ exports[`CaipAccountSelectorList renders correctly 1`] = `
style={
{
"alignItems": "center",
"backgroundColor": "#4459ff1a",
"backgroundColor": "#3c4d9d0f",
"flexDirection": "row",
}
}
Expand Down Expand Up @@ -1292,34 +1236,6 @@ exports[`CaipAccountSelectorList renders correctly 1`] = `
</View>
</View>
</View>
<View
accessibilityRole="checkbox"
accessible={true}
style={
{
"backgroundColor": "#4459ff1a",
"bottom": 0,
"flexDirection": "row",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
"width": 4,
}
}
>
<View
style={
{
"backgroundColor": "#4459ff",
"borderRadius": 2,
"marginLeft": 4,
"marginVertical": 4,
"width": 4,
}
}
/>
</View>
</TouchableOpacity>
<View
style={
Expand Down Expand Up @@ -1671,7 +1587,7 @@ exports[`CaipAccountSelectorList renders network icons for accounts with transac
style={
{
"alignItems": "center",
"backgroundColor": "#4459ff1a",
"backgroundColor": "#3c4d9d0f",
"flexDirection": "row",
}
}
Expand Down Expand Up @@ -1851,34 +1767,6 @@ exports[`CaipAccountSelectorList renders network icons for accounts with transac
</View>
</View>
</View>
<View
accessibilityRole="checkbox"
accessible={true}
style={
{
"backgroundColor": "#4459ff1a",
"bottom": 0,
"flexDirection": "row",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
"width": 4,
}
}
>
<View
style={
{
"backgroundColor": "#4459ff",
"borderRadius": 2,
"marginLeft": 4,
"marginVertical": 4,
"width": 4,
}
}
/>
</View>
</TouchableOpacity>
<View
style={
Expand Down
35 changes: 10 additions & 25 deletions app/components/UI/DeleteWalletModal/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import { createStackNavigator } from '@react-navigation/stack';
import { RootState } from '../../../reducers';
import { strings } from '../../../../locales/i18n';
import { ForgotPasswordModalSelectorsIDs } from '../../../../e2e/selectors/Common/ForgotPasswordModal.selectors';
import { SET_COMPLETED_ONBOARDING } from '../../../actions/onboarding';
import { InteractionManager } from 'react-native';
import StorageWrapper from '../../../store/storage-wrapper';
import { OPTIN_META_METRICS_UI_SEEN } from '../../../constants/storage';
import { clearHistory } from '../../../actions/browser';
import { Authentication } from '../../../core/Authentication/Authentication';

const mockInitialState = {
engine: { backgroundState },
Expand All @@ -22,12 +20,6 @@ const mockInitialState = {
},
};

jest.mock('../../../store/storage-wrapper', () => ({
getItem: jest.fn(),
setItem: jest.fn(),
removeItem: jest.fn(),
}));

const mockUseDispatch = jest.fn();

jest.mock('react-redux', () => ({
Expand Down Expand Up @@ -74,11 +66,10 @@ jest.mock('../../../util/identity/hooks/useAuthentication', () => ({
}),
}));

jest.mock('../../hooks/DeleteWallet', () => ({
useDeleteWallet: () => [
jest.fn(() => Promise.resolve()),
jest.fn(() => Promise.resolve()),
],
jest.mock('../../../core/Authentication/Authentication', () => ({
Authentication: {
deleteWallet: jest.fn(() => Promise.resolve()),
},
}));

const Stack = createStackNavigator();
Expand Down Expand Up @@ -153,7 +144,6 @@ describe('DeleteWalletModal', () => {
});

it('signs the user out when deleting the wallet', async () => {
const removeItemSpy = jest.spyOn(StorageWrapper, 'removeItem');
const { getByTestId } = renderComponent(mockInitialState);

fireEvent.press(
Expand All @@ -164,11 +154,9 @@ describe('DeleteWalletModal', () => {
);

expect(mockSignOut).toHaveBeenCalled();
expect(removeItemSpy).toHaveBeenCalledWith(OPTIN_META_METRICS_UI_SEEN);
});

it('sets completedOnboarding to false when deleting the wallet', async () => {
const removeItemSpy = jest.spyOn(StorageWrapper, 'removeItem');
it('calls deleteWallet when deleting the wallet', async () => {
const { getByTestId } = renderComponent(mockInitialState);

fireEvent.press(
Expand All @@ -178,13 +166,10 @@ describe('DeleteWalletModal', () => {
getByTestId(ForgotPasswordModalSelectorsIDs.YES_RESET_WALLET_BUTTON),
);

expect(mockUseDispatch).toHaveBeenCalledWith(
expect.objectContaining({
type: SET_COMPLETED_ONBOARDING,
completedOnboarding: false,
}),
);
expect(removeItemSpy).toHaveBeenCalledWith(OPTIN_META_METRICS_UI_SEEN);
// Wait for async operations
await Promise.resolve();

expect(Authentication.deleteWallet).toHaveBeenCalled();
});
});

Expand Down
Loading
Loading