Created
November 4, 2016 14:35
-
-
Save thiagoa/5639e644b59cbe82b336a4e9ae6df84f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// spec/javascripts/support/createFixture.js | |
function createFixtureNode() { | |
const fixture = document.createElement('div'); | |
fixture.id = 'fixture'; | |
fixture.destroy = function destroy() { | |
this.parentNode.removeChild(fixture); | |
}; | |
return fixture; | |
} | |
export default function createFixture({ html }) { | |
const fixture = createFixtureNode(); | |
const body = document.querySelector('body'); | |
fixture.innerHTML = html; | |
body.insertBefore(fixture, body.firstChild); | |
return fixture; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment