form_controller_confirm_delete.js 698 B

123456789101112131415161718192021222324
  1. QUnit.test('App.ControllerConfirmDelete closes with correct safe word', assert => {
  2. let done = assert.async(1)
  3. let confirm_modal = new App.ControllerConfirmDelete({
  4. callback: (modal) => {
  5. assert.ok(true)
  6. modal.close()
  7. done()
  8. }
  9. })
  10. confirm_modal.el.find('[name=sure]').val('DELETE')
  11. confirm_modal.el.find('.js-submit').click()
  12. });
  13. QUnit.test('App.ControllerConfirmDelete does not proceed without a correct safe word', assert => {
  14. let confirm_modal = new App.ControllerConfirmDelete()
  15. confirm_modal.el.find('[name=sure]').val('NNN')
  16. confirm_modal.el.find('.js-submit').click()
  17. assert.ok(confirm_modal.el.find('.has-error'))
  18. confirm_modal.close()
  19. });