mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 00:40:56 -05:00
Remove default licenses needed from request form
This commit is contained in:
parent
425115ad37
commit
08886460c2
2 changed files with 10 additions and 10 deletions
|
@ -7,7 +7,6 @@ contact = require 'core/contact'
|
|||
module.exports = class TeachersContactModal extends ModalView
|
||||
id: 'teachers-contact-modal'
|
||||
template: require 'templates/teachers/teachers-contact-modal'
|
||||
defaultLicenses: 15
|
||||
|
||||
events:
|
||||
'submit form': 'onSubmitForm'
|
||||
|
@ -17,7 +16,7 @@ module.exports = class TeachersContactModal extends ModalView
|
|||
formValues: {
|
||||
name: ''
|
||||
email: ''
|
||||
licensesNeeded: @defaultLicenses
|
||||
licensesNeeded: ''
|
||||
message: ''
|
||||
}
|
||||
formErrors: {}
|
||||
|
@ -39,7 +38,7 @@ module.exports = class TeachersContactModal extends ModalView
|
|||
Role: #{props.role or ''}
|
||||
Phone Number: #{props.phoneNumber or ''}
|
||||
"""
|
||||
@state.set('formValues', { name, email, licensesNeeded: @defaultLicenses, message })
|
||||
@state.set('formValues', { name, email, message })
|
||||
super()
|
||||
|
||||
onSubmitForm: (e) ->
|
||||
|
|
|
@ -10,7 +10,7 @@ describe 'TeachersContactModal', ->
|
|||
@modal.trialRequests.fakeRequests[0].respondWith({ status: 200, responseText: trialRequests.stringify() })
|
||||
@modal.supermodel.once('loaded-all', done)
|
||||
jasmine.demoModal(@modal)
|
||||
|
||||
|
||||
it 'shows an error when the name is empty and the form is submitted', ->
|
||||
@modal.$('input[name="name"]').val('')
|
||||
@modal.$('form').submit()
|
||||
|
@ -33,17 +33,18 @@ describe 'TeachersContactModal', ->
|
|||
|
||||
describe 'submit form', ->
|
||||
beforeEach ->
|
||||
@modal.$('input[name="licensesNeeded"]').val(777)
|
||||
@modal.$('form').submit()
|
||||
|
||||
|
||||
it 'disables inputs', ->
|
||||
for el in @modal.$('button, input, textarea')
|
||||
expect($(el).is(':disabled')).toBe(true)
|
||||
|
||||
|
||||
describe 'failed contact', ->
|
||||
beforeEach ->
|
||||
request = jasmine.Ajax.requests.mostRecent()
|
||||
request.respondWith({status: 500})
|
||||
|
||||
|
||||
it 'shows an error', ->
|
||||
expect(@modal.$('.alert-danger').length).toBe(1)
|
||||
|
||||
|
@ -51,10 +52,10 @@ describe 'TeachersContactModal', ->
|
|||
beforeEach ->
|
||||
request = jasmine.Ajax.requests.mostRecent()
|
||||
request.respondWith({status: 200, responseText: '{}'})
|
||||
|
||||
|
||||
it 'shows a success message', ->
|
||||
expect(@modal.$('.alert-success').length).toBe(1)
|
||||
|
||||
|
||||
it 'disables the submit button', ->
|
||||
expect(@modal.$('#submit-btn').is(':disabled')).toBe(true)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue