'use strict';

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _enzyme = require('enzyme');

var _Item = require('./Item.component');

var _Item2 = _interopRequireDefault(_Item);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var item = {
	label: 'toto',
	onChange: jest.fn()
};

describe('Item', function () {
	it('should trigger callback on item click', function () {
		// given
		var itemInstance = _react2.default.createElement(_Item2.default, { item: item });

		// when
		var wrapper = (0, _enzyme.mount)(itemInstance);
		var checkbox = wrapper.find('[type="checkbox"]');

		checkbox.at(0).simulate('change');

		// then
		expect(item.onChange).toBeCalled();
	});
});