test('when given callback for #show, invokes callback upon dialog close', function() {
  const callback = this.stub()
  const dialog = new SetDefaultGradeDialog({assignment: this.assignment})
  dialog.show(callback)
  $('button.ui-dialog-titlebar-close').click()
  equal(callback.callCount, 1)
})
test('#gradeIsExcused returns false if grade is not EX', function() {
  const dialog = new SetDefaultGradeDialog({assignment: this.assignment})
  dialog.show()
  deepEqual(dialog.gradeIsExcused('14'), false)
  deepEqual(dialog.gradeIsExcused('F'), false)
  // this test documents that we do not consider 'excused' to return true
  deepEqual(dialog.gradeIsExcused('excused'), false)
})
test('#gradeIsExcused returns true if grade is EX', function() {
  const dialog = new SetDefaultGradeDialog({assignment: this.assignment})
  dialog.show()
  deepEqual(dialog.gradeIsExcused('EX'), true)
  deepEqual(dialog.gradeIsExcused('ex'), true)
  deepEqual(dialog.gradeIsExcused('eX'), true)
  deepEqual(dialog.gradeIsExcused('Ex'), true)
})
test('#show changes text for grading percent', function() {
  this.assignment.grading_type = 'percent'
  const dialog = new SetDefaultGradeDialog({assignment: this.assignment})
  dialog.show()
  ok(document.getElementById('default_grade_description').innerText.includes('same percent grade'))
})
test('#show text', function() {
  const dialog = new SetDefaultGradeDialog({assignment: this.assignment})
  dialog.show()
  ok(document.getElementById('default_grade_description').innerText.includes('same grade'))
})