'use strict';

var React          = require('react');
var TestUtils      = require('react/lib/ReactTestUtils');
var CheckboxEditor = require('../CheckboxEditor');

describe('CheckboxEditor', () => {
 var component;
 var testColumn = {
   onRowSelect : function(){}
 };

 describe('Basic tests', () => {
   beforeEach(() => {
     spyOn(testColumn, 'onRowSelect');
     component = TestUtils.renderIntoDocument(<CheckboxEditor
       value={true}
       rowIdx={1}
       column={testColumn}/>);
     });

     it('should create a new CheckboxEditor instance', () => {
       expect(component).toBeDefined();
     });

     it('should be selected if value prop is true', () => {
       var Input = TestUtils.findRenderedDOMComponentWithTag(component, 'input');
       expect(Input.props.checked).toBe(true);
     });

     it('should call onRowSelect with correct RowIdx when checkbox is clicked', () => {
       var Input = TestUtils.findRenderedDOMComponentWithTag(component, 'input');
       TestUtils.Simulate.click(Input.getDOMNode());
       expect(testColumn.onRowSelect).toHaveBeenCalled();
       var fakeEvent = {stopPropagation : function(){}};
       expect(testColumn.onRowSelect.mostRecentCall.args[0]).toEqual(1, fakeEvent);
     });
 });

 describe('Unchecked tests', () => {
   beforeEach(() => {
     component = TestUtils.renderIntoDocument(<CheckboxEditor
       value={false}
       rowIdx={1}
       column={testColumn}/>);
     });

   it('should not be selected if value prop is false', () => {
     var Input = TestUtils.findRenderedDOMComponentWithTag(component, 'input');
     expect(Input.props.checked).toBe(false);
   });
 });

});

@@ -1245,278 +1245,119 @@
 %7D);%0A
- %7D);%0A%0A describe('Unchecked tests', () =%3E %7B%0A   beforeEach(() =%3E %7B%0A     component = TestUtils.renderIntoDocument(%3CCheckboxEditor%0A       value=%7Bfalse%7D%0A       rowIdx=%7B1%7D%0A       column=%7BtestColumn%7D/%3E);%0A     %7D);%0A%0A   it('should not be selected if value prop is false', () =%3E %7B%0A
+%0A     it('should not be selected if value prop is false', () =%3E %7B%0A       component.setProps(%7Bvalue: false%7D);%0A  
     
@@ -1433,24 +1433,26 @@
 put');%0A     
+  
 expect(Input
@@ -1483,16 +1483,18 @@
 se);%0A   
+  
 %7D);%0A %7D);
@@ -1495,12 +1495,14 @@
 ;%0A %7D);%0A%0A
+%0A%0A
 %7D);%0A

use setProps instead of a new component