'use strict';

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _reactTestRenderer = require('react-test-renderer');

var _reactTestRenderer2 = _interopRequireDefault(_reactTestRenderer);

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

var _Item2 = _interopRequireDefault(_Item);

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

var item = {
	values: ['toto'],
	itemProps: {
		key: 'values',
		onSubmitItem: jest.fn(), // provided click callback
		onAbortItem: jest.fn(), // provided click callback
		onSelectItem: jest.fn(), // provided click callback
		isSelected: false,
		actions: [{
			label: 'Edit',
			id: 'edit',
			onClick: jest.fn() // provided click callback
		}, {
			label: 'Delete',
			id: 'delete',
			onClick: jest.fn() // provided click callback
		}]
	}
};

var selectedItem = {
	values: ['toto'],
	isSelected: true,
	itemProps: {
		key: 'values',
		onSubmitItem: jest.fn(), // provided click callback
		onAbortItem: jest.fn(), // provided click callback
		onSelectItem: jest.fn(), // provided click callback
		isSelected: true,
		actions: []
	}
};

describe('Item', function () {
	it('should display value with three buttons', function () {
		// given
		var props = {
			id: '0-item',
			item: item
		};

		// when
		var wrapper = _reactTestRenderer2.default.create(_react2.default.createElement(_Item2.default, props)).toJSON();

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

	it('should display a selected item', function () {
		// given
		var props = {
			id: '0-item',
			item: selectedItem
		};

		// when
		var wrapper = _reactTestRenderer2.default.create(_react2.default.createElement(_Item2.default, props)).toJSON();

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