       expect(dueAt).to.not.be.ok
 
   it 'can clear due at when there is no common due at', ->
-    firstPeriod = COURSES[0].periods[0].id
-    secondPeriod = COURSES[0].periods[1].id
+    firstPeriod = COURSES[0].periods[0]
+    secondPeriod = COURSES[0].periods[1]
 
     helper(NEW_READING).then ({dom, element}) ->
       #set individual periods

      dueAt = TaskPlanStore.getDueAt(NEW_READING.id)
      expect(getDateString(dueAt)).to.be.equal(getDateString(tomorrow))

  it 'can update open date for individual period', ->
    periodId = COURSES[0].periods[0].id
    helper(NEW_READING).then ({dom, element}) ->
      element.setOpensAt(new Date(dayAfter))
      opensAt = TaskPlanStore.getOpensAt(NEW_READING.id)
      expect(getDateString(opensAt)).to.not.be.ok
      opensAt = TaskPlanStore.getOpensAt(NEW_READING.id, periodId)
      expect(getDateString(opensAt)).to.be.equal(getDateString(dayAfter))

  it 'can update due date for individual period', ->
    periodId = COURSES[0].periods[0].id
    helper(NEW_READING).then ({dom, element}) ->
      element.setDueAt(new Date(tomorrow))
      dueAt = TaskPlanStore.getDueAt(NEW_READING.id)
      expect(getDateString(dueAt)).to.not.be.ok
      dueAt = TaskPlanStore.getDueAt(NEW_READING.id, periodId)
      expect(getDateString(dueAt)).to.be.equal(getDateString(tomorrow))

  it 'sets the correct moment timezone on mount', ->


helper = (model, routerQuery) -> PlanRenderHelper(model, Builder, {}, {}, routerQuery)

fakePeriodDisable = (element, disabledPeriod) ->
  fakeEvent =
    target:
      checked: false

  element.togglePeriodEnabled(disabledPeriod, fakeEvent)

fakePeriodEnable = (element, enabledPeriod) ->
  fakeEvent =
    target:
      checked: true

  element.togglePeriodEnabled(enabledPeriod, fakeEvent)

describe 'Task Plan Builder', ->
  beforeEach ->
