'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _enzyme = require('enzyme');

var _RowLarge = require('./RowLarge.component');

var _RowLarge2 = _interopRequireDefault(_RowLarge);

var _VirtualizedList = require('../VirtualizedList.component');

var _VirtualizedList2 = _interopRequireDefault(_VirtualizedList);

var _CellTitle = require('../CellTitle');

var _CellTitle2 = _interopRequireDefault(_CellTitle);

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

var titleProps = {
	actionsKey: 'titleActions',
	displayModeKey: 'display',
	iconKey: 'icon'
};

var titleActions = [{
	label: 'edit',
	icon: 'talend-pencil',
	onClick: jest.fn()
}, {
	label: 'delete',
	icon: 'talend-trash',
	onClick: jest.fn()
}];

var collection = [{
	id: 0,
	name: 'Title from first item',
	description: 'This comes from first element in collection',
	titleActions: titleActions
}, {
	id: 1,
	name: 'Title from second item',
	description: 'This comes from second element in collection',
	titleActions: titleActions
}];

var parent = {
	props: {
		id: 'my-list',
		collection: collection,
		children: [_react2.default.createElement(_VirtualizedList2.default.Content, {
			label: 'Id',
			dataKey: 'id',
			width: 50,
			flexShrink: 0,
			flexGrow: 0
		}), _react2.default.createElement(_VirtualizedList2.default.Content, _extends({
			label: 'Name',
			dataKey: 'name',
			width: 350,
			flexShrink: 0,
			flexGrow: 0,
			columnData: titleProps
		}, _CellTitle2.default)), _react2.default.createElement(_VirtualizedList2.default.Content, {
			label: 'Description',
			dataKey: 'name',
			width: 350,
			flexShrink: 0,
			flexGrow: 0
		})]
	}
};

describe('RowLarge', function () {
	it('should render large row', function () {
		// when
		var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(_RowLarge2.default, {
			className: 'my-class-names',
			index: 1,
			key: 18,
			parent: parent,
			style: { background: 'red' }
		}));

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