spec: clean up some state between tests

specifically, make file rename form go away, and actually
get rid of the wiki page onunload event handler

Change-Id: Ie323ce89e55495d2cd4e1caa4c7b17e72f2fd5fc
Reviewed-on: https://gerrit.instructure.com/54859
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Jenkins
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
This commit is contained in:
Jeremy Stanley 2015-05-21 10:14:59 -06:00
parent c5b26ca160
commit 0bcba63b63
3 changed files with 3 additions and 5 deletions

View File

@ -92,7 +92,7 @@ define [
@checkUnsavedOnLeave = true
view = this
window.addEventListener 'beforeunload', @onUnload
$(window).on 'beforeunload', @onUnload
unless @firstRender
@firstRender = true

View File

@ -18,9 +18,7 @@ define [
@form = React.render(React.createFactory(FileRenameForm)(props), $('<div>').appendTo('#fixtures')[0])
teardown: ->
#TODO: oddness with the current modal implementation makes teardown not work
#as the DOM has been mutated. Hopefully we can ease this pain with a react modal
#React.unmountComponentAtNode(@form.getDOMNode().parentNode)
React.unmountComponentAtNode(@form.getDOMNode().parentNode)
$("#fixtures").empty()
test 'switches to editing file name state with button click', ->

View File

@ -15,6 +15,7 @@ define [
@scrollSidebarStub.restore()
@initStub.restore()
@attachWikiEditorStub.restore()
$(window).off('beforeunload')
test 'init wiki sidebar during render', ->
wikiPageEditView = new WikiPageEditView
@ -142,7 +143,6 @@ define [
ok errors['title'], 'error when title is present, but blank'
ok errors['title'][0].message, 'error message when title is present, but blank'
module 'WikiPageEditView:JSON'
testRights = (subject, options) ->