@elastic/eui
Version:
Elastic UI Component Library
52 lines (49 loc) • 3.1 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _react = _interopRequireWildcard(require("react"));
var _pagination = require("./pagination");
var _react2 = require("@emotion/react");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
/// <reference types="cypress" />
/// <reference types="cypress-real-events" />
/// <reference types="../../../cypress/support" />
var Pagination = function Pagination() {
var _useState = (0, _react.useState)(0),
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
activePage = _useState2[0],
setActivePage = _useState2[1];
return (0, _react2.jsx)(_pagination.EuiPagination, {
"aria-label": "Many pages example",
pageCount: 22,
activePage: activePage,
onPageClick: function onPageClick(activePage) {
return setActivePage(activePage);
}
});
};
describe('EuiPagination', function () {
describe('Automated accessibility check', function () {
it('has zero violations on first mobile render', function () {
cy.viewport(375, 667); // small breakpoint
cy.mount((0, _react2.jsx)(Pagination, null));
cy.get('nav.euiPagination').should('exist');
cy.checkAxe();
});
it('has zero violations when rendered using non-mobile breakpoint', function () {
cy.viewport(1280, 800); //macbook-13
cy.mount((0, _react2.jsx)(Pagination, null));
cy.get('nav.euiPagination').should('exist');
cy.checkAxe();
});
});
});