var $table;

describe("Table", function() {

  beforeEach(function() {
    loadFixtures("form.html");
    $table = $("#edit-panel");
    $table.edittr();
  });

	it("should exist in the fixture", function() {
		expect($table).toHaveId("edit-panel");
	});
	
	it("should have an 'edittr' class", function() {
		expect($table).toHaveClass("edittr");
	});
  
	it("should have an 'editing' class when in editing mode", function() {
    $('a.edit').click();
		expect($table).toHaveClass("editing");
	});
		
	it("should have text content that is converted to an input", function() {
    expect($("td.name")).toHaveText("Stephen");
    $('a.edit').click();
    expect($("td.name input").val()).toBe("Stephen");
	});

  it("should show the Save and Cancel buttons only when in editing mode", function() {
    expect($("a.edit")).toBeVisible();
    $('a.edit').click();
    expect($("a.edit")).toBeHidden();
    expect($("a.cancel")).toBeVisible();
    expect($("a.save")).toBeVisible();
  });

});

describe("Options", function() {

	describe("I18n", function() {
	
    beforeEach(function() {
      loadFixtures("form.html");
      $table = $("#edit-panel");
      $table.edittr({cancelText:"Fuggedit",editText:"Edito",saveText:"Le save"});
    });

		it("should custom values for cancelText, editText and saveText", function() {
		});
		
	});

	describe("Callbacks", function() {

		it("should execute the callback code", function() {
			var testVar = "foo"
			$table.edittr({
				onEdit: function() {
					testVar = "bar"
				}
			});
			expect(testVar).toEqual("bar");
		});
		
	});

});

@@ -1319,62 +1319,315 @@
 ) %7B%0A
-%09%09%7D);%0A%09%09%0A%09%7D);%0A%0A%09describe(%22Callbacks%22, function() %7B%0A%0A%09%09
+      expect($(%22a.cancel%22)).toHaveText(%22Fuggedit%22);%0A      expect($(%22a.edit%22)).toHaveText(%22Edito%22);%0A      expect($(%22a.save%22)).toHaveText(%22Le save%22);%0A%09%09%7D);%0A%09%09%0A%09%7D);%0A%0A%09describe(%22Callbacks%22, function() %7B%0A%0A    beforeEach(function() %7B%0A      loadFixtures(%22form.html%22);%0A      $table = $(%22#edit-panel%22);%0A    %7D);%0A%0A    
 it(%22
@@ -1649,16 +1649,23 @@
 the 
+onEdit 
 callback
  cod
@@ -1664,13 +1664,8 @@
 back
- code
 %22, f
@@ -1676,19 +1676,22 @@
 ion() %7B%0A
-%09%09%09
+      
 var test
@@ -1701,16 +1701,23 @@
  = %22
-foo%22%0A%09%09%09
+before%22;%0A      
 $tab
@@ -1728,20 +1728,24 @@
 dittr(%7B%0A
-%09%09%09%09
+        
 onEdit: 
@@ -1761,39 +1761,655 @@
 ) %7B%0A
-%09%09%09%09%09testVar = %22bar%22%0A%09%09%09%09%7D%0A%09%09%09%7D
+          testVar = %22after%22;%0A        %7D%0A      %7D);%0A      $('a.edit').click();%0A%09%09%09expect(testVar).toEqual(%22after%22);%0A%09%09%7D);%0A%0A%09%09it(%22should execute the onSave callback%22, function() %7B%0A      var testVar = %22before%22;%0A      $table.edittr(%7B%0A        onSave: function() %7B%0A          testVar = %22after%22;%0A        %7D%0A      %7D);%0A      $('a.edit').click();%0A      $('a.save').click();%0A%09%09%09expect(testVar).toEqual(%22after%22);%0A%09%09%7D);%0A%0A%09%09it(%22should execute the onCancel callback%22, function() %7B%0A      var testVar = %22before%22;%0A      $table.edittr(%7B%0A        onCancel: function() %7B%0A          testVar = %22after%22;%0A        %7D%0A      %7D);%0A      $('a.edit').click();%0A      $('a.cancel').click(
 );%0A%09
@@ -2435,18 +2435,20 @@
 oEqual(%22
-b
 a
+fte
 r%22);%0A%09%09%7D
@@ -2446,25 +2446,23 @@
 er%22);%0A%09%09%7D);%0A
-%09%09
 %0A%09%7D);%0A%0A%7D);%0A

Add callback tests