'use strict';

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _enzyme = require('enzyme');

var _Filter = require('./Filter.component');

var _Filter2 = _interopRequireDefault(_Filter);

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

jest.mock('react-dom');

describe('Filter', function () {
	var noOp = jest.fn();

	it('should render', function () {
		// when
		var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(_Filter2.default, { onFilter: noOp, onToggle: noOp }));

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

	it('should render id if provided', function () {
		// when
		var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(_Filter2.default, { id: 'toolbar-filter', onFilter: noOp, onToggle: noOp }));

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

	it('should render highlighted filter', function () {
		// when
		var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(_Filter2.default, { highlight: true, onFilter: noOp, onToggle: noOp }));

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

	it('should render only toggle icon', function () {
		// when
		var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(_Filter2.default, { onFilter: noOp, onToggle: noOp, docked: true }));

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

	it('should render filter input with given placeholder', function () {
		// when
		var defaultProps = {
			docked: false,
			placeholder: 'find something'
		};
		var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(_Filter2.default, defaultProps));

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

	it('should render filter input with default placeholder', function () {
		// when
		var defaultProps = {
			docked: false
		};
		var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(_Filter2.default, defaultProps));

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