@pingux/astro 2.177.0 → 2.177.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/lib/cjs/components/TimeZonePicker/TimeZonePicker.test.js +39 -30
- package/lib/cjs/components/TooltipTrigger/TooltipTrigger.js +4 -1
- package/lib/cjs/libs/astro/tsconfig.lib.tsbuildinfo +1 -1
- package/lib/components/TimeZonePicker/TimeZonePicker.test.js +39 -30
- package/lib/components/TooltipTrigger/TooltipTrigger.js +4 -1
- package/package.json +1 -2
|
@@ -9,14 +9,23 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
|
9
9
|
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
|
10
10
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
|
11
11
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
12
|
-
|
|
12
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
13
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof _Symbol ? _Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return _Object$defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = _Object$create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = _Object$getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(l); function g(t) { var _context6; _forEachInstanceProperty(_context6 = ["next", "throw", "return"]).call(_context6, function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], _forEachInstanceProperty(t).call(t, w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = _Object$create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = _Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { var _context7; if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, _forEachInstanceProperty(_context7 = this.tryEntries).call(_context7, m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+_sliceInstanceProperty(e).call(e, 1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
|
|
13
14
|
import React from 'react';
|
|
14
15
|
import userEvent from '@testing-library/user-event';
|
|
15
|
-
import exp from 'constants';
|
|
16
16
|
import { OverlayProvider, TimeZonePicker } from '../../index';
|
|
17
17
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
|
18
18
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
|
19
|
+
import { getGmtAndOffset } from './helper';
|
|
19
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
21
|
+
jest.mock('./helper', function () {
|
|
22
|
+
return {
|
|
23
|
+
getGmtAndOffset: jest.fn().mockReturnValue({
|
|
24
|
+
gmt: 'GMT-00:00',
|
|
25
|
+
numericOffset: 0
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
});
|
|
20
29
|
var testTimeZoneJuba = 'Africa/Juba';
|
|
21
30
|
var testTimeZoneApia = 'Pacific/Apia';
|
|
22
31
|
var defaultProps = {
|
|
@@ -51,16 +60,20 @@ afterEach(function () {
|
|
|
51
60
|
afterAll(function () {
|
|
52
61
|
jest.restoreAllMocks();
|
|
53
62
|
});
|
|
63
|
+
|
|
64
|
+
// Needs to be added to each components test file
|
|
65
|
+
universalComponentTests({
|
|
66
|
+
renderComponent: function renderComponent(props) {
|
|
67
|
+
return ___EmotionJSX(TimeZonePicker, _extends({}, defaultProps, props));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
54
70
|
test('renders ComboBoxField component', function () {
|
|
55
71
|
getComponent();
|
|
56
|
-
var input = screen.
|
|
72
|
+
var input = screen.getByRole('combobox');
|
|
57
73
|
var label = screen.getByText(defaultProps.label);
|
|
58
|
-
var button = screen.
|
|
59
|
-
expect(input).toBeInTheDocument();
|
|
74
|
+
var button = screen.getByRole('button');
|
|
60
75
|
expect(screen.queryAllByLabelText(defaultProps.label)).toEqual([input, button]);
|
|
61
|
-
expect(label).toBeInTheDocument();
|
|
62
76
|
expect(label).toHaveTextContent(defaultProps.label);
|
|
63
|
-
expect(button).toBeInTheDocument();
|
|
64
77
|
});
|
|
65
78
|
test('search is working correctly', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
66
79
|
var input;
|
|
@@ -68,7 +81,7 @@ test('search is working correctly', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
|
68
81
|
while (1) switch (_context.prev = _context.next) {
|
|
69
82
|
case 0:
|
|
70
83
|
getComponent();
|
|
71
|
-
input = screen.
|
|
84
|
+
input = screen.getByRole('combobox');
|
|
72
85
|
_context.next = 4;
|
|
73
86
|
return userEvent.type(input, testTimeZoneApia);
|
|
74
87
|
case 4:
|
|
@@ -89,7 +102,7 @@ test('custom timezone can be added', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*
|
|
|
89
102
|
'(GMT+02:00) Africa/Juba': testTimeZoneJuba
|
|
90
103
|
}
|
|
91
104
|
});
|
|
92
|
-
input = screen.
|
|
105
|
+
input = screen.getByRole('combobox');
|
|
93
106
|
_context2.next = 4;
|
|
94
107
|
return userEvent.type(input, testTimeZoneJuba);
|
|
95
108
|
case 4:
|
|
@@ -109,7 +122,7 @@ test('shows custom empty search state text when no items are found', /*#__PURE__
|
|
|
109
122
|
getComponent({
|
|
110
123
|
emptySearchText: testEmptyText
|
|
111
124
|
});
|
|
112
|
-
input = screen.
|
|
125
|
+
input = screen.getByRole('combobox');
|
|
113
126
|
_context3.next = 5;
|
|
114
127
|
return userEvent.type(input, 'awdasrf213');
|
|
115
128
|
case 5:
|
|
@@ -120,34 +133,30 @@ test('shows custom empty search state text when no items are found', /*#__PURE__
|
|
|
120
133
|
}
|
|
121
134
|
}, _callee3);
|
|
122
135
|
})));
|
|
123
|
-
|
|
124
|
-
// Needs to be added to each components test file
|
|
125
|
-
universalComponentTests({
|
|
126
|
-
renderComponent: function renderComponent(props) {
|
|
127
|
-
return ___EmotionJSX(TimeZonePicker, _extends({}, defaultProps, props));
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
136
|
test('selecting a timezone updates the input value', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
131
|
-
var input, option;
|
|
137
|
+
var timezone, gmtAndOffset, expectedOptionText, input, option;
|
|
132
138
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
139
|
+
var _context5;
|
|
133
140
|
while (1) switch (_context4.prev = _context4.next) {
|
|
134
141
|
case 0:
|
|
142
|
+
timezone = 'America/New York';
|
|
143
|
+
gmtAndOffset = getGmtAndOffset(timezone);
|
|
144
|
+
expectedOptionText = _concatInstanceProperty(_context5 = "".concat(timezone, " ")).call(_context5, gmtAndOffset.gmt);
|
|
135
145
|
getComponent();
|
|
136
|
-
input = screen.
|
|
137
|
-
_context4.next =
|
|
138
|
-
return userEvent.type(input,
|
|
139
|
-
case
|
|
140
|
-
expect(input).toHaveValue(
|
|
141
|
-
expect(screen.
|
|
146
|
+
input = screen.getByRole('combobox');
|
|
147
|
+
_context4.next = 7;
|
|
148
|
+
return userEvent.type(input, timezone);
|
|
149
|
+
case 7:
|
|
150
|
+
expect(input).toHaveValue(timezone);
|
|
151
|
+
expect(screen.getByRole('listbox')).toBeInTheDocument();
|
|
142
152
|
option = screen.getByRole('option', {
|
|
143
|
-
key:
|
|
153
|
+
key: expectedOptionText
|
|
144
154
|
});
|
|
145
|
-
|
|
146
|
-
_context4.next = 10;
|
|
155
|
+
_context4.next = 12;
|
|
147
156
|
return userEvent.click(option);
|
|
148
|
-
case
|
|
149
|
-
expect(input).toHaveValue(
|
|
150
|
-
case
|
|
157
|
+
case 12:
|
|
158
|
+
expect(input).toHaveValue(expectedOptionText);
|
|
159
|
+
case 13:
|
|
151
160
|
case "end":
|
|
152
161
|
return _context4.stop();
|
|
153
162
|
}
|
|
@@ -38,6 +38,9 @@ var TooltipTrigger = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
38
38
|
var tooltipTriggerRef = useRef(null);
|
|
39
39
|
var overlayRef = useRef(null);
|
|
40
40
|
var tooltipRef = targetRef || tooltipTriggerRef;
|
|
41
|
+
var triggerElement = /*#__PURE__*/React.isValidElement(trigger) ? /*#__PURE__*/React.cloneElement(trigger, {
|
|
42
|
+
ref: tooltipRef
|
|
43
|
+
}) : trigger;
|
|
41
44
|
usePropWarning(props, 'disabled', 'isDisabled');
|
|
42
45
|
/* istanbul ignore next */
|
|
43
46
|
useImperativeHandle(ref, function () {
|
|
@@ -92,7 +95,7 @@ var TooltipTrigger = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
92
95
|
}, tooltipProps, positionProps), tooltip);
|
|
93
96
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(PressResponder, _extends({}, triggerProps, {
|
|
94
97
|
ref: tooltipTriggerRef
|
|
95
|
-
}),
|
|
98
|
+
}), triggerElement), ___EmotionJSX(TooltipContext.Provider, {
|
|
96
99
|
value: state
|
|
97
100
|
}, overlay));
|
|
98
101
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pingux/astro",
|
|
3
|
-
"version": "2.177.0",
|
|
3
|
+
"version": "2.177.2-alpha.0",
|
|
4
4
|
"description": "React component library for Ping Identity's design system",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"@material-symbols/font-400": "^0.40.2",
|
|
47
47
|
"@mdx-js/react": "^2.0.0",
|
|
48
48
|
"@monaco-editor/react": "4.4.2",
|
|
49
|
-
"@nx/vite": "20.0.5",
|
|
50
49
|
"@pingux/mdi-react": "^1.2.0",
|
|
51
50
|
"@pingux/onyx-tokens": "^0.18.0",
|
|
52
51
|
"@react-aria/accordion": "~3.0.0-alpha.11",
|