Skip to content

Commit

Permalink
test setEl and el.parentNode
Browse files Browse the repository at this point in the history
  • Loading branch information
akre54 committed Mar 6, 2014
1 parent 9eff496 commit bef78ef
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
ok(result.length === +result.length);
});

test("_setEl", 2, function() {
view._setEl('<div>', {id: 'test-div'});
strictEqual(view.el.tagName.toLowerCase(), 'div');
strictEqual(view.el.id, 'test-div');
});

test("jQuery", function() {
var view = new Backbone.View;
Expand All @@ -37,6 +42,8 @@
if (Backbone.$) {
ok(view.$el instanceof Backbone.$);
equal(view.$el[0], view.el);
} else {
ok(view.el.nodeType === 1);
}
});

Expand Down Expand Up @@ -370,7 +377,7 @@
document.body.appendChild(view.el);
view._removeElement();
strictEqual(view.el, el);
ok(!document.body.contains(view.el));
strictEqual(view.el.parentNode, null);
});

})();

0 comments on commit bef78ef

Please sign in to comment.