From a174bf8b7296ebce9f5cc468f990ba7a037c57ef Mon Sep 17 00:00:00 2001 From: pomber Date: Sun, 21 May 2017 18:58:41 -0300 Subject: [PATCH] Change test set-up --- test/00.render-dom-elements.test.js | 14 ++++++-------- test/01.render-jsx-dom-elements.test.js | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/test/00.render-dom-elements.test.js b/test/00.render-dom-elements.test.js index 3379320..055aed4 100644 --- a/test/00.render-dom-elements.test.js +++ b/test/00.render-dom-elements.test.js @@ -6,17 +6,15 @@ import { render } from "../src/didact"; browserEnv(["document"]); test.beforeEach(t => { - const root = document.createElement("div"); - document.body.appendChild(root); + let root = document.getElementById("root"); + if (!root) { + root = document.createElement("div"); + root.id = "root"; + document.body.appendChild(root); + } t.context.root = root; }); -test.afterEach.always(t => { - const root = t.context.root; - root.innerHTML = ""; - document.body.removeChild(root); -}); - test("render div", t => { const root = t.context.root; const element = { diff --git a/test/01.render-jsx-dom-elements.test.js b/test/01.render-jsx-dom-elements.test.js index bde18eb..5a01c02 100644 --- a/test/01.render-jsx-dom-elements.test.js +++ b/test/01.render-jsx-dom-elements.test.js @@ -7,17 +7,15 @@ import { render, createElement } from "../src/didact"; browserEnv(["document"]); test.beforeEach(t => { - const root = document.createElement("div"); - document.body.appendChild(root); + let root = document.getElementById("root"); + if (!root) { + root = document.createElement("div"); + root.id = "root"; + document.body.appendChild(root); + } t.context.root = root; }); -test.afterEach.always(t => { - const root = t.context.root; - root.innerHTML = ""; - document.body.removeChild(root); -}); - test("render jsx div", t => { const root = t.context.root; const element =
;