Skip to content

Commit

Permalink
group iframe setup into function
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathew Allen committed Sep 29, 2016
1 parent 53c6667 commit 9c72ece
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/javascripts/turbolinks_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ describe 'Turbolinks', ->
<div id="turbo-area" refresh="turbo-area"></div>
"""

setupIframe = ->
iframe = document.createElement('iframe')
document.body.appendChild(iframe)
iframe.contentDocument.write(baseHTML)
iframe.contentDocument

startFromFixture = (route) ->
fixtureHTML = ROUTES[route][2]
testDocument.documentElement.innerHTML = fixtureHTML
Expand All @@ -76,11 +82,7 @@ describe 'Turbolinks', ->
Turbolinks.visit('/' + url, options)

beforeEach ->
unless iframe
iframe = document.createElement('iframe')
document.body.appendChild(iframe)
iframe.contentDocument.write(baseHTML)
testDocument = iframe.contentDocument
testDocument = setupIframe() unless iframe
sandbox = sinon.sandbox.create()
pushStateStub = sandbox.stub(Turbolinks, 'pushState')
replaceStateStub = sandbox.stub(Turbolinks, 'replaceState')
Expand Down

0 comments on commit 9c72ece

Please sign in to comment.