Skip to content
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.

Commit

Permalink
Merge pull request #169 from gbedardsice/master
Browse files Browse the repository at this point in the history
Pass the right context to the currentEditor.remove
  • Loading branch information
wyuenho committed May 10, 2013
2 parents 7cc8084 + 6b60962 commit cbf37d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ var Cell = Backgrid.Cell = Backbone.View.extend({
*/
remove: function () {
if (this.currentEditor) {
this.currentEditor.remove.apply(this, arguments);
this.currentEditor.remove.apply(this.currentEditor, arguments);
delete this.currentEditor;
}
return Backbone.View.prototype.remove.apply(this, arguments);
Expand Down
13 changes: 13 additions & 0 deletions test/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,19 @@ describe("A Cell", function () {
expect(cell.$el.hasClass("editor")).toBe(true);
});

it("removes the editor correctly when removing the cell", function() {
cell.render();
cell.$el.click();

var editor = cell.currentEditor;

spyOn(editor, "remove");

cell.remove("argument1", "argument2");

expect(editor.remove).toHaveBeenCalledWith("argument1", "argument2");
});

describe("when the model value has changed", function () {
it("refreshes during display mode", function () {
cell.render();
Expand Down

0 comments on commit cbf37d6

Please sign in to comment.