/*
  backgrid
  http://github.com/wyuenho/backgrid

  Copyright (c) 2013 Jimmy Yuen Ho Wong
  Licensed under the MIT @license.
*/
describe("A Row", function () {

  it("throws TypeError if a model is not given", function () {
    expect(function () {
      new Backgrid.Row({
        columns: [{
          name: "name",
          cell: "string"
        }]
      });
    }).toThrow(new TypeError("'model' is required"));
  });

  it("throws TypeError if a list of column definitions is not given", function () {
    expect(function () {
      new Backgrid.Row({
        model: new Backbone.Model()
      });
    }).toThrow(new TypeError("'columns' is required"));
  });

  it("renders a row of cells using a model's values and a list of column definitions", function () {
    var row = new Backgrid.Row({
      model: new Backbone.Model({
        name: "name",
        age: 18
      }),
      columns: [{
        name: "name",
        cell: "string"
      }, {
        name: "age",
        cell: "integer"
      }]
    });

    row.render();

    expect(row.el.tagName).toBe("TR");

    var $tds = row.$el.children();
    expect($tds.eq(0).text()).toBe("name");
    expect($tds.eq(1).text()).toBe("18");
  });

  it("hides or shows a cell if a column's renderable attribute changes", function () {

    var row = new Backgrid.Row({
      model: new Backbone.Model({
        name: "name"
      }),
      columns: [{
        name: "name",
        cell: "string"
      }]
    });

    row.render();

    var $tds = row.$el.children();
    expect($tds.eq(0).text()).toBe("name");
    expect($tds.eq(0).css("display")).not.toBe("none");

    row.columns.at(0).set("renderable", false);
    $tds = row.$el.children();
    expect($tds.eq(0).text()).toBe("name");
    expect($tds.eq(0).css("display")).toBe("none");

    row.columns.at(0).set("renderable", true);
    $tds = row.$el.children();
    expect($tds.eq(0).text()).toBe("name");
    expect($tds.eq(0).css("display")).not.toBe("none");
  });

  it("inserts or removes a cell if a column is added or removed", function () {
    var row = new Backgrid.Row({
      model: new Backbone.Model({
        name: "name",
        age: 18,
        birthday: "1987-06-05"
      }),
      columns: [{
        name: "name",
        cell: "string"
      }]
    });

    row.render();

    row.columns.add({name: "age", cell: "integer"});
    var $tds = row.$el.children();
    expect($tds.length).toBe(2);
    expect($tds.eq(1).text()).toBe("18");

    row.columns.add({name: "birthday", cell: "date", renderable: false});
    $tds = row.$el.children();
    expect($tds.length).toBe(3);
    expect($tds.last().text()).toBe("1987-06-05");

    row.columns.remove(row.columns.first());
    $tds = row.$el.children();
    expect($tds.length).toBe(2);
    expect($tds.first().text()).toBe("18");
    expect($tds.last().text()).toBe("1987-06-05");
  });

});

@@ -261,32 +261,58 @@
  Backgrid.Row(%7B%0A
+        body: %22fakebody%22,%0A
         columns:
@@ -307,32 +307,32 @@
     columns: %5B%7B%0A
-
           name: 
@@ -442,24 +442,323 @@
 %22));%0A  %7D);%0A%0A
+  it(%22throws TypeError if a body is not given%22, function () %7B%0A    expect(function () %7B%0A      new Backgrid.Row(%7B%0A        columns: %5B%7B%0A          name: %22name%22,%0A          cell: %22string%22%0A        %7D%5D,%0A        model: new Backbone.Model()%0A      %7D);%0A    %7D).toThrow(new TypeError(%22'body' is required%22));%0A  %7D);%0A%0A
   it(%22throws
@@ -871,32 +871,58 @@
  Backgrid.Row(%7B%0A
+        body: %22fakebody%22,%0A
         model: n
@@ -1140,32 +1140,56 @@
  Backgrid.Row(%7B%0A
+      body: %22fakebody%22,%0A
       model: new
@@ -1691,32 +1691,56 @@
  Backgrid.Row(%7B%0A
+      body: %22fakebody%22,%0A
       model: new
@@ -2457,32 +2457,32 @@
 , function () %7B%0A
-
     var row = ne
@@ -2494,24 +2494,48 @@
 kgrid.Row(%7B%0A
+      body: %22fakebody%22,%0A
       model:

Add test for body requirement; Add in a fake body variable since we are not testing for any focus(tab/shift+tab) issues just yet