'use strict';

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _enzyme = require('enzyme');

var _Pagination = require('./Pagination.component');

var _Pagination2 = _interopRequireDefault(_Pagination);

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

var props = {
	id: 'pagination',
	startIndex: 11,
	totalResults: 25,
	itemsPerPage: 5,
	onChange: jest.fn()
};

describe('Pagination', function () {
	it('should navigate to first page', function () {
		// given
		var instance = (0, _enzyme.mount)(_react2.default.createElement(_Pagination2.default, props));
		// when
		instance.find('#pagination-nav-to-first').simulate('click');
		// then
		expect(props.onChange).toBeCalledWith(1, 5);
	});

	it('should navigate to previous page', function () {
		// given
		var instance = (0, _enzyme.mount)(_react2.default.createElement(_Pagination2.default, props));
		// when
		instance.find('#pagination-nav-to-prev').simulate('click');
		// then
		expect(props.onChange).toBeCalledWith(6, 5);
	});

	it('should navigate to next page', function () {
		// given
		var instance = (0, _enzyme.mount)(_react2.default.createElement(_Pagination2.default, props));
		// when
		instance.find('#pagination-nav-to-next').simulate('click');
		// then
		expect(props.onChange).toBeCalledWith(16, 5);
	});

	it('should navigate to last page', function () {
		// given
		var instance = (0, _enzyme.mount)(_react2.default.createElement(_Pagination2.default, props));
		// when
		instance.find('#pagination-nav-to-last').simulate('click');
		// then
		expect(props.onChange).toBeCalledWith(21, 5);
	});
});