@pingux/astro 2.85.0 → 2.86.0-alpha.1
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/AccordionGridGroup/AccordionGridGroup.test.js +3 -1
- package/lib/cjs/components/AstroProvider/AstroProvider.js +13 -19
- package/lib/cjs/components/Box/Box.js +11 -11
- package/lib/cjs/components/Button/Button.js +4 -6
- package/lib/cjs/components/Button/Button.test.js +46 -10
- package/lib/cjs/components/CodeView/CodeView.mdx +1 -4
- package/lib/cjs/components/CodeView/CodeView.test.js +18 -6
- package/lib/cjs/components/ColorField/ColorField.js +4 -6
- package/lib/cjs/components/CopyText/CopyText.test.js +21 -23
- package/lib/cjs/components/DataTable/DataTable.test.js +39 -34
- package/lib/cjs/components/FieldHelperText/FieldHelperText.js +3 -1
- package/lib/cjs/components/HelpHint/HelpHint.test.js +25 -13
- package/lib/cjs/components/Image/Image.js +1 -2
- package/lib/cjs/components/ImageUploadField/ImageUploadField.test.js +6 -2
- package/lib/cjs/components/ListView/ListView.test.js +3 -1
- package/lib/cjs/components/Messages/Messages.test.js +1 -2
- package/lib/cjs/components/Messages/utils/tests/messagesReducer.test.js +1 -2
- package/lib/cjs/components/Messages/utils/tests/multiMessagesReducer.test.js +1 -2
- package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +75 -25
- package/lib/cjs/components/NavBar/NavBar.test.js +9 -3
- package/lib/cjs/components/NavSideBar/NavSideBar.test.js +15 -5
- package/lib/cjs/components/NumberField/NumberField.test.js +3 -1
- package/lib/cjs/components/PasswordField/PasswordField.js +2 -0
- package/lib/cjs/components/PasswordField/PasswordField.test.js +28 -22
- package/lib/cjs/components/PopoverContainer/PopoverContainer.js +2 -4
- package/lib/cjs/components/SelectFieldBase/SelectFieldBase.test.js +39 -18
- package/lib/cjs/components/Stepper/Line.js +4 -4
- package/lib/cjs/components/Stepper/Stepper.js +7 -5
- package/lib/cjs/components/Tab/Tab.js +2 -2
- package/lib/cjs/components/Tabs/Tabs.test.js +404 -273
- package/lib/cjs/components/TooltipTrigger/TooltipTrigger.test.js +19 -10
- package/lib/cjs/hooks/useAriaLabelWarning/useAriaLabelWarning.test.js +3 -3
- package/lib/cjs/hooks/useComponentToggle/useComponentToggle.test.js +4 -5
- package/lib/cjs/hooks/useDebounce/useDebounce.test.js +5 -5
- package/lib/cjs/hooks/useDeprecationWarning/useDeprecationWarning.test.js +8 -8
- package/lib/cjs/hooks/useDevelopmentWarning/useDevelopmentWarning.test.js +3 -3
- package/lib/cjs/hooks/useFallbackImage/useFallbackImage.test.js +4 -4
- package/lib/cjs/hooks/useField/useField.test.js +14 -14
- package/lib/cjs/hooks/useModalState/useModalState.test.js +16 -16
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.test.js +3 -3
- package/lib/cjs/hooks/useNavBarStyling/useNavBarStyling.test.js +3 -3
- package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.test.js +2 -2
- package/lib/cjs/hooks/usePropWarning/usePropWarning.test.js +6 -6
- package/lib/cjs/hooks/useStatusClasses/useStatusClasses.test.js +5 -5
- package/lib/cjs/hooks/useTShirtSize/useTShirtSize.test.js +6 -6
- package/lib/cjs/index.d.ts +0 -1
- package/lib/cjs/index.js +0 -8
- package/lib/cjs/styles/variants/variants.js +0 -2
- package/lib/cjs/types/index.d.ts +0 -1
- package/lib/cjs/types/index.js +44 -55
- package/lib/cjs/types/tabs.d.ts +1 -0
- package/lib/cjs/utils/testUtils/setupTests.js +3 -0
- package/lib/cjs/utils/testUtils/testWrapper.d.ts +1 -1
- package/lib/components/AccordionGridGroup/AccordionGridGroup.test.js +3 -1
- package/lib/components/AstroProvider/AstroProvider.js +13 -19
- package/lib/components/Box/Box.js +11 -11
- package/lib/components/Button/Button.js +4 -6
- package/lib/components/Button/Button.test.js +47 -11
- package/lib/components/CodeView/CodeView.mdx +1 -4
- package/lib/components/CodeView/CodeView.test.js +18 -6
- package/lib/components/ColorField/ColorField.js +4 -6
- package/lib/components/CopyText/CopyText.test.js +15 -16
- package/lib/components/DataTable/DataTable.test.js +19 -14
- package/lib/components/FieldHelperText/FieldHelperText.js +3 -1
- package/lib/components/HelpHint/HelpHint.test.js +26 -14
- package/lib/components/Image/Image.js +1 -2
- package/lib/components/ImageUploadField/ImageUploadField.test.js +7 -3
- package/lib/components/ListView/ListView.test.js +4 -2
- package/lib/components/Messages/Messages.test.js +1 -2
- package/lib/components/Messages/utils/tests/messagesReducer.test.js +1 -2
- package/lib/components/Messages/utils/tests/multiMessagesReducer.test.js +1 -2
- package/lib/components/MultivaluesField/MultivaluesField.test.js +76 -26
- package/lib/components/NavBar/NavBar.test.js +10 -4
- package/lib/components/NavSideBar/NavSideBar.test.js +16 -6
- package/lib/components/NumberField/NumberField.test.js +4 -2
- package/lib/components/PasswordField/PasswordField.js +2 -0
- package/lib/components/PasswordField/PasswordField.test.js +27 -21
- package/lib/components/PopoverContainer/PopoverContainer.js +2 -4
- package/lib/components/SelectFieldBase/SelectFieldBase.test.js +40 -17
- package/lib/components/Stepper/Line.js +3 -4
- package/lib/components/Stepper/Stepper.js +7 -5
- package/lib/components/Tab/Tab.js +2 -2
- package/lib/components/Tabs/Tabs.test.js +404 -273
- package/lib/components/TooltipTrigger/TooltipTrigger.test.js +20 -11
- package/lib/hooks/useAriaLabelWarning/useAriaLabelWarning.test.js +1 -1
- package/lib/hooks/useComponentToggle/useComponentToggle.test.js +1 -2
- package/lib/hooks/useDebounce/useDebounce.test.js +1 -1
- package/lib/hooks/useDeprecationWarning/useDeprecationWarning.test.js +1 -1
- package/lib/hooks/useDevelopmentWarning/useDevelopmentWarning.test.js +1 -1
- package/lib/hooks/useFallbackImage/useFallbackImage.test.js +1 -1
- package/lib/hooks/useField/useField.test.js +2 -2
- package/lib/hooks/useModalState/useModalState.test.js +1 -1
- package/lib/hooks/useNavBarPress/useNavBarPress.test.js +1 -1
- package/lib/hooks/useNavBarStyling/useNavBarStyling.test.js +1 -1
- package/lib/hooks/useOverlayPanelState/useOverlayPanelState.test.js +1 -1
- package/lib/hooks/usePropWarning/usePropWarning.test.js +1 -1
- package/lib/hooks/useStatusClasses/useStatusClasses.test.js +1 -1
- package/lib/hooks/useTShirtSize/useTShirtSize.test.js +1 -1
- package/lib/index.js +0 -1
- package/lib/styles/variants/variants.js +0 -2
- package/lib/types/index.js +0 -1
- package/lib/utils/testUtils/setupTests.js +3 -0
- package/package.json +10 -22
- package/lib/cjs/components/CodeEditor/CodeEditor.d.ts +0 -4
- package/lib/cjs/components/CodeEditor/CodeEditor.js +0 -56
- package/lib/cjs/components/CodeEditor/CodeEditor.mdx +0 -33
- package/lib/cjs/components/CodeEditor/CodeEditor.stories.d.ts +0 -29
- package/lib/cjs/components/CodeEditor/CodeEditor.stories.js +0 -108
- package/lib/cjs/components/CodeEditor/CodeEditor.styles.d.ts +0 -10
- package/lib/cjs/components/CodeEditor/CodeEditor.styles.js +0 -30
- package/lib/cjs/components/CodeEditor/CodeEditor.test.d.ts +0 -1
- package/lib/cjs/components/CodeEditor/CodeEditor.test.js +0 -149
- package/lib/cjs/components/CodeEditor/DefaultEditor.d.ts +0 -4
- package/lib/cjs/components/CodeEditor/DefaultEditor.js +0 -83
- package/lib/cjs/components/CodeEditor/eslintConfig.d.ts +0 -18
- package/lib/cjs/components/CodeEditor/eslintConfig.js +0 -95
- package/lib/cjs/components/CodeEditor/index.d.ts +0 -1
- package/lib/cjs/components/CodeEditor/index.js +0 -14
- package/lib/cjs/hooks/useTsLinter/index.d.ts +0 -1
- package/lib/cjs/hooks/useTsLinter/index.js +0 -14
- package/lib/cjs/hooks/useTsLinter/useTsLinter.d.ts +0 -4
- package/lib/cjs/hooks/useTsLinter/useTsLinter.js +0 -91
- package/lib/cjs/types/codeEditor.d.ts +0 -14
- package/lib/cjs/types/codeEditor.js +0 -6
- package/lib/components/CodeEditor/CodeEditor.js +0 -42
- package/lib/components/CodeEditor/CodeEditor.mdx +0 -33
- package/lib/components/CodeEditor/CodeEditor.stories.js +0 -94
- package/lib/components/CodeEditor/CodeEditor.styles.js +0 -22
- package/lib/components/CodeEditor/CodeEditor.test.js +0 -146
- package/lib/components/CodeEditor/DefaultEditor.js +0 -69
- package/lib/components/CodeEditor/eslintConfig.js +0 -87
- package/lib/components/CodeEditor/index.js +0 -1
- package/lib/hooks/useTsLinter/index.js +0 -1
- package/lib/hooks/useTsLinter/useTsLinter.js +0 -82
- package/lib/types/codeEditor.js +0 -1
@@ -33,8 +33,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
33
33
|
import React from 'react';
|
34
34
|
import { useAsyncList } from 'react-stately';
|
35
35
|
import { useCollator } from '@react-aria/i18n';
|
36
|
-
import { act, fireEvent, render, screen, within } from '@testing-library/react';
|
37
|
-
import { act as actHooks, renderHook } from '@testing-library/react-hooks';
|
36
|
+
import { act, act as actDom, act as actHooks, fireEvent, render, renderHook, screen, within } from '@testing-library/react';
|
38
37
|
import { DataTableBody, DataTableCell, DataTableColumn, DataTableHeader, DataTableRow } from '../../index';
|
39
38
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
40
39
|
import DataTable from './DataTable';
|
@@ -95,7 +94,7 @@ var getCell = function getCell(view, text) {
|
|
95
94
|
return el;
|
96
95
|
};
|
97
96
|
var focusCell = function focusCell(tree, text) {
|
98
|
-
return
|
97
|
+
return actDom(function () {
|
99
98
|
return getCell(tree, text).focus();
|
100
99
|
});
|
101
100
|
};
|
@@ -195,27 +194,35 @@ describe('Static DataTable', function () {
|
|
195
194
|
});
|
196
195
|
test('should move focus to the next cell in a row with ArrowRight', function () {
|
197
196
|
var view = staticDataTable();
|
198
|
-
|
197
|
+
act(function () {
|
198
|
+
focusCell(view, 'USA');
|
199
|
+
});
|
199
200
|
moveFocus('ArrowRight');
|
200
201
|
// eslint-disable-next-line jest-dom/prefer-focus
|
201
202
|
expect(document.activeElement).toBe(getCell(view, 320000000));
|
202
203
|
});
|
203
204
|
test('should move focus to the previous cell in a row with ArrowLeft', function () {
|
204
205
|
var view = staticDataTable();
|
205
|
-
|
206
|
+
act(function () {
|
207
|
+
focusCell(view, 'Asia');
|
208
|
+
});
|
206
209
|
moveFocus('ArrowLeft');
|
207
210
|
expect(getCell(view, 1398000000)).toHaveFocus();
|
208
211
|
});
|
209
212
|
test('should move focus to the next cell in a row with ArrowUp', function () {
|
210
213
|
var view = staticDataTable();
|
211
|
-
|
214
|
+
act(function () {
|
215
|
+
focusCell(view, 'China');
|
216
|
+
});
|
212
217
|
moveFocus('ArrowUp');
|
213
218
|
// eslint-disable-next-line jest-dom/prefer-focus
|
214
219
|
expect(document.activeElement).toBe(getCell(view, 'USA'));
|
215
220
|
});
|
216
221
|
test('should move focus to the previous cell in a row with ArrowDown', function () {
|
217
222
|
var view = staticDataTable();
|
218
|
-
|
223
|
+
act(function () {
|
224
|
+
focusCell(view, 'Asia');
|
225
|
+
});
|
219
226
|
moveFocus('ArrowDown');
|
220
227
|
expect(getCell(view, 'Europe')).toHaveFocus();
|
221
228
|
});
|
@@ -295,21 +302,19 @@ describe('Async DataTable', function () {
|
|
295
302
|
expect(asyncTable).toHaveAttribute('aria-label', 'Custom table with onLoadMore');
|
296
303
|
var body = screen.getAllByRole('rowgroup')[1];
|
297
304
|
var scrollView = body === null || body === void 0 || (_body$parentNode = body.parentNode) === null || _body$parentNode === void 0 ? void 0 : _body$parentNode.parentNode;
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
}
|
302
|
-
act(function () {
|
305
|
+
scrollView.scrollTop = 250;
|
306
|
+
fireEvent.scroll(scrollView);
|
307
|
+
actDom(function () {
|
303
308
|
jest.runAllTimers();
|
304
309
|
});
|
305
310
|
scrollView.scrollTop = 1500;
|
306
311
|
fireEvent.scroll(scrollView);
|
307
|
-
|
312
|
+
actDom(function () {
|
308
313
|
jest.runAllTimers();
|
309
314
|
});
|
310
315
|
scrollView.scrollTop = 2800;
|
311
316
|
fireEvent.scroll(scrollView);
|
312
|
-
|
317
|
+
actDom(function () {
|
313
318
|
jest.runAllTimers();
|
314
319
|
});
|
315
320
|
expect(onLoadMore).toHaveBeenCalledTimes(3);
|
@@ -14,6 +14,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
15
|
import React, { forwardRef } from 'react';
|
16
16
|
import { useStatusClasses } from '../../hooks';
|
17
|
+
import statuses from '../../utils/devUtils/constants/statuses';
|
17
18
|
import { statusDefaultProp } from '../../utils/docUtils/statusProp';
|
18
19
|
import Text from '../Text';
|
19
20
|
|
@@ -26,7 +27,8 @@ import Text from '../Text';
|
|
26
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
27
28
|
var FieldHelperText = /*#__PURE__*/forwardRef(function (props, ref) {
|
28
29
|
var className = props.className,
|
29
|
-
status = props.status,
|
30
|
+
_props$status = props.status,
|
31
|
+
status = _props$status === void 0 ? statuses.DEFAULT : _props$status,
|
30
32
|
id = props.id,
|
31
33
|
others = _objectWithoutProperties(props, _excluded);
|
32
34
|
var _useStatusClasses = useStatusClasses(className, _defineProperty({}, "is-".concat(status), true)),
|
@@ -14,7 +14,7 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
|
|
14
14
|
import React from 'react';
|
15
15
|
import userEvent from '@testing-library/user-event';
|
16
16
|
import { HelpHint, Link } from '../../index';
|
17
|
-
import { fireEvent, render, screen, waitFor } from '../../utils/testUtils/testWrapper';
|
17
|
+
import { act, fireEvent, render, screen, waitFor } from '../../utils/testUtils/testWrapper';
|
18
18
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
19
19
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
20
20
|
var testId = 'help-hint__button';
|
@@ -32,12 +32,11 @@ var getComponentWithLink = function getComponentWithLink() {
|
|
32
32
|
href: "https://uilibrary.ping-eng.com/"
|
33
33
|
}, "Learn More")));
|
34
34
|
};
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
}
|
35
|
+
beforeAll(function () {
|
36
|
+
jest.useFakeTimers();
|
37
|
+
});
|
38
|
+
afterEach(function () {
|
39
|
+
jest.clearAllMocks();
|
41
40
|
});
|
42
41
|
test('renders HelpHint component', function () {
|
43
42
|
getComponent();
|
@@ -214,13 +213,16 @@ test('popover closes after closeDelay when mouse leaves trigger', /*#__PURE__*/_
|
|
214
213
|
helpHintButton = screen.getByTestId(testId);
|
215
214
|
fireEvent.mouseEnter(helpHintButton);
|
216
215
|
fireEvent.mouseLeave(helpHintButton);
|
217
|
-
|
218
|
-
|
216
|
+
act(function () {
|
217
|
+
jest.advanceTimersByTime(11);
|
218
|
+
});
|
219
|
+
_context6.next = 8;
|
220
|
+
return act(function () {
|
219
221
|
expect(screen.queryByRole('presentation')).not.toBeInTheDocument();
|
220
222
|
}, {
|
221
223
|
timeout: closeDelay + 1
|
222
224
|
});
|
223
|
-
case
|
225
|
+
case 8:
|
224
226
|
case "end":
|
225
227
|
return _context6.stop();
|
226
228
|
}
|
@@ -236,15 +238,25 @@ test('popover automatically closes in 1000ms after mouse leaves trigger', /*#__P
|
|
236
238
|
helpHintButton = screen.getByTestId(testId);
|
237
239
|
fireEvent.mouseEnter(helpHintButton);
|
238
240
|
fireEvent.mouseLeave(helpHintButton);
|
239
|
-
|
240
|
-
|
241
|
+
act(function () {
|
242
|
+
jest.advanceTimersByTime(1001);
|
243
|
+
});
|
244
|
+
_context7.next = 8;
|
245
|
+
return act(function () {
|
241
246
|
expect(screen.queryByRole('presentation')).not.toBeInTheDocument();
|
242
247
|
}, {
|
243
248
|
timeout: oneSecond + 1
|
244
249
|
});
|
245
|
-
case
|
250
|
+
case 8:
|
246
251
|
case "end":
|
247
252
|
return _context7.stop();
|
248
253
|
}
|
249
254
|
}, _callee7);
|
250
|
-
})));
|
255
|
+
})));
|
256
|
+
|
257
|
+
// Needs to be added to each components test file
|
258
|
+
universalComponentTests({
|
259
|
+
renderComponent: function renderComponent(props) {
|
260
|
+
return ___EmotionJSX(HelpHint, _extends({}, defaultProps, props));
|
261
|
+
}
|
262
|
+
});
|
@@ -4,6 +4,7 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
5
5
|
var _templateObject;
|
6
6
|
var _excluded = ["className", "fallbackImage", "fallbackTimeout", "isDisabled", "src", "alt", "sx", "fallbackAlt"];
|
7
|
+
/* istanbul ignore file */
|
7
8
|
import React, { forwardRef, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
8
9
|
import { keyframes } from '@emotion/react';
|
9
10
|
import { useHover } from '@react-aria/interactions';
|
@@ -53,8 +54,6 @@ var Image = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
53
54
|
return setImgAttribute(alt, fallbackAlt);
|
54
55
|
}, [alt, isLoading, shouldShowFallback]);
|
55
56
|
var imgRef = useLocalOrForwardRef(ref);
|
56
|
-
|
57
|
-
/* istanbul ignore next */
|
58
57
|
useImperativeHandle(ref, function () {
|
59
58
|
return imgRef.current;
|
60
59
|
});
|
@@ -15,7 +15,7 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
15
15
|
import React from 'react';
|
16
16
|
import { fireEvent } from '@testing-library/react';
|
17
17
|
import userEvent from '@testing-library/user-event';
|
18
|
-
import { render, screen } from '../../utils/testUtils/testWrapper';
|
18
|
+
import { act, render, screen } from '../../utils/testUtils/testWrapper';
|
19
19
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
20
20
|
import ImageUploadField from './ImageUploadField';
|
21
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -76,11 +76,15 @@ test('should render image upload component by default', function () {
|
|
76
76
|
test('should render div with icon when focused', function () {
|
77
77
|
getComponent();
|
78
78
|
var imageUploadButton = screen.getByTestId(testButtonId);
|
79
|
-
|
79
|
+
act(function () {
|
80
|
+
imageUploadButton.focus();
|
81
|
+
});
|
80
82
|
var hoveredPreview = screen.getByTestId('image-upload-hovered-preview');
|
81
83
|
expect(hoveredPreview).toBeInstanceOf(HTMLDivElement);
|
82
84
|
expect(hoveredPreview).toBeInTheDocument();
|
83
|
-
|
85
|
+
act(function () {
|
86
|
+
imageUploadButton.blur();
|
87
|
+
});
|
84
88
|
expect(hoveredPreview).not.toBeInTheDocument();
|
85
89
|
});
|
86
90
|
test('should upload a file', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
@@ -27,7 +27,7 @@ import { Item } from 'react-stately';
|
|
27
27
|
import userEvent from '@testing-library/user-event';
|
28
28
|
import _ from 'lodash';
|
29
29
|
import loadingStates from '../../utils/devUtils/constants/loadingStates';
|
30
|
-
import { fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
30
|
+
import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
31
31
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
32
32
|
import Button from '../Button';
|
33
33
|
import CheckboxField from '../CheckboxField';
|
@@ -403,7 +403,9 @@ test('list view not receive focus when click on checkbox', function () {
|
|
403
403
|
var listItem = screen.getAllByRole('gridcell');
|
404
404
|
var checkbox = screen.getAllByTestId('TestID');
|
405
405
|
expect(listItem[0]).not.toHaveClass('is-focused');
|
406
|
-
|
406
|
+
act(function () {
|
407
|
+
checkbox[0].click();
|
408
|
+
});
|
407
409
|
expect(listItem[0]).not.toHaveClass('is-focused');
|
408
410
|
});
|
409
411
|
test('list view reset hover on item when scroll', function () {
|
@@ -2,12 +2,11 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
3
3
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
4
4
|
import React from 'react';
|
5
|
-
import { act } from 'react-dom/test-utils';
|
6
5
|
import { Item } from 'react-stately';
|
7
6
|
import AccountIcon from '@pingux/mdi-react/AccountIcon';
|
8
7
|
import userEvent from '@testing-library/user-event';
|
9
8
|
import statuses from '../../utils/devUtils/constants/statuses';
|
10
|
-
import { render, screen } from '../../utils/testUtils/testWrapper';
|
9
|
+
import { act, render, screen } from '../../utils/testUtils/testWrapper';
|
11
10
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
12
11
|
import { ARIA_STATUSES } from './Message';
|
13
12
|
import Messages, { messagesReducerStory, multiMessagesReducerStory } from '.';
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
3
3
|
import React, { useEffect, useReducer } from 'react';
|
4
|
-
import { act } from '
|
5
|
-
import { render, screen } from '../../../../utils/testUtils/testWrapper';
|
4
|
+
import { act, render, screen } from '../../../../utils/testUtils/testWrapper';
|
6
5
|
import messagesReducer, { addMessage, clearMessages, hideMessage, removeMessage, showMessage } from '../messagesReducer';
|
7
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
7
|
var testId = 'test-messages';
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
3
3
|
import React, { useEffect, useReducer } from 'react';
|
4
|
-
import { act } from '
|
5
|
-
import { render, screen } from '../../../../utils/testUtils/testWrapper';
|
4
|
+
import { act, render, screen } from '../../../../utils/testUtils/testWrapper';
|
6
5
|
import multiMessagesReducer, { addMessage, clearMessages, hideMessage, removeMessage, showMessage } from '../multiMessagesReducer';
|
7
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
7
|
var testId = 'test-messages';
|
@@ -16,7 +16,7 @@ import React from 'react';
|
|
16
16
|
import userEvent from '@testing-library/user-event';
|
17
17
|
import { Item, MultivaluesField, OverlayProvider, Section } from '../../index';
|
18
18
|
import statuses from '../../utils/devUtils/constants/statuses';
|
19
|
-
import { fireEvent, getDefaultNormalizer, render, screen, within } from '../../utils/testUtils/testWrapper';
|
19
|
+
import { act, fireEvent, getDefaultNormalizer, render, screen, within } from '../../utils/testUtils/testWrapper';
|
20
20
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
21
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
22
22
|
var items = [{
|
@@ -153,10 +153,14 @@ test('closes listbox on blur and fires "onBlur"', function () {
|
|
153
153
|
onBlur: onBlur
|
154
154
|
});
|
155
155
|
var input = screen.getByRole('combobox');
|
156
|
-
|
156
|
+
act(function () {
|
157
|
+
userEvent.tab();
|
158
|
+
});
|
157
159
|
expect(input).toHaveFocus();
|
158
160
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
159
|
-
|
161
|
+
act(function () {
|
162
|
+
input.blur();
|
163
|
+
});
|
160
164
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
161
165
|
expect(onBlur).toBeCalled();
|
162
166
|
});
|
@@ -170,7 +174,9 @@ test('opening and closing listbox fires "onOpenChange"', function () {
|
|
170
174
|
expect(input).toHaveFocus();
|
171
175
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
172
176
|
expect(onOpenChange).toHaveBeenCalledWith(true);
|
173
|
-
|
177
|
+
act(function () {
|
178
|
+
input.blur();
|
179
|
+
});
|
174
180
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
175
181
|
expect(onOpenChange).toHaveBeenCalledWith(false);
|
176
182
|
});
|
@@ -183,10 +189,14 @@ test('multiple selection is enabled, option disappears after selection', functio
|
|
183
189
|
expect(listbox).toHaveAttribute('aria-multiselectable', 'true');
|
184
190
|
var options = within(listbox).getAllByRole('option');
|
185
191
|
var firstOption = options[0];
|
186
|
-
|
192
|
+
act(function () {
|
193
|
+
firstOption.click();
|
194
|
+
});
|
187
195
|
expect(firstOption).not.toBeInTheDocument();
|
188
196
|
var secondOption = options[1];
|
189
|
-
|
197
|
+
act(function () {
|
198
|
+
secondOption.click();
|
199
|
+
});
|
190
200
|
expect(secondOption).not.toBeInTheDocument();
|
191
201
|
});
|
192
202
|
test('updates aria attributes on option focus', function () {
|
@@ -223,7 +233,9 @@ test('clicking an option renders badge with option name', function () {
|
|
223
233
|
expect(input).toHaveFocus();
|
224
234
|
var options = screen.getAllByRole('option');
|
225
235
|
var firstOption = options[0];
|
226
|
-
|
236
|
+
act(function () {
|
237
|
+
firstOption.click();
|
238
|
+
});
|
227
239
|
expect(firstOption).not.toBeInTheDocument();
|
228
240
|
var badge = screen.getByText(items[0].name);
|
229
241
|
expect(badge).toBeInTheDocument();
|
@@ -237,7 +249,9 @@ test('after clicking an option, and then clicking the text input, the listbox re
|
|
237
249
|
expect(input).toHaveFocus();
|
238
250
|
var options = screen.getAllByRole('option');
|
239
251
|
var firstOption = options[0];
|
240
|
-
|
252
|
+
act(function () {
|
253
|
+
firstOption.click();
|
254
|
+
});
|
241
255
|
expect(firstOption).not.toBeInTheDocument();
|
242
256
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
243
257
|
userEvent.click(input);
|
@@ -262,7 +276,9 @@ test('after clicking an option, and then typing a custom input, the listbox rema
|
|
262
276
|
expect(input).toHaveFocus();
|
263
277
|
options = screen.getAllByRole('option');
|
264
278
|
firstOption = options[0];
|
265
|
-
|
279
|
+
act(function () {
|
280
|
+
firstOption.click();
|
281
|
+
});
|
266
282
|
expect(firstOption).not.toBeInTheDocument();
|
267
283
|
_context.next = 10;
|
268
284
|
return userEvent.clear(input);
|
@@ -288,15 +304,23 @@ test('clicking on delete button deletes selection, and re-adds option to list',
|
|
288
304
|
expect(input).toHaveFocus();
|
289
305
|
var options = screen.getAllByRole('option');
|
290
306
|
var firstOption = options[0];
|
291
|
-
|
307
|
+
act(function () {
|
308
|
+
firstOption.click();
|
309
|
+
});
|
292
310
|
expect(firstOption).not.toBeInTheDocument();
|
293
311
|
var badge = screen.getByText(items[0].name);
|
294
312
|
expect(badge).toBeInTheDocument();
|
295
313
|
var deleteButton = badge.nextSibling;
|
296
|
-
|
314
|
+
act(function () {
|
315
|
+
deleteButton.click();
|
316
|
+
});
|
297
317
|
expect(badge).not.toBeInTheDocument();
|
298
|
-
|
299
|
-
|
318
|
+
act(function () {
|
319
|
+
input.blur();
|
320
|
+
});
|
321
|
+
act(function () {
|
322
|
+
input.focus();
|
323
|
+
});
|
300
324
|
var updatedOptions = screen.getAllByRole('option');
|
301
325
|
expect(updatedOptions[0]).toBeInTheDocument();
|
302
326
|
expect(updatedOptions[0]).toHaveTextContent(items[0].name);
|
@@ -312,10 +336,14 @@ test('clicking an option fires "onSelectionChange"', function () {
|
|
312
336
|
var listbox = screen.getByRole('listbox');
|
313
337
|
var options = within(listbox).getAllByRole('option');
|
314
338
|
var firstOption = options[0];
|
315
|
-
|
339
|
+
act(function () {
|
340
|
+
firstOption.click();
|
341
|
+
});
|
316
342
|
expect(firstOption).not.toBeInTheDocument();
|
317
343
|
var secondOption = options[1];
|
318
|
-
|
344
|
+
act(function () {
|
345
|
+
secondOption.click();
|
346
|
+
});
|
319
347
|
expect(secondOption).not.toBeInTheDocument();
|
320
348
|
expect(onSelectionChange).toBeCalledTimes(2);
|
321
349
|
expect(onSelectionChange.mock.calls[0][0].has(items[0].name)).toBeTruthy();
|
@@ -479,7 +507,9 @@ test('in non-restrictive mode the value that was already selected using the list
|
|
479
507
|
var listbox = screen.getByRole('listbox');
|
480
508
|
var options = within(listbox).getAllByRole('option');
|
481
509
|
var firstOption = options[0];
|
482
|
-
|
510
|
+
act(function () {
|
511
|
+
firstOption.click();
|
512
|
+
});
|
483
513
|
expect(onSelectionChange.mock.calls[0][0].has(items[0].name)).toBeTruthy();
|
484
514
|
onSelectionChange.mockClear();
|
485
515
|
userEvent.type(input, items[0].name);
|
@@ -656,7 +686,9 @@ test('deleting a single badge via keyboard moves focus to the input', function (
|
|
656
686
|
userEvent.tab();
|
657
687
|
var options = screen.getAllByRole('option');
|
658
688
|
var firstOption = options[0];
|
659
|
-
|
689
|
+
act(function () {
|
690
|
+
firstOption.click();
|
691
|
+
});
|
660
692
|
var badge = screen.getByText(items[0].name);
|
661
693
|
expect(badge).toBeInTheDocument();
|
662
694
|
userEvent.tab({
|
@@ -679,8 +711,12 @@ test('deleting the last badge via keyboard moves focus to the previous badge', f
|
|
679
711
|
var options = screen.getAllByRole('option');
|
680
712
|
var firstOption = options[0];
|
681
713
|
var secondOption = options[1];
|
682
|
-
|
683
|
-
|
714
|
+
act(function () {
|
715
|
+
firstOption.click();
|
716
|
+
});
|
717
|
+
act(function () {
|
718
|
+
secondOption.click();
|
719
|
+
});
|
684
720
|
var badge1 = screen.getByText(items[0].name);
|
685
721
|
var badge2 = screen.getByText(items[1].name);
|
686
722
|
expect(badge1).toBeInTheDocument();
|
@@ -784,15 +820,23 @@ test('in condensed mode selects and deselects ', function () {
|
|
784
820
|
var buttons = screen.getAllByRole('button');
|
785
821
|
var button = buttons[1];
|
786
822
|
expect(button).toHaveTextContent('Select All');
|
787
|
-
|
823
|
+
act(function () {
|
824
|
+
button.click();
|
825
|
+
});
|
788
826
|
expect(button).toHaveTextContent('Deselect All');
|
789
827
|
expect(screen.getByText('All Selected')).toBeInTheDocument();
|
790
|
-
|
828
|
+
act(function () {
|
829
|
+
firstOption.click();
|
830
|
+
});
|
791
831
|
expect(button).toHaveTextContent('Select All');
|
792
832
|
expect(screen.getByText('2 Selected')).toBeInTheDocument();
|
793
|
-
|
833
|
+
act(function () {
|
834
|
+
button.click();
|
835
|
+
});
|
794
836
|
expect(button).toHaveTextContent('Deselect All');
|
795
|
-
|
837
|
+
act(function () {
|
838
|
+
button.click();
|
839
|
+
});
|
796
840
|
expect(button).toHaveTextContent('Select All');
|
797
841
|
});
|
798
842
|
test('in condensed mode "onSelectionChange" is called', function () {
|
@@ -821,7 +865,9 @@ test('opening and closing listbox fires "onOpenChange" in condensed mode', funct
|
|
821
865
|
expect(input).toHaveFocus();
|
822
866
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
823
867
|
expect(onOpenChange).toHaveBeenCalledWith(true);
|
824
|
-
|
868
|
+
act(function () {
|
869
|
+
input.blur();
|
870
|
+
});
|
825
871
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
826
872
|
expect(onOpenChange).toHaveBeenCalledWith(false);
|
827
873
|
});
|
@@ -884,7 +930,9 @@ test('closes listbox on blur and fires "onBlur"', function () {
|
|
884
930
|
userEvent.tab();
|
885
931
|
expect(input).toHaveFocus();
|
886
932
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
887
|
-
|
933
|
+
act(function () {
|
934
|
+
input.blur();
|
935
|
+
});
|
888
936
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
889
937
|
expect(onBlur).toBeCalled();
|
890
938
|
});
|
@@ -925,7 +973,9 @@ test('popover closes on input blur', function () {
|
|
925
973
|
var checkboxes = within(listbox).getAllByRole('img');
|
926
974
|
expect(checkboxes.length).toBe(3);
|
927
975
|
var secondOption = options[1];
|
928
|
-
|
976
|
+
act(function () {
|
977
|
+
secondOption.click();
|
978
|
+
});
|
929
979
|
var value = 'Aardvark';
|
930
980
|
userEvent.type(input, value);
|
931
981
|
userEvent.click(document.body);
|
@@ -15,7 +15,7 @@ import ViewDashboard from '@pingux/mdi-react/ViewDashboardIcon';
|
|
15
15
|
import ViewGridPlusOutline from '@pingux/mdi-react/ViewGridPlusOutlineIcon';
|
16
16
|
import userEvent from '@testing-library/user-event';
|
17
17
|
import { Box, Button, Link, NavBarItem, NavBarItemButton, NavBarItemLink, NavBarSection } from '../../index';
|
18
|
-
import { fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
18
|
+
import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
19
19
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
20
20
|
import NavBar from './NavBar';
|
21
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -340,7 +340,9 @@ test('should change focus between NavBarItemHeader on arrow key press', function
|
|
340
340
|
getComponent();
|
341
341
|
var headerButtons = screen.getAllByRole('button');
|
342
342
|
expect(headerButtons[0]).toBeInTheDocument();
|
343
|
-
|
343
|
+
act(function () {
|
344
|
+
headerButtons[0].focus();
|
345
|
+
});
|
344
346
|
expect(headerButtons[0]).toHaveClass('is-focused');
|
345
347
|
fireEvent.keyDown(headerButtons[0], {
|
346
348
|
key: 'ArrowDown',
|
@@ -372,7 +374,9 @@ test('should not change focus from NavItemBody to NavBarItemHeader on arrow key
|
|
372
374
|
getComponent();
|
373
375
|
var headerButtons = screen.getAllByRole('button');
|
374
376
|
expect(headerButtons[0]).toBeInTheDocument();
|
375
|
-
|
377
|
+
act(function () {
|
378
|
+
headerButtons[0].click();
|
379
|
+
});
|
376
380
|
fireEvent.keyDown(headerButtons[0], {
|
377
381
|
key: 'ArrowDown',
|
378
382
|
keyCode: 40
|
@@ -403,7 +407,9 @@ test('should change focus between nav children on arrow key press', function ()
|
|
403
407
|
var link = screen.getByTestId('navLink');
|
404
408
|
var button = screen.getByTestId('navButton');
|
405
409
|
expect(link).toBeInTheDocument();
|
406
|
-
|
410
|
+
act(function () {
|
411
|
+
link.focus();
|
412
|
+
});
|
407
413
|
expect(link).toHaveClass('is-focused');
|
408
414
|
fireEvent.keyDown(link, {
|
409
415
|
key: 'ArrowDown',
|
@@ -2,7 +2,7 @@ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
2
2
|
import React from 'react';
|
3
3
|
import userEvent from '@testing-library/user-event';
|
4
4
|
import { Box, NavSideBarHeader, NavSideBarItem, NavSideBarSection, NavSideBarSectionItem, Separator } from '../../index';
|
5
|
-
import { fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
5
|
+
import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
6
6
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
7
7
|
import { Earth, EmoticonHappy, Fingerprint, GlobeIcon, Logo, OpenInNew, ViewDashboard, ViewGridPlusOutline } from './icons';
|
8
8
|
import NavSideBar from './NavSideBar';
|
@@ -171,7 +171,9 @@ test('should change focus between NavBarItemHeader on arrow key press', function
|
|
171
171
|
getComponent();
|
172
172
|
var headerButtons = screen.getAllByRole('button');
|
173
173
|
expect(headerButtons[0]).toBeInTheDocument();
|
174
|
-
|
174
|
+
act(function () {
|
175
|
+
headerButtons[0].focus();
|
176
|
+
});
|
175
177
|
expect(headerButtons[0]).toHaveClass('is-focused');
|
176
178
|
fireEvent.keyDown(headerButtons[0], {
|
177
179
|
key: 'ArrowDown',
|
@@ -203,7 +205,9 @@ test('should not change focus from NavItemBody to NavBarItemHeader on up/down ar
|
|
203
205
|
getComponent();
|
204
206
|
var headerButtons = screen.getAllByRole('button');
|
205
207
|
expect(headerButtons[1]).toBeInTheDocument();
|
206
|
-
|
208
|
+
act(function () {
|
209
|
+
headerButtons[1].click();
|
210
|
+
});
|
207
211
|
fireEvent.keyDown(headerButtons[0], {
|
208
212
|
key: 'ArrowDown',
|
209
213
|
keyCode: 40
|
@@ -233,7 +237,9 @@ test('should not change focus from NavItemBody to NavBarItemHeader on left/right
|
|
233
237
|
getComponent();
|
234
238
|
var headerButtons = screen.getAllByRole('button');
|
235
239
|
expect(headerButtons[1]).toBeInTheDocument();
|
236
|
-
|
240
|
+
act(function () {
|
241
|
+
headerButtons[1].click();
|
242
|
+
});
|
237
243
|
fireEvent.keyDown(headerButtons[0], {
|
238
244
|
key: 'ArrowRight',
|
239
245
|
keyCode: 39
|
@@ -270,10 +276,14 @@ test('expand only one item', function () {
|
|
270
276
|
expect(screen.queryByText('Group')).not.toBeInTheDocument();
|
271
277
|
expect(screen.queryByText('Users')).not.toBeInTheDocument();
|
272
278
|
var headerButtons = screen.getAllByRole('button');
|
273
|
-
|
279
|
+
act(function () {
|
280
|
+
userEvent.click(headerButtons[1]);
|
281
|
+
});
|
274
282
|
expect(screen.queryByText('Group')).toBeInTheDocument();
|
275
283
|
expect(screen.queryByText('Users')).not.toBeInTheDocument();
|
276
|
-
|
284
|
+
act(function () {
|
285
|
+
userEvent.click(headerButtons[2]);
|
286
|
+
});
|
277
287
|
expect(screen.queryByText('Group')).not.toBeInTheDocument();
|
278
288
|
expect(screen.queryByText('Users')).toBeInTheDocument();
|
279
289
|
});
|
@@ -4,7 +4,7 @@ import { fireEvent } from '@testing-library/react';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
5
5
|
import { NumberField } from '../../index';
|
6
6
|
import statuses from '../../utils/devUtils/constants/statuses';
|
7
|
-
import { render, screen } from '../../utils/testUtils/testWrapper';
|
7
|
+
import { act, render, screen } from '../../utils/testUtils/testWrapper';
|
8
8
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
10
|
var testId = 'test-NumberField';
|
@@ -73,7 +73,9 @@ test('calling onChange with integer when input value changed (controlled state)'
|
|
73
73
|
var numberInput = screen.queryAllByLabelText(testLabel)[1];
|
74
74
|
userEvent.clear(numberInput);
|
75
75
|
userEvent.type(numberInput, newTestValue.toString());
|
76
|
-
|
76
|
+
act(function () {
|
77
|
+
numberInput.blur();
|
78
|
+
});
|
77
79
|
expect(mockOnChange).toHaveBeenCalledWith(newTestValue);
|
78
80
|
});
|
79
81
|
test('should be marked as required if isRequired prop if passed', function () {
|
@@ -118,6 +118,8 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
118
118
|
overlayProps = _useOverlayPosition.overlayProps,
|
119
119
|
placement = _useOverlayPosition.placement,
|
120
120
|
updatePosition = _useOverlayPosition.updatePosition;
|
121
|
+
|
122
|
+
/* istanbul ignore next */
|
121
123
|
useLayoutEffect(function () {
|
122
124
|
if (isFocused) {
|
123
125
|
requestAnimationFrame(function () {
|