Prettier fixes

This commit is contained in:
Behind The Math
2019-03-03 01:37:45 -05:00
parent 3c1a4b2e18
commit c13149626b
32 changed files with 1318 additions and 903 deletions

View File

@@ -1,45 +1,60 @@
var tape = require("tape")
var tape = require("tape");
var forEachEls = require("../../lib/foreach-els.js")
var forEachEls = require("../../lib/foreach-els.js");
var div = document.createElement("div")
var span = document.createElement("span")
var div = document.createElement("div");
var span = document.createElement("span");
var cb = function(el) {
el.innerHTML = "boom"
}
el.innerHTML = "boom";
};
tape("test forEachEls on one element", function(t) {
div.innerHTML = "div tag"
forEachEls(div, cb)
t.equal(div.innerHTML, "boom", "works correctly on one element")
t.end()
})
div.innerHTML = "div tag";
forEachEls(div, cb);
t.equal(div.innerHTML, "boom", "works correctly on one element");
t.end();
});
tape("test forEachEls on an array", function(t) {
div.innerHTML = "div tag"
span.innerHTML = "span tag"
div.innerHTML = "div tag";
span.innerHTML = "span tag";
forEachEls([div, span], cb)
forEachEls([div, span], cb);
t.equal(div.innerHTML, "boom", "works correctly on the first element of the array")
t.equal(span.innerHTML, "boom", "works correctly on the last element of the array")
t.equal(
div.innerHTML,
"boom",
"works correctly on the first element of the array"
);
t.equal(
span.innerHTML,
"boom",
"works correctly on the last element of the array"
);
t.end()
})
t.end();
});
tape("test forEachEls on a NodeList", function(t) {
div.innerHTML = "div tag"
span.innerHTML = "span tag"
div.innerHTML = "div tag";
span.innerHTML = "span tag";
var frag = document.createDocumentFragment()
frag.appendChild(div)
frag.appendChild(span)
forEachEls(frag.childNodes, cb)
var frag = document.createDocumentFragment();
frag.appendChild(div);
frag.appendChild(span);
forEachEls(frag.childNodes, cb);
t.equal(div.innerHTML, "boom", "works correctly on the first element of the document fragment")
t.equal(span.innerHTML, "boom", "works correctly on the last element of the document fragment")
t.equal(
div.innerHTML,
"boom",
"works correctly on the first element of the document fragment"
);
t.equal(
span.innerHTML,
"boom",
"works correctly on the last element of the document fragment"
);
t.end()
})
t.end();
});