diff --git a/app/templates/core/create-account-modal.jade b/app/templates/core/create-account-modal.jade index 17d297e71..5ec210f1f 100644 --- a/app/templates/core/create-account-modal.jade +++ b/app/templates/core/create-account-modal.jade @@ -7,8 +7,11 @@ span.glyphicon.glyphicon-remove .auth-form-content + if view.options.showRequiredError + #required-error-alert.alert.alert-success + span(data-i18n="signup.required") if view.options.showSignupRationale - .alert.alert-info + #signup-rationale-alert.alert.alert-info span(data-i18n="play_level.victory_sign_up_poke") #email-password-row.row diff --git a/test/app/views/core/CreateAccountModal.spec.coffee b/test/app/views/core/CreateAccountModal.spec.coffee index 8633f1acf..3a03d18be 100644 --- a/test/app/views/core/CreateAccountModal.spec.coffee +++ b/test/app/views/core/CreateAccountModal.spec.coffee @@ -5,8 +5,8 @@ describe 'CreateAccountModal', -> modal = null - beforeEach -> - modal = new CreateAccountModal() + initModal = (options) -> + modal = new CreateAccountModal(options) modal.render() modal.render = _.noop jasmine.demoModal(modal) @@ -16,12 +16,25 @@ describe 'CreateAccountModal', -> window.FB = login: _.noop api: _.noop - + afterEach -> modal.stopListening() + + describe 'constructed with showRequiredError is true', -> + it 'shows a modal explaining to login first', -> + initModal({showRequiredError: true}) + expect(modal.$('#required-error-alert').length).toBe(1) + + describe 'constructed with showSignupRationale is true', -> + it 'shows a modal explaining signup rationale', -> + initModal({showSignupRationale: true}) + expect(modal.$('#signup-rationale-alert').length).toBe(1) describe 'clicking the save button', -> - + + beforeEach -> + initModal() + it 'fails if nothing is in the form, showing errors for email and password', -> modal.$('form').each (i, el) -> el.reset() modal.$('form:first').submit() @@ -82,8 +95,9 @@ describe 'CreateAccountModal', -> describe 'clicking the gplus button', -> signupButton = null - + beforeEach -> + initModal() application.gplusHandler.trigger 'render-login-buttons' signupButton = modal.$('#gplus-signup-btn') expect(signupButton.attr('disabled')).toBeFalsy() @@ -152,6 +166,7 @@ describe 'CreateAccountModal', -> signupButton = null beforeEach -> + initModal() Backbone.Mediator.publish 'auth:facebook-api-loaded', {} signupButton = modal.$('#facebook-signup-btn') expect(signupButton.attr('disabled')).toBeFalsy()