@pingux/astro 1.36.1-alpha.1 → 1.36.2-alpha.0
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/CHANGELOG.md +11 -0
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +18 -8
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +16 -0
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +16 -8
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +13 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,17 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.36.1](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.36.0...@pingux/astro@1.36.1) (2022-11-17)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5895] NavBarSection: add data-id to top level button ([35be867](https://gitlab.corp.pingidentity.com/ux/pingux/commit/35be867a8a76b2538f8fa47508bfa69d9ee18adb))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
6
17
|
# [1.36.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.35.0...@pingux/astro@1.36.0) (2022-11-15)
|
7
18
|
|
8
19
|
|
@@ -26,7 +26,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
26
26
|
value: true
|
27
27
|
});
|
28
28
|
|
29
|
-
exports["default"] = void 0;
|
29
|
+
exports["default"] = exports.breadCrumbDataIds = void 0;
|
30
30
|
|
31
31
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
32
32
|
|
@@ -76,7 +76,7 @@ var _index = require("../../index");
|
|
76
76
|
|
77
77
|
var _react2 = require("@emotion/react");
|
78
78
|
|
79
|
-
var _excluded = ["children", "disabledKeys", "emptySearchText", "isDefaultOpen", "isOpen", "items", "itemsFilter", "
|
79
|
+
var _excluded = ["children", "disabledKeys", "emptySearchText", "isDefaultOpen", "isOpen", "items", "itemsFilter", "name", "onNamePress", "onOpenChange", "onPopoverClose", "onPopoverOpen", "onSelectionChange", "popoverProps", "searchProps", "selectedItem"];
|
80
80
|
|
81
81
|
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); }
|
82
82
|
|
@@ -86,7 +86,14 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
86
86
|
|
87
87
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty2(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
88
88
|
|
89
|
+
var breadCrumbDataIds = {
|
90
|
+
dropdownList: 'breadcrumb--dropdown-list',
|
91
|
+
environmentButton: 'breadcrumb--environment-button',
|
92
|
+
orgButton: 'breadcrumb--org-button'
|
93
|
+
};
|
89
94
|
/** The Environment Picker with Search and Sections support */
|
95
|
+
|
96
|
+
exports.breadCrumbDataIds = breadCrumbDataIds;
|
90
97
|
var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
91
98
|
var children = props.children,
|
92
99
|
imperativeDisabledKeys = props.disabledKeys,
|
@@ -95,15 +102,15 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
95
102
|
isOpen = props.isOpen,
|
96
103
|
items = props.items,
|
97
104
|
imperativeItemsFilter = props.itemsFilter,
|
98
|
-
|
105
|
+
name = props.name,
|
99
106
|
onNamePress = props.onNamePress,
|
107
|
+
onOpenChange = props.onOpenChange,
|
100
108
|
imperativeOnPopoverClose = props.onPopoverClose,
|
101
109
|
imperativeOnPopoverOpen = props.onPopoverOpen,
|
102
110
|
onSelectionChange = props.onSelectionChange,
|
103
|
-
|
111
|
+
popoverProps = props.popoverProps,
|
104
112
|
searchProps = props.searchProps,
|
105
113
|
selectedItem = props.selectedItem,
|
106
|
-
popoverProps = props.popoverProps,
|
107
114
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
108
115
|
|
109
116
|
var _useState = (0, _react.useState)(''),
|
@@ -272,7 +279,8 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
272
279
|
onPress: handlePopoverOpen,
|
273
280
|
ref: triggerRef,
|
274
281
|
variant: "environmentBreadcrumb.current",
|
275
|
-
"aria-label": setAriaLabel(selectedItem)
|
282
|
+
"aria-label": setAriaLabel(selectedItem),
|
283
|
+
"data-id": breadCrumbDataIds.environmentButton
|
276
284
|
}), selectedItem, (0, _react2.jsx)(_index.Icon, {
|
277
285
|
icon: popoverState.isOpen ? _ArrowDropUpIcon["default"] : _ArrowDropDownIcon["default"]
|
278
286
|
})), (0, _react2.jsx)(_index.PopoverContainer, (0, _extends2["default"])({}, overlayProps, positionProps, (0, _utils.mergeProps)(overlayProps, positionProps, popoverProps), {
|
@@ -301,8 +309,9 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
301
309
|
},
|
302
310
|
onChange: setSearchValue
|
303
311
|
}, searchProps)), checkIfListEmpty() ? EmptyListState : (0, _react2.jsx)(_ListBox["default"], {
|
304
|
-
|
305
|
-
"
|
312
|
+
"aria-label": "Items List",
|
313
|
+
"data-id": breadCrumbDataIds.dropdownList,
|
314
|
+
state: listBoxState
|
306
315
|
})))));
|
307
316
|
var handleOnAction = (0, _react.useCallback)(function (actionKey) {
|
308
317
|
if (actionKey === 'name' && onNamePress) {
|
@@ -323,6 +332,7 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
323
332
|
variant: "environmentBreadcrumb.current",
|
324
333
|
"data-testid": "name",
|
325
334
|
"aria-label": name,
|
335
|
+
"data-id": breadCrumbDataIds.orgButton,
|
326
336
|
elementType: "Button"
|
327
337
|
}, (0, _react2.jsx)(_index.Icon, {
|
328
338
|
icon: _HomeIcon["default"],
|
@@ -38,6 +38,8 @@ var _testWrapper = require("../../utils/testUtils/testWrapper");
|
|
38
38
|
|
39
39
|
var _index = require("../../index");
|
40
40
|
|
41
|
+
var _EnvironmentBreadcrumb = require("./EnvironmentBreadcrumb");
|
42
|
+
|
41
43
|
var _react2 = require("@emotion/react");
|
42
44
|
|
43
45
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -357,4 +359,18 @@ test('should respond to onOpenChange', function () {
|
|
357
359
|
_userEvent["default"].click(_testWrapper.screen.getByText(testSelectedItem));
|
358
360
|
|
359
361
|
expect(onOpenChange).toHaveBeenNthCalledWith(2, false);
|
362
|
+
});
|
363
|
+
test('should add data-ids to environment button and org button', function () {
|
364
|
+
getComponent();
|
365
|
+
expect(_testWrapper.screen.getByText(testSelectedItem)).toHaveAttribute('data-id', _EnvironmentBreadcrumb.breadCrumbDataIds.environmentButton);
|
366
|
+
expect(_testWrapper.screen.getByText(testName)).toHaveAttribute('data-id', _EnvironmentBreadcrumb.breadCrumbDataIds.orgButton);
|
367
|
+
});
|
368
|
+
test('should add data-id to dropdown list', function () {
|
369
|
+
getComponent();
|
370
|
+
|
371
|
+
_userEvent["default"].click(_testWrapper.screen.getByText(testSelectedItem));
|
372
|
+
|
373
|
+
expect(_testWrapper.screen.getByRole('listbox', {
|
374
|
+
name: 'Items List'
|
375
|
+
})).toHaveAttribute('data-id', _EnvironmentBreadcrumb.breadCrumbDataIds.dropdownList);
|
360
376
|
});
|
@@ -12,7 +12,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
12
12
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
13
13
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
14
14
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
15
|
-
var _excluded = ["children", "disabledKeys", "emptySearchText", "isDefaultOpen", "isOpen", "items", "itemsFilter", "
|
15
|
+
var _excluded = ["children", "disabledKeys", "emptySearchText", "isDefaultOpen", "isOpen", "items", "itemsFilter", "name", "onNamePress", "onOpenChange", "onPopoverClose", "onPopoverOpen", "onSelectionChange", "popoverProps", "searchProps", "selectedItem"];
|
16
16
|
|
17
17
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
18
18
|
|
@@ -33,9 +33,14 @@ import { useListState } from '@react-stately/list';
|
|
33
33
|
import ListBox from '../ListBox';
|
34
34
|
import { isIterableProp } from '../../utils/devUtils/props/isIterable';
|
35
35
|
import { Breadcrumbs, Button, Icon, Item, PopoverContainer, ScrollBox, SearchField, Text } from '../../index';
|
36
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
37
|
+
export var breadCrumbDataIds = {
|
38
|
+
dropdownList: 'breadcrumb--dropdown-list',
|
39
|
+
environmentButton: 'breadcrumb--environment-button',
|
40
|
+
orgButton: 'breadcrumb--org-button'
|
41
|
+
};
|
36
42
|
/** The Environment Picker with Search and Sections support */
|
37
43
|
|
38
|
-
import { jsx as ___EmotionJSX } from "@emotion/react";
|
39
44
|
var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
40
45
|
var children = props.children,
|
41
46
|
imperativeDisabledKeys = props.disabledKeys,
|
@@ -44,15 +49,15 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
44
49
|
isOpen = props.isOpen,
|
45
50
|
items = props.items,
|
46
51
|
imperativeItemsFilter = props.itemsFilter,
|
47
|
-
|
52
|
+
name = props.name,
|
48
53
|
onNamePress = props.onNamePress,
|
54
|
+
onOpenChange = props.onOpenChange,
|
49
55
|
imperativeOnPopoverClose = props.onPopoverClose,
|
50
56
|
imperativeOnPopoverOpen = props.onPopoverOpen,
|
51
57
|
onSelectionChange = props.onSelectionChange,
|
52
|
-
|
58
|
+
popoverProps = props.popoverProps,
|
53
59
|
searchProps = props.searchProps,
|
54
60
|
selectedItem = props.selectedItem,
|
55
|
-
popoverProps = props.popoverProps,
|
56
61
|
others = _objectWithoutProperties(props, _excluded);
|
57
62
|
|
58
63
|
var _useState = useState(''),
|
@@ -219,7 +224,8 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
219
224
|
onPress: handlePopoverOpen,
|
220
225
|
ref: triggerRef,
|
221
226
|
variant: "environmentBreadcrumb.current",
|
222
|
-
"aria-label": setAriaLabel(selectedItem)
|
227
|
+
"aria-label": setAriaLabel(selectedItem),
|
228
|
+
"data-id": breadCrumbDataIds.environmentButton
|
223
229
|
}), selectedItem, ___EmotionJSX(Icon, {
|
224
230
|
icon: popoverState.isOpen ? ArrowDropUpIcon : ArrowDropDownIcon
|
225
231
|
})), ___EmotionJSX(PopoverContainer, _extends({}, overlayProps, positionProps, mergeProps(overlayProps, positionProps, popoverProps), {
|
@@ -248,8 +254,9 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
248
254
|
},
|
249
255
|
onChange: setSearchValue
|
250
256
|
}, searchProps)), checkIfListEmpty() ? EmptyListState : ___EmotionJSX(ListBox, {
|
251
|
-
|
252
|
-
"
|
257
|
+
"aria-label": "Items List",
|
258
|
+
"data-id": breadCrumbDataIds.dropdownList,
|
259
|
+
state: listBoxState
|
253
260
|
})))));
|
254
261
|
|
255
262
|
var handleOnAction = useCallback(function (actionKey) {
|
@@ -271,6 +278,7 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
271
278
|
variant: "environmentBreadcrumb.current",
|
272
279
|
"data-testid": "name",
|
273
280
|
"aria-label": name,
|
281
|
+
"data-id": breadCrumbDataIds.orgButton,
|
274
282
|
elementType: "Button"
|
275
283
|
}, ___EmotionJSX(Icon, {
|
276
284
|
icon: HomeIcon,
|
@@ -21,6 +21,7 @@ import { Section } from '@react-stately/collections';
|
|
21
21
|
import { axe } from 'jest-axe';
|
22
22
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
23
23
|
import { EnvironmentBreadcrumb, Item, OverlayProvider } from '../../index';
|
24
|
+
import { breadCrumbDataIds } from './EnvironmentBreadcrumb';
|
24
25
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
25
26
|
var testEnvBreadcrumb = 'test-env-breadcrumb';
|
26
27
|
var testName = 'test-name';
|
@@ -296,4 +297,16 @@ test('should respond to onOpenChange', function () {
|
|
296
297
|
expect(onOpenChange).toHaveBeenNthCalledWith(1, true);
|
297
298
|
userEvent.click(screen.getByText(testSelectedItem));
|
298
299
|
expect(onOpenChange).toHaveBeenNthCalledWith(2, false);
|
300
|
+
});
|
301
|
+
test('should add data-ids to environment button and org button', function () {
|
302
|
+
getComponent();
|
303
|
+
expect(screen.getByText(testSelectedItem)).toHaveAttribute('data-id', breadCrumbDataIds.environmentButton);
|
304
|
+
expect(screen.getByText(testName)).toHaveAttribute('data-id', breadCrumbDataIds.orgButton);
|
305
|
+
});
|
306
|
+
test('should add data-id to dropdown list', function () {
|
307
|
+
getComponent();
|
308
|
+
userEvent.click(screen.getByText(testSelectedItem));
|
309
|
+
expect(screen.getByRole('listbox', {
|
310
|
+
name: 'Items List'
|
311
|
+
})).toHaveAttribute('data-id', breadCrumbDataIds.dropdownList);
|
299
312
|
});
|