'use strict';

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _enzyme = require('enzyme');

var _RowSelection = require('./RowSelection.component');

var _RowSelection2 = _interopRequireDefault(_RowSelection);

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

function RowRenderer(props) {
	return _react2.default.createElement('div', props);
}

var selectedRowData = { id: 0 };
var notSelectedRowData = { id: 1 };
function isSelected(rowData) {
	return rowData === selectedRowData;
}

describe('RowSelection', function () {
	it('should enhance classname with selection class on selected row', function () {
		// given
		function getRowData() {
			return selectedRowData;
		}
		var Row = new _RowSelection2.default(RowRenderer, { isSelected: isSelected, getRowData: getRowData });

		// when
		var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(Row, {
			className: 'my-class-names',
			index: 1,
			key: 18,
			parent: {},
			style: { background: 'red' }
		}));

		// then
		expect(wrapper.node).toMatchSnapshot();
	});

	it('should enhance classname without selection class on non selected row', function () {
		// given
		function getRowData() {
			return notSelectedRowData;
		}
		var Row = new _RowSelection2.default(RowRenderer, { isSelected: isSelected, getRowData: getRowData });

		// when
		var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(Row, {
			className: 'my-class-names',
			index: 1,
			key: 18,
			parent: {},
			style: { background: 'red' }
		}));

		// then
		expect(wrapper.node).toMatchSnapshot();
	});
});