Skip to content

Commit

Permalink
NodeList#html: Added test to show failing case[#17]
Browse files Browse the repository at this point in the history
  • Loading branch information
jakearchibald committed Aug 3, 2009
1 parent 68e7b03 commit 884c694
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/glow/dom/dom.js
Expand Up @@ -1077,7 +1077,7 @@ t.test("glow.dom.NodeList.clone()", function () {
});

t.test("glow.dom.NodeList.html()", function () {
t.expect(2);
t.expect(4);

var nodes = glow.dom.create("<div><span>first</span></div><div>second</div>");

Expand All @@ -1087,6 +1087,17 @@ t.test("glow.dom.NodeList.html()", function () {

t.equals(nodes.html().toLowerCase(), "<div>first</div>", "html sets inner html for first node");

var emptyNodeList = new glow.dom.NodeList();
// this shouldn't error
emptyNodeList.html("<div></div>");
t.equals(emptyNodeList.length, 0, "No error on empty nodelist");

// http://glow-project.lighthouseapp.com/projects/33663/tickets/17-empty-nodelists-html-method-causes-error-if-passed-undefined
emptyNodeList = new glow.dom.NodeList();
// this shouldn't error
emptyNodeList.html(undefined);
t.equals(emptyNodeList.length, 0, "No error on empty nodelist with undefined param");

});

t.test("glow.dom.NodeList#append()", function () {
Expand Down

0 comments on commit 884c694

Please sign in to comment.