Commit 30967a30 authored by picklesrus's avatar picklesrus

Set sendAnalytics to be required and send the right props to the error step....

Set sendAnalytics to be required and send the right props to the error step. Also add a test for the error step.
parent e4b79c1b
...@@ -167,7 +167,7 @@ class BirthDateStep extends React.Component { ...@@ -167,7 +167,7 @@ class BirthDateStep extends React.Component {
BirthDateStep.propTypes = { BirthDateStep.propTypes = {
intl: intlShape, intl: intlShape,
onNextStep: PropTypes.func, onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func sendAnalytics: PropTypes.func.isRequired
}; };
const IntlBirthDateStep = injectIntl(BirthDateStep); const IntlBirthDateStep = injectIntl(BirthDateStep);
......
...@@ -122,7 +122,7 @@ class CountryStep extends React.Component { ...@@ -122,7 +122,7 @@ class CountryStep extends React.Component {
CountryStep.propTypes = { CountryStep.propTypes = {
intl: intlShape, intl: intlShape,
onNextStep: PropTypes.func, onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func sendAnalytics: PropTypes.func.isRequired
}; };
const IntlCountryStep = injectIntl(CountryStep); const IntlCountryStep = injectIntl(CountryStep);
......
...@@ -235,8 +235,12 @@ EmailStep.propTypes = { ...@@ -235,8 +235,12 @@ EmailStep.propTypes = {
<<<<<<< HEAD <<<<<<< HEAD
======= =======
onRegistrationError: PropTypes.func, onRegistrationError: PropTypes.func,
<<<<<<< HEAD
sendAnalytics: PropTypes.func, sendAnalytics: PropTypes.func,
>>>>>>> Add analytics logging to join flow. Adding page views for each step in the flow. >>>>>>> Add analytics logging to join flow. Adding page views for each step in the flow.
=======
sendAnalytics: PropTypes.func.isRequired,
>>>>>>> Set sendAnalytics to be required and send the right props to the error step. Also add a test for the error step.
waiting: PropTypes.bool waiting: PropTypes.bool
}; };
......
...@@ -184,7 +184,7 @@ class GenderStep extends React.Component { ...@@ -184,7 +184,7 @@ class GenderStep extends React.Component {
GenderStep.propTypes = { GenderStep.propTypes = {
intl: intlShape, intl: intlShape,
onNextStep: PropTypes.func, onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func sendAnalytics: PropTypes.func.isRequired
}; };
module.exports = injectIntl(GenderStep); module.exports = injectIntl(GenderStep);
...@@ -233,7 +233,12 @@ class JoinFlow extends React.Component { ...@@ -233,7 +233,12 @@ class JoinFlow extends React.Component {
{this.state.registrationError ? ( {this.state.registrationError ? (
<RegistrationErrorStep <RegistrationErrorStep
canTryAgain={this.canTryAgain()} canTryAgain={this.canTryAgain()}
<<<<<<< HEAD
errorMsg={this.state.registrationError.errorMsg} errorMsg={this.state.registrationError.errorMsg}
=======
errorMsg={this.state.registrationError}
sendAnalytics={this.sendAnalytics}
>>>>>>> Set sendAnalytics to be required and send the right props to the error step. Also add a test for the error step.
/* eslint-disable react/jsx-no-bind */ /* eslint-disable react/jsx-no-bind */
onSubmit={this.handleErrorNext} onSubmit={this.handleErrorNext}
/* eslint-enable react/jsx-no-bind */ /* eslint-enable react/jsx-no-bind */
......
...@@ -63,12 +63,17 @@ RegistrationErrorStep.propTypes = { ...@@ -63,12 +63,17 @@ RegistrationErrorStep.propTypes = {
canTryAgain: PropTypes.bool.isRequired, canTryAgain: PropTypes.bool.isRequired,
errorMsg: PropTypes.string, errorMsg: PropTypes.string,
intl: intlShape, intl: intlShape,
<<<<<<< HEAD
onSubmit: PropTypes.func.isRequired, onSubmit: PropTypes.func.isRequired,
sendAnalytics: PropTypes.func.isRequired sendAnalytics: PropTypes.func.isRequired
}; };
RegistrationErrorStep.defaultProps = { RegistrationErrorStep.defaultProps = {
canTryAgain: false canTryAgain: false
=======
onSubmit: PropTypes.func,
sendAnalytics: PropTypes.func.isRequired
>>>>>>> Set sendAnalytics to be required and send the right props to the error step. Also add a test for the error step.
}; };
const IntlRegistrationErrorStep = injectIntl(RegistrationErrorStep); const IntlRegistrationErrorStep = injectIntl(RegistrationErrorStep);
......
...@@ -289,7 +289,7 @@ class UsernameStep extends React.Component { ...@@ -289,7 +289,7 @@ class UsernameStep extends React.Component {
UsernameStep.propTypes = { UsernameStep.propTypes = {
intl: intlShape, intl: intlShape,
onNextStep: PropTypes.func, onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func sendAnalytics: PropTypes.func.isRequired
}; };
const IntlUsernameStep = injectIntl(UsernameStep); const IntlUsernameStep = injectIntl(UsernameStep);
......
import React from 'react'; import React from 'react';
import {shallowWithIntl} from '../../helpers/intl-helpers.jsx'; import {shallowWithIntl} from '../../helpers/intl-helpers.jsx';
import {mountWithIntl} from '../../helpers/intl-helpers.jsx';
import JoinFlowStep from '../../../src/components/join-flow/join-flow-step'; import JoinFlowStep from '../../../src/components/join-flow/join-flow-step';
import RegistrationErrorStep from '../../../src/components/join-flow/registration-error-step'; import RegistrationErrorStep from '../../../src/components/join-flow/registration-error-step';
...@@ -21,6 +22,7 @@ describe('RegistrationErrorStep', () => { ...@@ -21,6 +22,7 @@ describe('RegistrationErrorStep', () => {
return wrapper return wrapper
.dive(); // unwrap injectIntl() .dive(); // unwrap injectIntl()
}; };
<<<<<<< HEAD
test('registrationError has JoinFlowStep', () => { test('registrationError has JoinFlowStep', () => {
const props = { const props = {
...@@ -67,6 +69,16 @@ describe('RegistrationErrorStep', () => { ...@@ -67,6 +69,16 @@ describe('RegistrationErrorStep', () => {
expect(errMsgElement).toHaveLength(0); expect(errMsgElement).toHaveLength(0);
}); });
=======
test('logs to analytics', () => {
const analyticsFn = jest.fn();
mountWithIntl(
<RegistrationErrorStep
sendAnalytics={analyticsFn}
/>);
expect(analyticsFn).toHaveBeenCalledWith('join-error');
});
>>>>>>> Set sendAnalytics to be required and send the right props to the error step. Also add a test for the error step.
test('when canTryAgain is true, show tryAgain message', () => { test('when canTryAgain is true, show tryAgain message', () => {
const props = { const props = {
canTryAgain: true, canTryAgain: true,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment