@dynatrace/strato-components 0.84.12 → 0.84.21
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/core/components/app-root/AppRoot.css +1 -0
- package/core/components/app-root/AppRoot.js +112 -1
- package/core/components/app-root/AppRoot.sty.js +1 -1
- package/core/components/focus-scope/FocusScope.js +81 -1
- package/core/contexts/FocusContext.js +28 -1
- package/core/hooks/useActiveElement.js +36 -1
- package/core/hooks/useCurrentTheme.js +54 -1
- package/core/hooks/useFocusContext.js +27 -1
- package/core/index.js +45 -1
- package/core/providers/FocusProvider.js +146 -1
- package/core/types/data-props.js +15 -1
- package/core/types/styling-props.js +15 -1
- package/core/types/with-children.js +15 -1
- package/core/utils/focus-management/attempt-focus.js +33 -1
- package/core/utils/focus-management/focus-first-descendant.js +35 -1
- package/core/utils/focus-management/get-first-focusable-child.js +32 -1
- package/core/utils/focus-management/get-last-focusable-child.js +35 -1
- package/core/utils/focus-management/is-focusable.js +39 -1
- package/core/utils/isBrowser.js +25 -1
- package/core/utils/merge-props.js +50 -1
- package/esm/core/components/app-root/AppRoot.css +1 -0
- package/esm/core/components/app-root/AppRoot.js +88 -1
- package/esm/core/components/app-root/AppRoot.js.map +2 -2
- package/esm/core/components/app-root/AppRoot.sty.js +1 -1
- package/esm/core/components/app-root/AppRoot.sty.js.map +1 -1
- package/esm/core/components/focus-scope/FocusScope.js +52 -1
- package/esm/core/components/focus-scope/FocusScope.js.map +2 -2
- package/esm/core/contexts/FocusContext.js +9 -1
- package/esm/core/contexts/FocusContext.js.map +2 -2
- package/esm/core/hooks/useActiveElement.js +17 -1
- package/esm/core/hooks/useActiveElement.js.map +2 -2
- package/esm/core/hooks/useCurrentTheme.js +35 -1
- package/esm/core/hooks/useCurrentTheme.js.map +2 -2
- package/esm/core/hooks/useFocusContext.js +10 -1
- package/esm/core/hooks/useFocusContext.js.map +2 -2
- package/esm/core/index.js +32 -1
- package/esm/core/index.js.map +2 -2
- package/esm/core/providers/FocusProvider.js +117 -1
- package/esm/core/providers/FocusProvider.js.map +2 -2
- package/esm/core/utils/focus-management/attempt-focus.js +14 -1
- package/esm/core/utils/focus-management/attempt-focus.js.map +2 -2
- package/esm/core/utils/focus-management/focus-first-descendant.js +16 -1
- package/esm/core/utils/focus-management/focus-first-descendant.js.map +2 -2
- package/esm/core/utils/focus-management/get-first-focusable-child.js +13 -1
- package/esm/core/utils/focus-management/get-first-focusable-child.js.map +2 -2
- package/esm/core/utils/focus-management/get-last-focusable-child.js +16 -1
- package/esm/core/utils/focus-management/get-last-focusable-child.js.map +2 -2
- package/esm/core/utils/focus-management/is-focusable.js +20 -1
- package/esm/core/utils/focus-management/is-focusable.js.map +2 -2
- package/esm/core/utils/isBrowser.js +6 -1
- package/esm/core/utils/isBrowser.js.map +2 -2
- package/esm/core/utils/merge-props.js +31 -1
- package/esm/core/utils/merge-props.js.map +2 -2
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/index.js +17 -1
- package/package.json +1 -1
- package/testing/custom-render.js +62 -1
- package/testing/index.js +91 -1
- package/testing/mocks/bounding-client-rect-mock.js +36 -1
- package/testing/mocks/canvas-mock.js +187 -1
- package/testing/mocks/create-mock-element.js +99 -1
- package/testing/mocks/create-range-mock.js +47 -1
- package/testing/mocks/dom-rect-mock.js +56 -1
- package/testing/mocks/fetch-mock.js +38 -1
- package/testing/mocks/intersection-observer-mock.js +58 -1
- package/testing/mocks/match-media-mock.js +45 -1
- package/testing/mocks/offset-height-mock.js +39 -1
- package/testing/mocks/offset-width-mock.js +39 -1
- package/testing/mocks/pointer-event-mock.js +42 -1
- package/testing/mocks/resize-observer-mock.js +42 -1
- package/testing/mocks/screen-size-mock.js +34 -1
- package/testing/mocks/scroll-into-view-mock.js +34 -1
- package/testing/mocks/scroll-width-mock.js +39 -1
- package/testing/mocks/select-mock.js +45 -1
- package/testing/mocks/table-virtualization-mock.js +47 -1
- package/testing/mocks/text-ellipsis-mock.js +38 -1
- package/testing/setup.js +57 -1
package/testing/index.js
CHANGED
|
@@ -1 +1,91 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var testing_exports = {};
|
|
30
|
+
__export(testing_exports, {
|
|
31
|
+
PointerEventsCheckLevel: () => import_user_event.PointerEventsCheckLevel,
|
|
32
|
+
_setupSelectMocks: () => import_select_mock._setupSelectMocks,
|
|
33
|
+
clear: () => import_setup.clear,
|
|
34
|
+
clearCanvasMeasureTextMock: () => import_canvas_mock.clearCanvasMeasureTextMock,
|
|
35
|
+
clearCreateRangeMock: () => import_create_range_mock.clearCreateRangeMock,
|
|
36
|
+
clearDomRectMock: () => import_dom_rect_mock.clearDomRectMock,
|
|
37
|
+
clearFetchMock: () => import_fetch_mock.clearFetchMock,
|
|
38
|
+
clearGetBoundingClientRectMock: () => import_bounding_client_rect_mock.clearGetBoundingClientRectMock,
|
|
39
|
+
clearIntersectionObserverMock: () => import_intersection_observer_mock.clearIntersectionObserverMock,
|
|
40
|
+
clearMatchMediaMock: () => import_match_media_mock.clearMatchMediaMock,
|
|
41
|
+
clearOffsetHeightMock: () => import_offset_height_mock.clearOffsetHeightMock,
|
|
42
|
+
clearOffsetWidthMock: () => import_offset_width_mock.clearOffsetWidthMock,
|
|
43
|
+
clearPointerEventMock: () => import_pointer_event_mock.clearPointerEventMock,
|
|
44
|
+
clearResizeObserverMock: () => import_resize_observer_mock.clearResizeObserverMock,
|
|
45
|
+
clearScreenSizeMock: () => import_screen_size_mock.clearScreenSizeMock,
|
|
46
|
+
clearScrollIntoViewMock: () => import_scroll_into_view_mock.clearScrollIntoViewMock,
|
|
47
|
+
clearScrollWidthMock: () => import_scroll_width_mock.clearScrollWidthMock,
|
|
48
|
+
clearTableVirtualizationMock: () => import_table_virtualization_mock.clearTableVirtualizationMock,
|
|
49
|
+
clearTextEllipsisMock: () => import_text_ellipsis_mock.clearTextEllipsisMock,
|
|
50
|
+
createMockElement: () => import_create_mock_element.createMockElement,
|
|
51
|
+
setup: () => import_setup.setup,
|
|
52
|
+
setupCanvasMeasureTextMock: () => import_canvas_mock.setupCanvasMeasureTextMock,
|
|
53
|
+
setupCreateRangeMock: () => import_create_range_mock.setupCreateRangeMock,
|
|
54
|
+
setupDomRectMock: () => import_dom_rect_mock.setupDomRectMock,
|
|
55
|
+
setupFetchMock: () => import_fetch_mock.setupFetchMock,
|
|
56
|
+
setupGetBoundingClientRectMock: () => import_bounding_client_rect_mock.setupGetBoundingClientRectMock,
|
|
57
|
+
setupIntersectionObserverMock: () => import_intersection_observer_mock.setupIntersectionObserverMock,
|
|
58
|
+
setupMatchMediaMock: () => import_match_media_mock.setupMatchMediaMock,
|
|
59
|
+
setupOffsetHeightMock: () => import_offset_height_mock.setupOffsetHeightMock,
|
|
60
|
+
setupOffsetWidthMock: () => import_offset_width_mock.setupOffsetWidthMock,
|
|
61
|
+
setupPointerEventMock: () => import_pointer_event_mock.setupPointerEventMock,
|
|
62
|
+
setupResizeObserverMock: () => import_resize_observer_mock.setupResizeObserverMock,
|
|
63
|
+
setupScreenSizeMock: () => import_screen_size_mock.setupScreenSizeMock,
|
|
64
|
+
setupScrollIntoViewMock: () => import_scroll_into_view_mock.setupScrollIntoViewMock,
|
|
65
|
+
setupScrollWidthMock: () => import_scroll_width_mock.setupScrollWidthMock,
|
|
66
|
+
setupTableVirtualizationMock: () => import_table_virtualization_mock.setupTableVirtualizationMock,
|
|
67
|
+
setupTextEllipsisMock: () => import_text_ellipsis_mock.setupTextEllipsisMock,
|
|
68
|
+
userEvent: () => import_user_event.default
|
|
69
|
+
});
|
|
70
|
+
module.exports = __toCommonJS(testing_exports);
|
|
71
|
+
var import_user_event = __toESM(require("@testing-library/user-event"));
|
|
72
|
+
__reExport(testing_exports, require("./custom-render.js"), module.exports);
|
|
73
|
+
var import_bounding_client_rect_mock = require("./mocks/bounding-client-rect-mock.js");
|
|
74
|
+
var import_create_mock_element = require("./mocks/create-mock-element.js");
|
|
75
|
+
var import_canvas_mock = require("./mocks/canvas-mock.js");
|
|
76
|
+
var import_resize_observer_mock = require("./mocks/resize-observer-mock.js");
|
|
77
|
+
var import_select_mock = require("./mocks/select-mock.js");
|
|
78
|
+
var import_offset_width_mock = require("./mocks/offset-width-mock.js");
|
|
79
|
+
var import_offset_height_mock = require("./mocks/offset-height-mock.js");
|
|
80
|
+
var import_dom_rect_mock = require("./mocks/dom-rect-mock.js");
|
|
81
|
+
var import_match_media_mock = require("./mocks/match-media-mock.js");
|
|
82
|
+
var import_pointer_event_mock = require("./mocks/pointer-event-mock.js");
|
|
83
|
+
var import_intersection_observer_mock = require("./mocks/intersection-observer-mock.js");
|
|
84
|
+
var import_create_range_mock = require("./mocks/create-range-mock.js");
|
|
85
|
+
var import_screen_size_mock = require("./mocks/screen-size-mock.js");
|
|
86
|
+
var import_scroll_into_view_mock = require("./mocks/scroll-into-view-mock.js");
|
|
87
|
+
var import_scroll_width_mock = require("./mocks/scroll-width-mock.js");
|
|
88
|
+
var import_fetch_mock = require("./mocks/fetch-mock.js");
|
|
89
|
+
var import_table_virtualization_mock = require("./mocks/table-virtualization-mock.js");
|
|
90
|
+
var import_text_ellipsis_mock = require("./mocks/text-ellipsis-mock.js");
|
|
91
|
+
var import_setup = require("./setup.js");
|
|
@@ -1 +1,36 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var bounding_client_rect_mock_exports = {};
|
|
19
|
+
__export(bounding_client_rect_mock_exports, {
|
|
20
|
+
clearGetBoundingClientRectMock: () => clearGetBoundingClientRectMock,
|
|
21
|
+
setupGetBoundingClientRectMock: () => setupGetBoundingClientRectMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(bounding_client_rect_mock_exports);
|
|
24
|
+
var import_dom_rect_mock = require("./dom-rect-mock.js");
|
|
25
|
+
const pristineGetBoundingClientRect = Element.prototype.getBoundingClientRect;
|
|
26
|
+
function setupGetBoundingClientRectMock(widthOrMockFn, height, x, y, top, right, bottom, left) {
|
|
27
|
+
Object.defineProperty(Element.prototype, "getBoundingClientRect", {
|
|
28
|
+
writable: true,
|
|
29
|
+
value: typeof widthOrMockFn === "number" ? () => (0, import_dom_rect_mock.createDOMRect)(widthOrMockFn, height, x, y, top, right, bottom, left) : function getBoundingClientRectMock() {
|
|
30
|
+
return widthOrMockFn.call(this) ?? import_dom_rect_mock.FALLBACK_DOM_RECT;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function clearGetBoundingClientRectMock() {
|
|
35
|
+
Element.prototype.getBoundingClientRect = pristineGetBoundingClientRect;
|
|
36
|
+
}
|
|
@@ -1 +1,187 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var canvas_mock_exports = {};
|
|
19
|
+
__export(canvas_mock_exports, {
|
|
20
|
+
clearCanvasMeasureTextMock: () => clearCanvasMeasureTextMock,
|
|
21
|
+
setupCanvasMeasureTextMock: () => setupCanvasMeasureTextMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(canvas_mock_exports);
|
|
24
|
+
const AVG_CHARACTER_WIDTH = 8;
|
|
25
|
+
const TEXT_WIDTH_MAPPINGS = {
|
|
26
|
+
"\u2026": 11,
|
|
27
|
+
"0": 9,
|
|
28
|
+
"1": 7,
|
|
29
|
+
"2": 9,
|
|
30
|
+
"3": 8,
|
|
31
|
+
"4": 9,
|
|
32
|
+
"5": 10,
|
|
33
|
+
"6": 10,
|
|
34
|
+
"7": 9,
|
|
35
|
+
"8": 9,
|
|
36
|
+
"9": 8,
|
|
37
|
+
" ": 0,
|
|
38
|
+
"!": 4,
|
|
39
|
+
'"': 6,
|
|
40
|
+
"#": 10,
|
|
41
|
+
$: 9,
|
|
42
|
+
"%": 12,
|
|
43
|
+
"&": 10,
|
|
44
|
+
"'": 2,
|
|
45
|
+
"(": 7,
|
|
46
|
+
")": 5,
|
|
47
|
+
"*": 7,
|
|
48
|
+
"+": 9,
|
|
49
|
+
",": 3,
|
|
50
|
+
"-": 5,
|
|
51
|
+
".": 4,
|
|
52
|
+
"/": 7,
|
|
53
|
+
":": 4,
|
|
54
|
+
";": 3,
|
|
55
|
+
"<": 7,
|
|
56
|
+
"=": 9,
|
|
57
|
+
">": 9,
|
|
58
|
+
"?": 7,
|
|
59
|
+
"@": 14,
|
|
60
|
+
A: 11,
|
|
61
|
+
B: 11,
|
|
62
|
+
C: 10,
|
|
63
|
+
D: 11,
|
|
64
|
+
E: 10,
|
|
65
|
+
F: 10,
|
|
66
|
+
G: 10,
|
|
67
|
+
H: 12,
|
|
68
|
+
I: 4,
|
|
69
|
+
J: 8,
|
|
70
|
+
K: 12,
|
|
71
|
+
L: 10,
|
|
72
|
+
M: 14,
|
|
73
|
+
N: 12,
|
|
74
|
+
O: 11,
|
|
75
|
+
P: 11,
|
|
76
|
+
Q: 11,
|
|
77
|
+
R: 11,
|
|
78
|
+
S: 9,
|
|
79
|
+
T: 10,
|
|
80
|
+
U: 11,
|
|
81
|
+
V: 10,
|
|
82
|
+
W: 14,
|
|
83
|
+
X: 10,
|
|
84
|
+
Y: 10,
|
|
85
|
+
Z: 9,
|
|
86
|
+
"[": 6,
|
|
87
|
+
"\\": 7,
|
|
88
|
+
"]": 4,
|
|
89
|
+
"^": 7,
|
|
90
|
+
_: 8,
|
|
91
|
+
"`": 4,
|
|
92
|
+
a: 8,
|
|
93
|
+
b: 10,
|
|
94
|
+
c: 8,
|
|
95
|
+
d: 8,
|
|
96
|
+
e: 8,
|
|
97
|
+
f: 6,
|
|
98
|
+
g: 8,
|
|
99
|
+
h: 9,
|
|
100
|
+
i: 4,
|
|
101
|
+
j: 4,
|
|
102
|
+
k: 10,
|
|
103
|
+
l: 4,
|
|
104
|
+
m: 14,
|
|
105
|
+
n: 9,
|
|
106
|
+
o: 9,
|
|
107
|
+
p: 10,
|
|
108
|
+
q: 8,
|
|
109
|
+
r: 7,
|
|
110
|
+
s: 8,
|
|
111
|
+
t: 5,
|
|
112
|
+
u: 9,
|
|
113
|
+
v: 8,
|
|
114
|
+
w: 12,
|
|
115
|
+
x: 8,
|
|
116
|
+
y: 8,
|
|
117
|
+
z: 8,
|
|
118
|
+
"{": 6,
|
|
119
|
+
"|": 4,
|
|
120
|
+
"}": 5,
|
|
121
|
+
"~": 11
|
|
122
|
+
};
|
|
123
|
+
function getCharWidth(character) {
|
|
124
|
+
return TEXT_WIDTH_MAPPINGS[character] ?? AVG_CHARACTER_WIDTH;
|
|
125
|
+
}
|
|
126
|
+
const pristineGetContext = HTMLCanvasElement.prototype.getContext;
|
|
127
|
+
function setupCanvasMeasureTextMock(mockTextWidth) {
|
|
128
|
+
Object.defineProperty(HTMLCanvasElement.prototype, "getContext", {
|
|
129
|
+
writable: true,
|
|
130
|
+
value: () => ({
|
|
131
|
+
measureText: (text) => {
|
|
132
|
+
const charWidth = mockTextWidth !== void 0 ? mockTextWidth : [...text].reduce((prev, curr) => prev + getCharWidth(curr), 0);
|
|
133
|
+
return {
|
|
134
|
+
width: charWidth,
|
|
135
|
+
actualBoundingBoxLeft: 0,
|
|
136
|
+
actualBoundingBoxRight: charWidth,
|
|
137
|
+
fontBoundingBoxAscent: 0,
|
|
138
|
+
fontBoundingBoxDescent: 0,
|
|
139
|
+
actualBoundingBoxAscent: 0,
|
|
140
|
+
actualBoundingBoxDescent: 0
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
scale: () => {
|
|
144
|
+
return null;
|
|
145
|
+
},
|
|
146
|
+
clearRect: () => {
|
|
147
|
+
return null;
|
|
148
|
+
},
|
|
149
|
+
draw: () => {
|
|
150
|
+
return null;
|
|
151
|
+
},
|
|
152
|
+
beginPath: () => {
|
|
153
|
+
return null;
|
|
154
|
+
},
|
|
155
|
+
stroke: () => {
|
|
156
|
+
return null;
|
|
157
|
+
},
|
|
158
|
+
closePath: () => {
|
|
159
|
+
return null;
|
|
160
|
+
},
|
|
161
|
+
moveTo: () => {
|
|
162
|
+
return null;
|
|
163
|
+
},
|
|
164
|
+
lineTo: () => {
|
|
165
|
+
return null;
|
|
166
|
+
},
|
|
167
|
+
arc: () => {
|
|
168
|
+
return null;
|
|
169
|
+
},
|
|
170
|
+
fill: () => {
|
|
171
|
+
return null;
|
|
172
|
+
},
|
|
173
|
+
rect: () => {
|
|
174
|
+
return null;
|
|
175
|
+
},
|
|
176
|
+
save: () => {
|
|
177
|
+
return null;
|
|
178
|
+
},
|
|
179
|
+
restore: () => {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function clearCanvasMeasureTextMock() {
|
|
186
|
+
HTMLCanvasElement.prototype.getContext = pristineGetContext;
|
|
187
|
+
}
|
|
@@ -1 +1,99 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var create_mock_element_exports = {};
|
|
19
|
+
__export(create_mock_element_exports, {
|
|
20
|
+
createMockElement: () => createMockElement
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(create_mock_element_exports);
|
|
23
|
+
function createMockElement(elementOrTag, left, top, width, height) {
|
|
24
|
+
const el = typeof elementOrTag === "string" ? document.createElement(elementOrTag) : elementOrTag;
|
|
25
|
+
Object.assign(el.style, {
|
|
26
|
+
width: `${width}px`,
|
|
27
|
+
height: `${height}px`
|
|
28
|
+
});
|
|
29
|
+
el.getBoundingClientRect = () => ({
|
|
30
|
+
x: left,
|
|
31
|
+
y: top,
|
|
32
|
+
width,
|
|
33
|
+
height,
|
|
34
|
+
top,
|
|
35
|
+
left,
|
|
36
|
+
right: width + left,
|
|
37
|
+
bottom: height + top,
|
|
38
|
+
toJSON: () => null
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperties(el, {
|
|
41
|
+
offsetWidth: {
|
|
42
|
+
get() {
|
|
43
|
+
return parseFloat(this.style.width) || 0;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
offsetHeight: {
|
|
47
|
+
get() {
|
|
48
|
+
return parseFloat(this.style.height) || 0;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
offsetTop: {
|
|
52
|
+
get() {
|
|
53
|
+
return parseFloat(this.style.marginTop) || 0;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
offsetLeft: {
|
|
57
|
+
get() {
|
|
58
|
+
return parseFloat(this.style.marginLeft) || 0;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
clientWidth: {
|
|
62
|
+
configurable: true,
|
|
63
|
+
get: function() {
|
|
64
|
+
return this._jsdomMockClientWidth || this._clientWidth || 0;
|
|
65
|
+
},
|
|
66
|
+
set(val) {
|
|
67
|
+
this._clientWidth = val;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
clientHeight: {
|
|
71
|
+
configurable: true,
|
|
72
|
+
get: function() {
|
|
73
|
+
return this._jsdomMockClientHight || this._clientHeight || 0;
|
|
74
|
+
},
|
|
75
|
+
set(val) {
|
|
76
|
+
this._clientHeight = val;
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
scrollWidth: {
|
|
80
|
+
configurable: true,
|
|
81
|
+
get: function() {
|
|
82
|
+
return this._scrollWidth || 0;
|
|
83
|
+
},
|
|
84
|
+
set(val) {
|
|
85
|
+
this._scrollWidth = val;
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
scrollHeight: {
|
|
89
|
+
configurable: true,
|
|
90
|
+
get: function() {
|
|
91
|
+
return this._scrollHeight || 0;
|
|
92
|
+
},
|
|
93
|
+
set(val) {
|
|
94
|
+
this._scrollHeight = val;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return el;
|
|
99
|
+
}
|
|
@@ -1 +1,47 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var create_range_mock_exports = {};
|
|
19
|
+
__export(create_range_mock_exports, {
|
|
20
|
+
clearCreateRangeMock: () => clearCreateRangeMock,
|
|
21
|
+
setupCreateRangeMock: () => setupCreateRangeMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(create_range_mock_exports);
|
|
24
|
+
var import_globals = require("@jest/globals");
|
|
25
|
+
const pristineCreateRange = global.document.createRange;
|
|
26
|
+
function setupCreateRangeMock() {
|
|
27
|
+
Object.defineProperty(global.document, "createRange", {
|
|
28
|
+
writable: true,
|
|
29
|
+
value: () => {
|
|
30
|
+
const range = new Range();
|
|
31
|
+
range.getBoundingClientRect = import_globals.jest.fn();
|
|
32
|
+
range.getClientRects = () => {
|
|
33
|
+
return {
|
|
34
|
+
item: () => null,
|
|
35
|
+
length: 0,
|
|
36
|
+
[Symbol.iterator]: {
|
|
37
|
+
next: () => ({ done: true })
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
return range;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function clearCreateRangeMock() {
|
|
46
|
+
global.document.createRange = pristineCreateRange;
|
|
47
|
+
}
|
|
@@ -1 +1,56 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var dom_rect_mock_exports = {};
|
|
19
|
+
__export(dom_rect_mock_exports, {
|
|
20
|
+
FALLBACK_DOM_RECT: () => FALLBACK_DOM_RECT,
|
|
21
|
+
clearDomRectMock: () => clearDomRectMock,
|
|
22
|
+
createDOMRect: () => createDOMRect,
|
|
23
|
+
setupDomRectMock: () => setupDomRectMock
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(dom_rect_mock_exports);
|
|
26
|
+
function createDOMRect(width, height, x, y, top, right, bottom, left) {
|
|
27
|
+
return {
|
|
28
|
+
width,
|
|
29
|
+
height: height ?? 0,
|
|
30
|
+
x: x ?? 0,
|
|
31
|
+
y: y ?? 0,
|
|
32
|
+
top: top ?? 0,
|
|
33
|
+
right: right ?? 0,
|
|
34
|
+
bottom: bottom ?? 0,
|
|
35
|
+
left: left ?? 0,
|
|
36
|
+
toJSON: function() {
|
|
37
|
+
const { toJSON, ...remainingProps } = this;
|
|
38
|
+
return remainingProps;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const FALLBACK_DOM_RECT = Object.freeze(createDOMRect(0));
|
|
43
|
+
const prisitineDomRect = window.DOMRect;
|
|
44
|
+
function setupDomRectMock(mockDomRect = FALLBACK_DOM_RECT) {
|
|
45
|
+
Object.defineProperties(window, {
|
|
46
|
+
DOMRect: {
|
|
47
|
+
writable: true,
|
|
48
|
+
value: {
|
|
49
|
+
fromRect: () => mockDomRect
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function clearDomRectMock() {
|
|
55
|
+
window.DOMRect = prisitineDomRect;
|
|
56
|
+
}
|
|
@@ -1 +1,38 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var fetch_mock_exports = {};
|
|
19
|
+
__export(fetch_mock_exports, {
|
|
20
|
+
clearFetchMock: () => clearFetchMock,
|
|
21
|
+
setupFetchMock: () => setupFetchMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(fetch_mock_exports);
|
|
24
|
+
var import_globals = require("@jest/globals");
|
|
25
|
+
const pristineFetch = global.fetch;
|
|
26
|
+
function setupFetchMock(mockedValue = {
|
|
27
|
+
ok: true,
|
|
28
|
+
status: 200,
|
|
29
|
+
json: () => {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
}) {
|
|
33
|
+
const mockedFetchPromise = Promise.resolve(mockedValue);
|
|
34
|
+
global.fetch = import_globals.jest.fn(() => mockedFetchPromise);
|
|
35
|
+
}
|
|
36
|
+
function clearFetchMock() {
|
|
37
|
+
global.fetch = pristineFetch;
|
|
38
|
+
}
|
|
@@ -1 +1,58 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var intersection_observer_mock_exports = {};
|
|
19
|
+
__export(intersection_observer_mock_exports, {
|
|
20
|
+
clearIntersectionObserverMock: () => clearIntersectionObserverMock,
|
|
21
|
+
setupIntersectionObserverMock: () => setupIntersectionObserverMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(intersection_observer_mock_exports);
|
|
24
|
+
var import_globals = require("@jest/globals");
|
|
25
|
+
const pristineIntersectionObserver = window.IntersectionObserver;
|
|
26
|
+
function setupIntersectionObserverMock(entries = [
|
|
27
|
+
{
|
|
28
|
+
isIntersecting: true,
|
|
29
|
+
intersectionRatio: 1
|
|
30
|
+
}
|
|
31
|
+
]) {
|
|
32
|
+
class MockIntersectionObserver {
|
|
33
|
+
root = null;
|
|
34
|
+
rootMargin = "";
|
|
35
|
+
thresholds = [];
|
|
36
|
+
callback;
|
|
37
|
+
/**
|
|
38
|
+
* Mock constructor
|
|
39
|
+
* @param callback - callback function
|
|
40
|
+
* @param options - options
|
|
41
|
+
*/
|
|
42
|
+
constructor(callback, options) {
|
|
43
|
+
this.callback = callback;
|
|
44
|
+
}
|
|
45
|
+
disconnect = import_globals.jest.fn();
|
|
46
|
+
observe = import_globals.jest.fn(() => this.callback(entries));
|
|
47
|
+
takeRecords = import_globals.jest.fn();
|
|
48
|
+
unobserve = import_globals.jest.fn();
|
|
49
|
+
}
|
|
50
|
+
Object.defineProperty(global, "IntersectionObserver", {
|
|
51
|
+
writable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
value: MockIntersectionObserver
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function clearIntersectionObserverMock() {
|
|
57
|
+
global.IntersectionObserver = pristineIntersectionObserver;
|
|
58
|
+
}
|