mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-25 05:54:51 -05:00
Add showRequiredError and showSignupRationale alerts and tests to CreateAccountModal
This commit is contained in:
parent
a59e96f277
commit
84cdf1e2ce
2 changed files with 24 additions and 6 deletions
|
@ -7,8 +7,11 @@
|
||||||
span.glyphicon.glyphicon-remove
|
span.glyphicon.glyphicon-remove
|
||||||
|
|
||||||
.auth-form-content
|
.auth-form-content
|
||||||
|
if view.options.showRequiredError
|
||||||
|
#required-error-alert.alert.alert-success
|
||||||
|
span(data-i18n="signup.required")
|
||||||
if view.options.showSignupRationale
|
if view.options.showSignupRationale
|
||||||
.alert.alert-info
|
#signup-rationale-alert.alert.alert-info
|
||||||
span(data-i18n="play_level.victory_sign_up_poke")
|
span(data-i18n="play_level.victory_sign_up_poke")
|
||||||
|
|
||||||
#email-password-row.row
|
#email-password-row.row
|
||||||
|
|
|
@ -5,8 +5,8 @@ describe 'CreateAccountModal', ->
|
||||||
|
|
||||||
modal = null
|
modal = null
|
||||||
|
|
||||||
beforeEach ->
|
initModal = (options) ->
|
||||||
modal = new CreateAccountModal()
|
modal = new CreateAccountModal(options)
|
||||||
modal.render()
|
modal.render()
|
||||||
modal.render = _.noop
|
modal.render = _.noop
|
||||||
jasmine.demoModal(modal)
|
jasmine.demoModal(modal)
|
||||||
|
@ -20,8 +20,21 @@ describe 'CreateAccountModal', ->
|
||||||
afterEach ->
|
afterEach ->
|
||||||
modal.stopListening()
|
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', ->
|
describe 'clicking the save button', ->
|
||||||
|
|
||||||
|
beforeEach ->
|
||||||
|
initModal()
|
||||||
|
|
||||||
it 'fails if nothing is in the form, showing errors for email and password', ->
|
it 'fails if nothing is in the form, showing errors for email and password', ->
|
||||||
modal.$('form').each (i, el) -> el.reset()
|
modal.$('form').each (i, el) -> el.reset()
|
||||||
modal.$('form:first').submit()
|
modal.$('form:first').submit()
|
||||||
|
@ -84,6 +97,7 @@ describe 'CreateAccountModal', ->
|
||||||
signupButton = null
|
signupButton = null
|
||||||
|
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
initModal()
|
||||||
application.gplusHandler.trigger 'render-login-buttons'
|
application.gplusHandler.trigger 'render-login-buttons'
|
||||||
signupButton = modal.$('#gplus-signup-btn')
|
signupButton = modal.$('#gplus-signup-btn')
|
||||||
expect(signupButton.attr('disabled')).toBeFalsy()
|
expect(signupButton.attr('disabled')).toBeFalsy()
|
||||||
|
@ -152,6 +166,7 @@ describe 'CreateAccountModal', ->
|
||||||
signupButton = null
|
signupButton = null
|
||||||
|
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
initModal()
|
||||||
Backbone.Mediator.publish 'auth:facebook-api-loaded', {}
|
Backbone.Mediator.publish 'auth:facebook-api-loaded', {}
|
||||||
signupButton = modal.$('#facebook-signup-btn')
|
signupButton = modal.$('#facebook-signup-btn')
|
||||||
expect(signupButton.attr('disabled')).toBeFalsy()
|
expect(signupButton.attr('disabled')).toBeFalsy()
|
||||||
|
|
Loading…
Reference in a new issue