'use strict';

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _reactTestRenderer2 = _interopRequireDefault(_reactTestRenderer);

var _Header = require('./Header.component');

var _Header2 = _interopRequireDefault(_Header);

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

describe('Header', function () {
	it('should render header with one dropdown and two items', function () {
		// given
		var props = {
			headerDefault: [{
				displayMode: 'dropdown',
				label: 'Add item',
				icon: 'talend-plus',
				id: 'add',
				onClick: jest.fn(), // provided click callback
				items: [{
					label: 'Add values from a file',
					id: 'append-uploding',
					onClick: jest.fn()
				}, {
					label: 'Overwrite existing values',
					id: 'append-uploding',
					onClick: jest.fn()
				}]
			}]
		};

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

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

	it('should render header with one button', function () {
		// given
		var props = {
			headerDefault: [{
				label: 'Add item',
				icon: 'talend-plus',
				id: 'add',
				onClick: jest.fn() // provided click callback
			}]
		};

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

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

	it('should render header with one button and indicate the component is required', function () {
		// given
		var props = {
			required: true,
			headerDefault: [{
				label: 'Add item',
				icon: 'talend-plus',
				id: 'add',
				onClick: jest.fn() // provided click callback
			}]
		};

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

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