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 {
BirthDateStep.propTypes = {
intl: intlShape,
onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func
sendAnalytics: PropTypes.func.isRequired
};
const IntlBirthDateStep = injectIntl(BirthDateStep);
......
......@@ -122,7 +122,7 @@ class CountryStep extends React.Component {
CountryStep.propTypes = {
intl: intlShape,
onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func
sendAnalytics: PropTypes.func.isRequired
};
const IntlCountryStep = injectIntl(CountryStep);
......
......@@ -235,8 +235,12 @@ EmailStep.propTypes = {
<<<<<<< HEAD
=======
onRegistrationError: PropTypes.func,
<<<<<<< HEAD
sendAnalytics: PropTypes.func,
>>>>>>> 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
};
......
......@@ -184,7 +184,7 @@ class GenderStep extends React.Component {
GenderStep.propTypes = {
intl: intlShape,
onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func
sendAnalytics: PropTypes.func.isRequired
};
module.exports = injectIntl(GenderStep);
......@@ -233,7 +233,12 @@ class JoinFlow extends React.Component {
{this.state.registrationError ? (
<RegistrationErrorStep
canTryAgain={this.canTryAgain()}
<<<<<<< HEAD
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 */
onSubmit={this.handleErrorNext}
/* eslint-enable react/jsx-no-bind */
......
......@@ -63,12 +63,17 @@ RegistrationErrorStep.propTypes = {
canTryAgain: PropTypes.bool.isRequired,
errorMsg: PropTypes.string,
intl: intlShape,
<<<<<<< HEAD
onSubmit: PropTypes.func.isRequired,
sendAnalytics: PropTypes.func.isRequired
};
RegistrationErrorStep.defaultProps = {
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);
......
......@@ -289,7 +289,7 @@ class UsernameStep extends React.Component {
UsernameStep.propTypes = {
intl: intlShape,
onNextStep: PropTypes.func,
sendAnalytics: PropTypes.func
sendAnalytics: PropTypes.func.isRequired
};
const IntlUsernameStep = injectIntl(UsernameStep);
......
import React from 'react';
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 RegistrationErrorStep from '../../../src/components/join-flow/registration-error-step';
......@@ -21,6 +22,7 @@ describe('RegistrationErrorStep', () => {
return wrapper
.dive(); // unwrap injectIntl()
};
<<<<<<< HEAD
test('registrationError has JoinFlowStep', () => {
const props = {
......@@ -67,6 +69,16 @@ describe('RegistrationErrorStep', () => {
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', () => {
const props = {
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