1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-02 06:07:06 +01:00
metamask-extension/ui/components/app/modals/hold-to-reveal-modal/hold-to-reveal-modal.test.js

182 lines
5.4 KiB
JavaScript
Raw Normal View History

SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
import React from 'react';
import configureMockState from 'redux-mock-store';
import { fireEvent, waitFor } from '@testing-library/react';
import thunk from 'redux-thunk';
import { renderWithProvider } from '../../../../../test/lib/render-helpers';
import mockState from '../../../../../test/data/mock-state.json';
import {
holdToRevealContent1,
holdToRevealContent2,
holdToRevealContent3,
holdToRevealContent4,
holdToRevealContent5,
holdToRevealSRPTitle,
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
} from '../../../../../app/_locales/en/messages.json';
import {
MetaMetricsEventCategory,
MetaMetricsEventKeyType,
MetaMetricsEventName,
} from '../../../../../shared/constants/metametrics';
import { MetaMetricsContext } from '../../../../contexts/metametrics';
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
import HoldToRevealModal from '.';
describe('Hold to Reveal Modal', () => {
const mockStore = configureMockState([thunk])(mockState);
const onLongPressStub = jest.fn();
const hideModalStub = jest.fn();
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
afterEach(() => {
jest.resetAllMocks();
});
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
it('should render the srp warning text and button', () => {
const { getByText } = renderWithProvider(
<HoldToRevealModal
onLongPressed={onLongPressStub}
hideModal={hideModalStub}
holdToRevealType="SRP"
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
/>,
mockStore,
);
const holdButton = getByText('Hold to reveal SRP');
expect(holdButton).toBeInTheDocument();
const warningTitle = getByText(holdToRevealSRPTitle.message);
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
expect(warningTitle).toBeInTheDocument();
const warningText1 = getByText(
holdToRevealContent1.message.replace(' $1', ''),
);
expect(warningText1).toBeInTheDocument();
const warningText2 = getByText(holdToRevealContent2.message);
expect(warningText2).toBeInTheDocument();
const warningText3 = getByText(
holdToRevealContent3.message.replace(' $1 $2', ''),
);
expect(warningText3).toBeInTheDocument();
const warningText4 = getByText(holdToRevealContent4.message);
expect(warningText4).toBeInTheDocument();
const warningText5 = getByText(holdToRevealContent5.message);
expect(warningText5).toBeInTheDocument();
fireEvent.click(holdButton);
expect(holdButton).toBeDefined();
fireEvent.pointerUp(holdButton);
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
expect(holdButton).toBeDefined();
});
it('should should execute onLongPressed after long press', async () => {
const { getByText, queryByLabelText } = renderWithProvider(
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
<HoldToRevealModal
onLongPressed={onLongPressStub}
hideModal={hideModalStub}
/>,
mockStore,
);
const holdButton = getByText('Hold to reveal SRP');
const circleLocked = queryByLabelText('hold to reveal circle locked');
fireEvent.pointerDown(holdButton);
fireEvent.transitionEnd(circleLocked);
const circleUnlocked = queryByLabelText('hold to reveal circle unlocked');
fireEvent.animationEnd(circleUnlocked);
await waitFor(() => {
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
expect(holdButton.firstChild).toHaveClass(
'hold-to-reveal-button__icon-container',
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
);
expect(onLongPressStub).toHaveBeenCalled();
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
});
});
it('should remain open if long pressed was not complete', async () => {
const { getByText, queryByLabelText } = renderWithProvider(
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
<HoldToRevealModal
onLongPressed={onLongPressStub}
hideModal={hideModalStub}
/>,
mockStore,
);
const holdButton = getByText('Hold to reveal SRP');
fireEvent.click(holdButton);
const circleLocked = queryByLabelText('hold to reveal circle locked');
const circleUnlocked = queryByLabelText('hold to reveal circle unlocked');
await waitFor(() => {
expect(circleLocked).toBeInTheDocument();
expect(circleUnlocked).not.toBeInTheDocument();
expect(onLongPressStub).not.toHaveBeenCalled();
expect(hideModalStub).not.toHaveBeenCalled();
});
});
it('should fire event when closing', async () => {
const mockTrackEvent = jest.fn();
const { queryByLabelText } = renderWithProvider(
<MetaMetricsContext.Provider value={mockTrackEvent}>
<HoldToRevealModal
onLongPressed={onLongPressStub}
hideModal={hideModalStub}
/>
,
</MetaMetricsContext.Provider>,
mockStore,
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
);
const closeButton = queryByLabelText('Close');
fireEvent.click(closeButton);
await waitFor(() => {
expect(mockTrackEvent).toHaveBeenCalledWith({
category: MetaMetricsEventCategory.Keys,
event: MetaMetricsEventName.SrpHoldToRevealCloseClicked,
properties: {
key_type: MetaMetricsEventKeyType.Srp,
},
});
});
});
it('should not hide modal after completing long press if set to false', async () => {
const { getByText, queryByLabelText } = renderWithProvider(
<HoldToRevealModal
onLongPressed={onLongPressStub}
hideModal={hideModalStub}
willHide={false}
/>,
mockStore,
);
const holdButton = getByText('Hold to reveal SRP');
const circleLocked = queryByLabelText('hold to reveal circle locked');
fireEvent.pointerDown(holdButton);
fireEvent.transitionEnd(circleLocked);
const circleUnlocked = queryByLabelText('hold to reveal circle unlocked');
fireEvent.animationEnd(circleUnlocked);
await waitFor(() => {
expect(holdButton.firstChild).toHaveClass(
'hold-to-reveal-button__icon-container',
);
expect(onLongPressStub).toHaveBeenCalled();
expect(hideModalStub).not.toHaveBeenCalled();
});
SRP hold to reveal (#17232) * refactor class to functional component * update messages * fix: use classnames * feat: add hold to reveal modal * feat: add new zendesk url for secret recovery phrase and noncustodial wallet * update: clipboard to clear copied text after delay * fix: remove save to csv * feat: update styles for reveal seed page * fix: update reveal seed snapshot * add test to check for modal * fix: lint * fix: unused messages locale * fix: use new banner component * fix: use new button from design system * fix: update snapshot * fix: lint * revert text * fix: lint * fix: remove --copy-only * fix: marginBottom prop value * fix: iconName and prop error * --made the QR code slightly smaller so it's less likely to have a scrollbar --updated the snapshots * fix: error message not displaying * SRP hold to reveal using more DS components (#17583) * Updating to add DS components and remove CSS * Fixing rendered html and removing some unneeded props * fix: set block to true --------- Co-authored-by: Monte <monte.lai@consensys.net> * fix: add descriptions to messages * Update ui/components/ui/export-text-container/export-text-container.component.js fix: lint Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com> * fix: remove using displayWarning in requestRevealSeedWords * fix: update test to remove displayError * fix: update design system enums * fix: messages descriptions * fix: banner to banneralert * fix: update preview * add additional tests * fix: use jest instead of sinon * add test if long press isn't completed * add test if password is wrong --------- Co-authored-by: Howard Braham <howrad@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-02-15 19:07:33 +01:00
});
});