@pingux/astro 2.17.0-alpha.6 → 2.17.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +7 -2
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumbAxe.test.js +7 -0
- package/lib/cjs/utils/testUtils/testAxe.js +4 -3
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +3 -4
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumbAxe.test.js +4 -0
- package/lib/utils/testUtils/testAxe.js +4 -3
- package/package.json +1 -1
@@ -17,6 +17,10 @@ var _Promise = require("@babel/runtime-corejs3/core-js-stable/promise");
|
|
17
17
|
var _reverseInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reverse");
|
18
18
|
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
19
19
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
20
|
+
_Object$defineProperty(exports, "__esModule", {
|
21
|
+
value: true
|
22
|
+
});
|
23
|
+
exports.getSectionsComponent = exports.getComponent = void 0;
|
20
24
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
21
25
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
22
26
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
@@ -26,7 +30,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
26
30
|
var _reactStately = require("react-stately");
|
27
31
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
28
32
|
var _ = require("../..");
|
29
|
-
var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
|
30
33
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
31
34
|
var _EnvironmentBreadcrumb = require("./EnvironmentBreadcrumb");
|
32
35
|
var _react2 = require("@emotion/react");
|
@@ -96,6 +99,7 @@ var getComponent = function getComponent(props) {
|
|
96
99
|
}, item.name);
|
97
100
|
})));
|
98
101
|
};
|
102
|
+
exports.getComponent = getComponent;
|
99
103
|
var getSectionsComponent = function getSectionsComponent() {
|
100
104
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
101
105
|
return (0, _testWrapper.render)((0, _react2.jsx)(_.OverlayProvider, null, (0, _react2.jsx)(_.EnvironmentBreadcrumb, (0, _extends2["default"])({}, defaultWithSectionsProps, props), function (section) {
|
@@ -116,6 +120,7 @@ var getSectionsComponent = function getSectionsComponent() {
|
|
116
120
|
);
|
117
121
|
})));
|
118
122
|
};
|
123
|
+
exports.getSectionsComponent = getSectionsComponent;
|
119
124
|
beforeAll(function () {
|
120
125
|
jest.spyOn(window.HTMLElement.prototype, 'clientWidth', 'get').mockImplementation(function () {
|
121
126
|
return 1000;
|
@@ -130,6 +135,7 @@ beforeAll(function () {
|
|
130
135
|
jest.spyOn(window, 'requestAnimationFrame').mockImplementation(function (cb) {
|
131
136
|
return cb();
|
132
137
|
});
|
138
|
+
jest.useFakeTimers();
|
133
139
|
});
|
134
140
|
afterEach(function () {
|
135
141
|
jest.clearAllMocks();
|
@@ -291,7 +297,6 @@ test('should show empty state in search if there are no results', function () {
|
|
291
297
|
_userEvent["default"].type(_testWrapper.screen.getByRole('searchbox'), '111');
|
292
298
|
expect(_testWrapper.screen.getByText(testEmptySearchText)).toBeInTheDocument();
|
293
299
|
});
|
294
|
-
(0, _testAxe["default"])(getComponent);
|
295
300
|
test('should be open when isDefaultOpen is true', function () {
|
296
301
|
getComponent({
|
297
302
|
isDefaultOpen: true
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
|
5
|
+
var _EnvironmentBreadcrumb = require("./EnvironmentBreadcrumb.test");
|
6
|
+
(0, _testAxe["default"])(_EnvironmentBreadcrumb.getComponent);
|
7
|
+
(0, _testAxe["default"])(_EnvironmentBreadcrumb.getSectionsComponent);
|
@@ -31,13 +31,14 @@ var axeTest = /*#__PURE__*/function () {
|
|
31
31
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
32
32
|
while (1) switch (_context.prev = _context.next) {
|
33
33
|
case 0:
|
34
|
+
jest.useRealTimers();
|
34
35
|
_getComponent = getComponent(), container = _getComponent.container;
|
35
|
-
_context.next =
|
36
|
+
_context.next = 4;
|
36
37
|
return (0, _jestAxe.axe)(container, rules);
|
37
|
-
case
|
38
|
+
case 4:
|
38
39
|
results = _context.sent;
|
39
40
|
expect(results).toHaveNoViolations();
|
40
|
-
case
|
41
|
+
case 6:
|
41
42
|
case "end":
|
42
43
|
return _context.stop();
|
43
44
|
}
|
@@ -25,7 +25,6 @@ import React from 'react';
|
|
25
25
|
import { Section } from 'react-stately';
|
26
26
|
import userEvent from '@testing-library/user-event';
|
27
27
|
import { EnvironmentBreadcrumb, Item, OverlayProvider } from '../..';
|
28
|
-
import axeTest from '../../utils/testUtils/testAxe';
|
29
28
|
import { render, screen, within } from '../../utils/testUtils/testWrapper';
|
30
29
|
import { breadCrumbDataIds } from './EnvironmentBreadcrumb';
|
31
30
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -84,7 +83,7 @@ var defaultWithSectionsProps = {
|
|
84
83
|
items: itemsWithSections
|
85
84
|
};
|
86
85
|
var onSelectionChange = jest.fn();
|
87
|
-
var getComponent = function getComponent(props) {
|
86
|
+
export var getComponent = function getComponent(props) {
|
88
87
|
return render(___EmotionJSX(OverlayProvider, null, ___EmotionJSX(EnvironmentBreadcrumb, _extends({}, defaultProps, props), function (item) {
|
89
88
|
return ___EmotionJSX(Item, {
|
90
89
|
key: item.name,
|
@@ -92,7 +91,7 @@ var getComponent = function getComponent(props) {
|
|
92
91
|
}, item.name);
|
93
92
|
})));
|
94
93
|
};
|
95
|
-
var getSectionsComponent = function getSectionsComponent() {
|
94
|
+
export var getSectionsComponent = function getSectionsComponent() {
|
96
95
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
97
96
|
return render(___EmotionJSX(OverlayProvider, null, ___EmotionJSX(EnvironmentBreadcrumb, _extends({}, defaultWithSectionsProps, props), function (section) {
|
98
97
|
return (
|
@@ -126,6 +125,7 @@ beforeAll(function () {
|
|
126
125
|
jest.spyOn(window, 'requestAnimationFrame').mockImplementation(function (cb) {
|
127
126
|
return cb();
|
128
127
|
});
|
128
|
+
jest.useFakeTimers();
|
129
129
|
});
|
130
130
|
afterEach(function () {
|
131
131
|
jest.clearAllMocks();
|
@@ -287,7 +287,6 @@ test('should show empty state in search if there are no results', function () {
|
|
287
287
|
userEvent.type(screen.getByRole('searchbox'), '111');
|
288
288
|
expect(screen.getByText(testEmptySearchText)).toBeInTheDocument();
|
289
289
|
});
|
290
|
-
axeTest(getComponent);
|
291
290
|
test('should be open when isDefaultOpen is true', function () {
|
292
291
|
getComponent({
|
293
292
|
isDefaultOpen: true
|
@@ -24,13 +24,14 @@ var axeTest = /*#__PURE__*/function () {
|
|
24
24
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
25
25
|
while (1) switch (_context.prev = _context.next) {
|
26
26
|
case 0:
|
27
|
+
jest.useRealTimers();
|
27
28
|
_getComponent = getComponent(), container = _getComponent.container;
|
28
|
-
_context.next =
|
29
|
+
_context.next = 4;
|
29
30
|
return axe(container, rules);
|
30
|
-
case
|
31
|
+
case 4:
|
31
32
|
results = _context.sent;
|
32
33
|
expect(results).toHaveNoViolations();
|
33
|
-
case
|
34
|
+
case 6:
|
34
35
|
case "end":
|
35
36
|
return _context.stop();
|
36
37
|
}
|