mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-11 00:02:19 -05:00
e2d08fa7cf
Partially fix ActivateLicensesModal.spec [IN PROGRESS] Don't display deleted users Move userID to classroom.deletedMembers on user delete (not retroactive) Fix PDF links for course guides, remove old PDFs from repo Remove deprecated SalesView Remove underline for not-yet-linked student names Only show class select when there's more than one Ignore case when sorting student names Use student.broadName instead of name for display and sorting Fix initial load not showing progress after joining a course (hacky) Fix text entry for enrollment number input Fix enrollment statistics Fix enrollment stats completely (and add back in per-class unenrolled count) Add deletedMembers to classroom schema More fixes to enrollment stats (don't count nonmember prepaids) Don't use 0 as implicit false for openSpots Update suggested number of credit to buy automatically Fix classroom edit form ignoring cleared values Add alert text when more users selected than enrollments available Alert user when trying to assign course to unenrolled students Alert user when assigning course to nobody Add some tests for TeacherClassView bulk assign alerts Fix TeacherClassView tests failing without demos Use model/collection.fakeRequests :D Remove unused comment Fix handling of improperly sorted deleted users on clientside Add test for moving deleted users to deletedMembers Add script for moving all deleted classroom members to classroom.deletedMembers Completely rewrite tallying up enrollment statistics Fix some tests to not be dependent on logged-in user Address PR comments Fix default number of enrollments to buy Fix i18n for not enough enrollments Use custom error message for classroom name length
115 lines
3.8 KiB
CoffeeScript
115 lines
3.8 KiB
CoffeeScript
ActivateLicensesModal = require 'views/courses/ActivateLicensesModal'
|
|
Users = require 'collections/Users'
|
|
forms = require 'core/forms'
|
|
|
|
# Needs some fixing
|
|
xdescribe 'ActivateLicensesModal', ->
|
|
|
|
@modal = null
|
|
|
|
me = require 'test/app/fixtures/teacher'
|
|
prepaids = require 'test/app/fixtures/prepaids'
|
|
classrooms = require 'test/app/fixtures/classrooms/unarchived-classrooms'
|
|
users = require 'test/app/fixtures/students'
|
|
responses = {
|
|
'/db/prepaid': prepaids.toJSON()
|
|
'/db/classroom': classrooms.toJSON()
|
|
# '/members': users.toJSON() # TODO: Respond with different ones for different classrooms
|
|
}
|
|
|
|
makeModal = (options) ->
|
|
(done) ->
|
|
@selectedUsers = new Users(@users.models.slice(0,(options?.numSelected or 3)))
|
|
@modal = new ActivateLicensesModal({
|
|
@classroom, @users, @selectedUsers
|
|
})
|
|
jasmine.Ajax.requests.sendResponses(responses)
|
|
_.filter(jasmine.Ajax.requests.all().slice(), (request) ->
|
|
/\/db\/classroom\/.*\/members/.test(request.url) and request.readyState < 4
|
|
).forEach (request) ->
|
|
request.respondWith(users.toJSON)
|
|
# debugger
|
|
|
|
jasmine.demoModal(@modal)
|
|
_.defer done
|
|
|
|
beforeEach ->
|
|
@classroom = classrooms.get('active-classroom')
|
|
@users = require 'test/app/fixtures/students'
|
|
|
|
afterEach ->
|
|
@modal.stopListening()
|
|
|
|
describe 'the class dropdown', ->
|
|
beforeEach makeModal()
|
|
|
|
# punted indefinitely
|
|
xit 'should contain an All Students option', ->
|
|
expect(@modal.$('select option:last-child').html()).toBe('All Students')
|
|
|
|
it 'should display the current classname', ->
|
|
expect(@modal.$('option:selected').html()).toBe('Teacher Zero\'s Classroomiest Classroom')
|
|
|
|
it 'should contain all of the teacher\'s classes'
|
|
|
|
it 'shouldn\'t contain anyone else\'s classrooms'
|
|
|
|
describe 'the checklist of students', ->
|
|
it 'should separate the unenrolled from the enrolled students'
|
|
|
|
it 'should have a checkmark by the selected students'
|
|
|
|
it 'should display all the students'
|
|
|
|
|
|
describe 'the credits availble count', ->
|
|
beforeEach makeModal()
|
|
it 'should match the number of unused prepaids', ->
|
|
expect(@modal.$('#total-available').html()).toBe('2')
|
|
|
|
describe 'the Enroll button', ->
|
|
beforeEach makeModal()
|
|
it 'should show the number of selected students', ->
|
|
expect(@modal.$('#total-selected-span').html()).toBe('3')
|
|
|
|
it 'should fire off one request when clicked'
|
|
|
|
describe 'when the teacher has enough enrollments', ->
|
|
beforeEach makeModal({ numSelected: 2 })
|
|
it 'should be enabled', ->
|
|
expect(@modal.$('#activate-licenses-btn').hasClass('disabled')).toBe(false)
|
|
|
|
describe 'when the teacher doesn\'t have enough enrollments', ->
|
|
it 'should be disabled', ->
|
|
expect(@modal.$('#activate-licenses-btn').hasClass('disabled')).toBe(true)
|
|
|
|
describe 'the Purchase More button', ->
|
|
it 'should redirect to the enrollment purchasing page'
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
# describe 'enroll button', ->
|
|
# beforeEach (done) ->
|
|
# makeModal.bind(this)(done)
|
|
#
|
|
# it 'should display the correct total number of credits', ->
|
|
# expect(@modal.$('#total-available').html()).toBe('2')
|
|
#
|
|
# it 'should be disabled when teacher doesn\'t have enough enrollments', ->
|
|
# expect(@modal.$('#total-available').html()).toBe('2')
|
|
#
|
|
#
|
|
#
|
|
# describe 'when enrolling only a single student', ->
|
|
# describe 'the list of students', ->
|
|
# it 'should only have the one student selected'
|
|
#
|
|
# describe 'when bulk-enrolling students', ->
|
|
# describe 'the list of students', ->
|
|
# it 'should have the right students selected'
|
|
#
|
|
# describe 'selecting more students', ->
|
|
# it 'should increase the student counter'
|