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:
parent
c5b26ca160
commit
0bcba63b63
|
@ -92,7 +92,7 @@ define [
|
||||||
|
|
||||||
@checkUnsavedOnLeave = true
|
@checkUnsavedOnLeave = true
|
||||||
view = this
|
view = this
|
||||||
window.addEventListener 'beforeunload', @onUnload
|
$(window).on 'beforeunload', @onUnload
|
||||||
|
|
||||||
unless @firstRender
|
unless @firstRender
|
||||||
@firstRender = true
|
@firstRender = true
|
||||||
|
|
|
@ -18,9 +18,7 @@ define [
|
||||||
@form = React.render(React.createFactory(FileRenameForm)(props), $('<div>').appendTo('#fixtures')[0])
|
@form = React.render(React.createFactory(FileRenameForm)(props), $('<div>').appendTo('#fixtures')[0])
|
||||||
|
|
||||||
teardown: ->
|
teardown: ->
|
||||||
#TODO: oddness with the current modal implementation makes teardown not work
|
React.unmountComponentAtNode(@form.getDOMNode().parentNode)
|
||||||
#as the DOM has been mutated. Hopefully we can ease this pain with a react modal
|
|
||||||
#React.unmountComponentAtNode(@form.getDOMNode().parentNode)
|
|
||||||
$("#fixtures").empty()
|
$("#fixtures").empty()
|
||||||
|
|
||||||
test 'switches to editing file name state with button click', ->
|
test 'switches to editing file name state with button click', ->
|
||||||
|
|
|
@ -15,6 +15,7 @@ define [
|
||||||
@scrollSidebarStub.restore()
|
@scrollSidebarStub.restore()
|
||||||
@initStub.restore()
|
@initStub.restore()
|
||||||
@attachWikiEditorStub.restore()
|
@attachWikiEditorStub.restore()
|
||||||
|
$(window).off('beforeunload')
|
||||||
|
|
||||||
test 'init wiki sidebar during render', ->
|
test 'init wiki sidebar during render', ->
|
||||||
wikiPageEditView = new WikiPageEditView
|
wikiPageEditView = new WikiPageEditView
|
||||||
|
@ -142,7 +143,6 @@ define [
|
||||||
ok errors['title'], 'error when title is present, but blank'
|
ok errors['title'], 'error when title is present, but blank'
|
||||||
ok errors['title'][0].message, 'error message when title is present, but blank'
|
ok errors['title'][0].message, 'error message when title is present, but blank'
|
||||||
|
|
||||||
|
|
||||||
module 'WikiPageEditView:JSON'
|
module 'WikiPageEditView:JSON'
|
||||||
|
|
||||||
testRights = (subject, options) ->
|
testRights = (subject, options) ->
|
||||||
|
|
Loading…
Reference in New Issue