Skip to content

Commit

Permalink
Merge _remove and remove tests and remove _setEl tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Mar 10, 2014
1 parent b840669 commit 393a209
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions test/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
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;
view.setElement('<p><a><b>test</b></a></p>');
Expand Down Expand Up @@ -360,27 +354,19 @@
equal(counter, 2);
});

test("remove", 0, function() {
document.body.appendChild(view.el);

view.listenTo(view, 'all x', function() { ok(false); });

view.remove();

view.$el.trigger('x');
});

test('_remove', 2, function() {
test("remove", 2, function() {
var el = view.el;
document.body.appendChild(view.el);

view.delegate('click', function() { ok(false); });
view.listenTo(view, 'all x', function() { ok(false); });

view._remove();
view.remove();

strictEqual(view.el, el);
notEqual(view.el.parentNode, document.body);

view.$el.trigger('click');
view.trigger('x');
});

Expand Down

0 comments on commit 393a209

Please sign in to comment.