remove the sticky el from the test DOM after each test

This commit is contained in:
Phil Hughes 2017-09-25 11:55:33 +01:00
parent f389f9081f
commit 1544bc3228
No known key found for this signature in database
GPG Key ID: 32245528C52E0F9F
1 changed files with 6 additions and 2 deletions

View File

@ -4,15 +4,19 @@ describe('sticky', () => {
let el;
beforeEach(() => {
document.body.innerHTML = `
document.body.innerHTML += `
<div class="parent">
<div id="js-sticky" style="position: relative;"></div>
<div id="js-sticky"></div>
</div>
`;
el = document.getElementById('js-sticky');
});
afterEach(() => {
el.parentNode.remove();
});
describe('when stuck', () => {
it('does not remove is-stuck class', () => {
isSticky(el, 0, el.offsetTop);