mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-26 17:16:11 -05:00
Rename error function.
This commit is contained in:
parent
6a45907ded
commit
cdd90da423
4 changed files with 13 additions and 13 deletions
|
@ -56,7 +56,7 @@ class EmailStep extends React.Component {
|
|||
this.emailInput = emailInputRef;
|
||||
}
|
||||
onCaptchaError () {
|
||||
this.props.onMidRegistrationError(
|
||||
this.props.onRegistrationError(
|
||||
this.props.intl.formatMessage({
|
||||
id: 'registation.troubleReload'
|
||||
})
|
||||
|
@ -211,8 +211,8 @@ class EmailStep extends React.Component {
|
|||
|
||||
EmailStep.propTypes = {
|
||||
intl: intlShape,
|
||||
onMidRegistrationError: PropTypes.func,
|
||||
onNextStep: PropTypes.func,
|
||||
onRegistrationError: PropTypes.func,
|
||||
waiting: PropTypes.bool
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class JoinFlow extends React.Component {
|
|||
super(props);
|
||||
bindAll(this, [
|
||||
'handleAdvanceStep',
|
||||
'handleMidRegistrationError',
|
||||
'handleRegistrationError',
|
||||
'handlePrepareToRegister',
|
||||
'handleRegistrationResponse',
|
||||
'handleSubmitRegistration'
|
||||
|
@ -35,7 +35,7 @@ class JoinFlow extends React.Component {
|
|||
waiting: false
|
||||
};
|
||||
}
|
||||
handleMidRegistrationError (message) {
|
||||
handleRegistrationError (message) {
|
||||
if (!message) {
|
||||
message = this.props.intl.formatMessage({
|
||||
id: 'registration.generalError'
|
||||
|
@ -151,8 +151,8 @@ class JoinFlow extends React.Component {
|
|||
<GenderStep onNextStep={this.handleAdvanceStep} />
|
||||
<EmailStep
|
||||
waiting={this.state.waiting}
|
||||
onMidRegistrationError={this.handleMidRegistrationError}
|
||||
onNextStep={this.handlePrepareToRegister}
|
||||
onRegistrationError={this.handleRegistrationError}
|
||||
/>
|
||||
<WelcomeStep
|
||||
email={this.state.formData.email}
|
||||
|
|
|
@ -122,7 +122,7 @@ describe('EmailStep test', () => {
|
|||
|
||||
test('onCaptchaError calls error function with correct message', () => {
|
||||
const props = {
|
||||
onMidRegistrationError: jest.fn()
|
||||
onRegistrationError: jest.fn()
|
||||
};
|
||||
|
||||
const wrapper = shallowWithIntl(
|
||||
|
@ -132,12 +132,12 @@ describe('EmailStep test', () => {
|
|||
|
||||
const formikWrapper = wrapper.dive();
|
||||
formikWrapper.instance().onCaptchaError();
|
||||
expect(props.onMidRegistrationError).toHaveBeenCalledWith('registation.troubleReload');
|
||||
expect(props.onRegistrationError).toHaveBeenCalledWith('registation.troubleReload');
|
||||
});
|
||||
|
||||
test('Captcha load error calls error function', () => {
|
||||
const props = {
|
||||
onMidRegistrationError: jest.fn()
|
||||
onRegistrationError: jest.fn()
|
||||
};
|
||||
// Set this to null to force an error.
|
||||
global.grecaptcha = null;
|
||||
|
@ -148,7 +148,7 @@ describe('EmailStep test', () => {
|
|||
|
||||
const formikWrapper = wrapper.dive();
|
||||
formikWrapper.instance().onCaptchaLoad();
|
||||
expect(props.onMidRegistrationError).toHaveBeenCalledWith('registation.troubleReload');
|
||||
expect(props.onRegistrationError).toHaveBeenCalledWith('registation.troubleReload');
|
||||
});
|
||||
|
||||
test('validateEmail test email empty', () => {
|
||||
|
|
|
@ -126,17 +126,17 @@ describe('JoinFlow', () => {
|
|||
expect(joinFlowInstance.props.refreshSession).not.toHaveBeenCalled();
|
||||
expect(joinFlowInstance.state.registrationError).toBe('registration.generalError (400)');
|
||||
});
|
||||
test('handleMidRegistrationError with no message ', () => {
|
||||
test('handleRegistrationError with no message ', () => {
|
||||
const joinFlowInstance = getJoinFlowWrapper().instance();
|
||||
joinFlowInstance.setState({});
|
||||
joinFlowInstance.handleMidRegistrationError();
|
||||
joinFlowInstance.handleRegistrationError();
|
||||
expect(joinFlowInstance.state.registrationError).toBe('registration.generalError');
|
||||
});
|
||||
|
||||
test('handleMidRegistrationError with message ', () => {
|
||||
test('handleRegistrationError with message ', () => {
|
||||
const joinFlowInstance = getJoinFlowWrapper().instance();
|
||||
joinFlowInstance.setState({});
|
||||
joinFlowInstance.handleMidRegistrationError('my message');
|
||||
joinFlowInstance.handleRegistrationError('my message');
|
||||
expect(joinFlowInstance.state.registrationError).toBe('my message');
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue