1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Replace history during onboarding (#12693)

This commit is contained in:
Elliot Winkler 2021-11-15 12:16:11 -07:00 committed by GitHub
parent d810e7f0c6
commit 405b56c730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 14 deletions

View File

@ -142,7 +142,7 @@ export default class ImportWithSeedPhrase extends PureComponent {
setSeedPhraseBackedUp(true).then(async () => {
initializeThreeBox();
history.push(INITIALIZE_END_OF_FLOW_ROUTE);
history.replace(INITIALIZE_END_OF_FLOW_ROUTE);
});
} catch (error) {
this.setState({ seedPhraseError: error.message });

View File

@ -25,11 +25,11 @@ describe('ConfirmSeedPhrase Component', () => {
it('should add/remove selected on click', () => {
const metricsEventSpy = sinon.spy();
const pushSpy = sinon.spy();
const replaceSpy = sinon.spy();
const root = shallowRender(
{
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
history: { push: pushSpy },
history: { replace: replaceSpy },
},
{
metricsEvent: metricsEventSpy,
@ -58,11 +58,11 @@ describe('ConfirmSeedPhrase Component', () => {
it('should render correctly on hover', () => {
const metricsEventSpy = sinon.spy();
const pushSpy = sinon.spy();
const replaceSpy = sinon.spy();
const root = shallowRender(
{
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
history: { push: pushSpy },
history: { replace: replaceSpy },
},
{
metricsEvent: metricsEventSpy,
@ -93,11 +93,11 @@ describe('ConfirmSeedPhrase Component', () => {
it('should insert seed in place on drop', () => {
const metricsEventSpy = sinon.spy();
const pushSpy = sinon.spy();
const replaceSpy = sinon.spy();
const root = shallowRender(
{
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
history: { push: pushSpy },
history: { replace: replaceSpy },
},
{
metricsEvent: metricsEventSpy,
@ -138,12 +138,12 @@ describe('ConfirmSeedPhrase Component', () => {
'豬',
];
const metricsEventSpy = sinon.spy();
const pushSpy = sinon.spy();
const replaceSpy = sinon.spy();
const initialize3BoxSpy = sinon.spy();
const root = shallowRender(
{
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
history: { push: pushSpy },
history: { replace: replaceSpy },
setSeedPhraseBackedUp: () => Promise.resolve(),
initializeThreeBox: initialize3BoxSpy,
},
@ -174,6 +174,6 @@ describe('ConfirmSeedPhrase Component', () => {
},
});
expect(initialize3BoxSpy.calledOnce).toStrictEqual(true);
expect(pushSpy.args[0][0]).toStrictEqual('/initialize/end-of-flow');
expect(replaceSpy.args[0][0]).toStrictEqual('/initialize/end-of-flow');
});
});

View File

@ -87,7 +87,7 @@ export default class ConfirmSeedPhrase extends PureComponent {
setSeedPhraseBackedUp(true).then(async () => {
initializeThreeBox();
history.push(INITIALIZE_END_OF_FLOW_ROUTE);
history.replace(INITIALIZE_END_OF_FLOW_ROUTE);
});
} catch (error) {
console.error(error.message);

View File

@ -54,7 +54,7 @@ export default class RevealSeedPhrase extends PureComponent {
return;
}
history.push(INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE);
history.replace(INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE);
};
handleSkip = async () => {
@ -78,7 +78,7 @@ export default class RevealSeedPhrase extends PureComponent {
if (onboardingInitiator) {
await returnToOnboardingInitiator(onboardingInitiator);
}
history.push(DEFAULT_ROUTE);
history.replace(DEFAULT_ROUTE);
};
renderSecretWordsContainer() {

View File

@ -101,7 +101,7 @@ export default function ImportSRP({ submitSecretRecoveryPhrase }) {
large
onClick={() => {
submitSecretRecoveryPhrase(secretRecoveryPhrase);
history.push(ONBOARDING_CREATE_PASSWORD_ROUTE);
history.replace(ONBOARDING_CREATE_PASSWORD_ROUTE);
}}
disabled={error || secretRecoveryPhrase.length === 0}
>