 {Testing, expect, sinon, _, ReactTestUtils} = require '../helpers/component-testing'
-
+ld = require 'lodash'
 Roster = require '../../../src/components/course-settings/roster'
 
 COURSE = require '../../../api/user/courses/1.json'

  beforeEach ->
    CourseActions.loaded(COURSE, COURSE_ID)
    RosterActions.loaded(ROSTER, COURSE_ID)
    sinon.stub(PeriodActions, 'delete').returns(null)
    sinon.stub(PeriodActions, 'restore').returns(null)
    @props =
      courseId: COURSE_ID

        done()

  it 'can archive periods', (done) ->
    Testing.renderComponent( Roster, props: @props, unmountAfter: 30 ).then ({dom}) ->
      Testing.actions.click(dom.querySelector('.control.archive-period'))
      expect(dom.querySelector('.nav-tabs .active').textContent).to.equal('1st')
      expect(dom.querySelector('.roster tbody td').textContent).to.equal('Rabbit')
      _.defer ->
        Testing.actions.click(document.querySelector('button.archive-section'))
        expect(PeriodActions.delete).to.have.been.called
        _.defer ->
          expect(dom.querySelector('.nav-tabs .active').textContent).to.equal('2nd')
          expect(dom.querySelector('.roster tbody td').textContent).to.equal('Molly')
          done()

  it 'can view and unarchive periods', (done) ->
    Testing.renderComponent( Roster, props: @props ).then ({dom}) ->
