Skip to content

Commit

Permalink
Change test set-up
Browse files Browse the repository at this point in the history
  • Loading branch information
pomber committed May 21, 2017
1 parent 15010f8 commit a174bf8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
14 changes: 6 additions & 8 deletions test/00.render-dom-elements.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
14 changes: 6 additions & 8 deletions test/01.render-jsx-dom-elements.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <div />;
Expand Down

0 comments on commit a174bf8

Please sign in to comment.