Skip to content
This repository has been archived by the owner on Jan 2, 2020. It is now read-only.

[#971] Add backup account confirmation page #1011

Merged
merged 7 commits into from
Mar 16, 2017
Merged

Conversation

tayanefernandes
Copy link
Contributor

We still have to do the css for the confirmation page.

@@ -39,16 +40,23 @@ export class BackupEmail extends React.Component {
});
}

submitHandler = (event) => {
event.preventDefault();
if (typeof this.props.onSubmit === 'function') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this if necessary if we define that onSubmit is required (as you said it was required in the propTypes? I think we should avoid it.

@@ -23,6 +24,15 @@ describe('BackupEmail', () => {
expect(page.find('SubmitButton').props().buttonText).toEqual('backup-account.backup-email.button');
});

it('form submit should call parameter custom submit', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Messages for tests should always start with a verb, since the syntax is: "BackupEmail calls...". Mocha follows the rule of describe(<ComponentName>), context(<Situation>), it(<action>).

const event = { preventDefault() {} };
page = shallow(<BackupEmail t={mockTranslations} onSubmit={mockOnSubmit} />);

page.instance().submitHandler(event);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we could simulate a form submit to test that onSubmit was called.

backupEmail.find('form').simulate('submit', { preventDefault: () => {} });
expect(mockOnSubmit).toHaveBeenCalled();

expect(page.find('a').text()).toEqual('backup-account.confirmation.retry-button');
});

it('retry button redirects to backup account', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"retry" => "retries"

pageInstance = page.instance();
});

it('verify initial state', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"verify" => "verifies"

it('changes state', () => {
pageInstance.saveBackupEmail();
expect(pageInstance.state.status).toEqual('success');
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no test for checking if we are rendering Confirmation or BackupEmail component. 😢

@tayanefernandes
Copy link
Contributor Author

@thaissiqueira and @anikarni As we talked, we fixed the issues in the confirmation.spec.js and page.spec.js

@thaissiqueira thaissiqueira merged commit d1459b6 into master Mar 16, 2017
@deniscostadsc deniscostadsc deleted the confirmation-page branch April 10, 2017 18:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants