mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Replace history during onboarding (#12693)
This commit is contained in:
parent
d810e7f0c6
commit
405b56c730
@ -142,7 +142,7 @@ export default class ImportWithSeedPhrase extends PureComponent {
|
|||||||
|
|
||||||
setSeedPhraseBackedUp(true).then(async () => {
|
setSeedPhraseBackedUp(true).then(async () => {
|
||||||
initializeThreeBox();
|
initializeThreeBox();
|
||||||
history.push(INITIALIZE_END_OF_FLOW_ROUTE);
|
history.replace(INITIALIZE_END_OF_FLOW_ROUTE);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.setState({ seedPhraseError: error.message });
|
this.setState({ seedPhraseError: error.message });
|
||||||
|
@ -25,11 +25,11 @@ describe('ConfirmSeedPhrase Component', () => {
|
|||||||
|
|
||||||
it('should add/remove selected on click', () => {
|
it('should add/remove selected on click', () => {
|
||||||
const metricsEventSpy = sinon.spy();
|
const metricsEventSpy = sinon.spy();
|
||||||
const pushSpy = sinon.spy();
|
const replaceSpy = sinon.spy();
|
||||||
const root = shallowRender(
|
const root = shallowRender(
|
||||||
{
|
{
|
||||||
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
|
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
|
||||||
history: { push: pushSpy },
|
history: { replace: replaceSpy },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
metricsEvent: metricsEventSpy,
|
metricsEvent: metricsEventSpy,
|
||||||
@ -58,11 +58,11 @@ describe('ConfirmSeedPhrase Component', () => {
|
|||||||
|
|
||||||
it('should render correctly on hover', () => {
|
it('should render correctly on hover', () => {
|
||||||
const metricsEventSpy = sinon.spy();
|
const metricsEventSpy = sinon.spy();
|
||||||
const pushSpy = sinon.spy();
|
const replaceSpy = sinon.spy();
|
||||||
const root = shallowRender(
|
const root = shallowRender(
|
||||||
{
|
{
|
||||||
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
|
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
|
||||||
history: { push: pushSpy },
|
history: { replace: replaceSpy },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
metricsEvent: metricsEventSpy,
|
metricsEvent: metricsEventSpy,
|
||||||
@ -93,11 +93,11 @@ describe('ConfirmSeedPhrase Component', () => {
|
|||||||
|
|
||||||
it('should insert seed in place on drop', () => {
|
it('should insert seed in place on drop', () => {
|
||||||
const metricsEventSpy = sinon.spy();
|
const metricsEventSpy = sinon.spy();
|
||||||
const pushSpy = sinon.spy();
|
const replaceSpy = sinon.spy();
|
||||||
const root = shallowRender(
|
const root = shallowRender(
|
||||||
{
|
{
|
||||||
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
|
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
|
||||||
history: { push: pushSpy },
|
history: { replace: replaceSpy },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
metricsEvent: metricsEventSpy,
|
metricsEvent: metricsEventSpy,
|
||||||
@ -138,12 +138,12 @@ describe('ConfirmSeedPhrase Component', () => {
|
|||||||
'豬',
|
'豬',
|
||||||
];
|
];
|
||||||
const metricsEventSpy = sinon.spy();
|
const metricsEventSpy = sinon.spy();
|
||||||
const pushSpy = sinon.spy();
|
const replaceSpy = sinon.spy();
|
||||||
const initialize3BoxSpy = sinon.spy();
|
const initialize3BoxSpy = sinon.spy();
|
||||||
const root = shallowRender(
|
const root = shallowRender(
|
||||||
{
|
{
|
||||||
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
|
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
|
||||||
history: { push: pushSpy },
|
history: { replace: replaceSpy },
|
||||||
setSeedPhraseBackedUp: () => Promise.resolve(),
|
setSeedPhraseBackedUp: () => Promise.resolve(),
|
||||||
initializeThreeBox: initialize3BoxSpy,
|
initializeThreeBox: initialize3BoxSpy,
|
||||||
},
|
},
|
||||||
@ -174,6 +174,6 @@ describe('ConfirmSeedPhrase Component', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(initialize3BoxSpy.calledOnce).toStrictEqual(true);
|
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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -87,7 +87,7 @@ export default class ConfirmSeedPhrase extends PureComponent {
|
|||||||
|
|
||||||
setSeedPhraseBackedUp(true).then(async () => {
|
setSeedPhraseBackedUp(true).then(async () => {
|
||||||
initializeThreeBox();
|
initializeThreeBox();
|
||||||
history.push(INITIALIZE_END_OF_FLOW_ROUTE);
|
history.replace(INITIALIZE_END_OF_FLOW_ROUTE);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error.message);
|
console.error(error.message);
|
||||||
|
@ -54,7 +54,7 @@ export default class RevealSeedPhrase extends PureComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
history.push(INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE);
|
history.replace(INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE);
|
||||||
};
|
};
|
||||||
|
|
||||||
handleSkip = async () => {
|
handleSkip = async () => {
|
||||||
@ -78,7 +78,7 @@ export default class RevealSeedPhrase extends PureComponent {
|
|||||||
if (onboardingInitiator) {
|
if (onboardingInitiator) {
|
||||||
await returnToOnboardingInitiator(onboardingInitiator);
|
await returnToOnboardingInitiator(onboardingInitiator);
|
||||||
}
|
}
|
||||||
history.push(DEFAULT_ROUTE);
|
history.replace(DEFAULT_ROUTE);
|
||||||
};
|
};
|
||||||
|
|
||||||
renderSecretWordsContainer() {
|
renderSecretWordsContainer() {
|
||||||
|
@ -101,7 +101,7 @@ export default function ImportSRP({ submitSecretRecoveryPhrase }) {
|
|||||||
large
|
large
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
submitSecretRecoveryPhrase(secretRecoveryPhrase);
|
submitSecretRecoveryPhrase(secretRecoveryPhrase);
|
||||||
history.push(ONBOARDING_CREATE_PASSWORD_ROUTE);
|
history.replace(ONBOARDING_CREATE_PASSWORD_ROUTE);
|
||||||
}}
|
}}
|
||||||
disabled={error || secretRecoveryPhrase.length === 0}
|
disabled={error || secretRecoveryPhrase.length === 0}
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user