'use strict';

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _enzyme = require('enzyme');

var _reactBootstrap = require('react-bootstrap');

var _HeaderSelected = require('./HeaderSelected.component');

var _HeaderSelected2 = _interopRequireDefault(_HeaderSelected);

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

describe('Header selected', function () {
	it('should trigger callback when clicking on header action', function () {
		// given
		var props = {
			headerSelected: [{
				disabled: false,
				label: 'Delete',
				icon: 'talend-check',
				id: 'delete',
				onClick: jest.fn() // provided click callback
			}],
			nbItemsSelected: 2
		};
		var headerInputInstance = _react2.default.createElement(_HeaderSelected2.default, props);

		// when
		var wrapper = (0, _enzyme.mount)(headerInputInstance);
		var buttons = wrapper.find(_reactBootstrap.Button);

		buttons.at(0).simulate('click', { stopPropagation: function stopPropagation() {} });

		// then
		expect(props.headerSelected[0].onClick).toBeCalled();
	});
});