@dynatrace/strato-components 0.84.12 → 0.84.31
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.d.ts +8 -3
- package/core/components/app-root/AppRoot.js +116 -1
- package/core/components/app-root/AppRoot.sty.js +1 -1
- package/core/components/focus-scope/FocusScope.js +81 -1
- package/core/contexts/FocusContext.d.ts +1 -1
- package/core/contexts/FocusContext.js +28 -1
- package/core/hooks/useActiveElement.js +36 -1
- package/core/hooks/useCurrentTheme.d.ts +4 -1
- package/core/hooks/useCurrentTheme.js +54 -1
- package/core/hooks/useFocusContext.js +27 -1
- package/core/index.d.ts +1 -0
- package/core/index.js +45 -1
- package/core/providers/FocusProvider.js +146 -1
- package/core/types/data-props.d.ts +1 -0
- package/core/types/data-props.js +15 -1
- package/core/types/masking-props.d.ts +9 -0
- package/core/types/masking-props.js +15 -0
- package/core/types/styling-props.d.ts +3 -2
- package/core/types/styling-props.js +15 -1
- package/core/types/with-children.d.ts +4 -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 +92 -1
- package/esm/core/components/app-root/AppRoot.js.map +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- package/esm/core/providers/FocusProvider.js +117 -1
- package/esm/core/providers/FocusProvider.js.map +2 -2
- package/esm/core/types/masking-props.js +1 -0
- package/esm/core/types/masking-props.js.map +7 -0
- 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 +2 -2
- package/testing/custom-render.d.ts +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.d.ts +1 -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
|
@@ -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
|
+
}
|
|
@@ -1 +1,45 @@
|
|
|
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 match_media_mock_exports = {};
|
|
19
|
+
__export(match_media_mock_exports, {
|
|
20
|
+
clearMatchMediaMock: () => clearMatchMediaMock,
|
|
21
|
+
setupMatchMediaMock: () => setupMatchMediaMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(match_media_mock_exports);
|
|
24
|
+
var import_globals = require("@jest/globals");
|
|
25
|
+
const prisitineMatchMedia = window.matchMedia;
|
|
26
|
+
function setupMatchMediaMock(isMatching = false) {
|
|
27
|
+
Object.defineProperty(window, "matchMedia", {
|
|
28
|
+
writable: true,
|
|
29
|
+
value: import_globals.jest.fn().mockImplementation((query) => ({
|
|
30
|
+
matches: isMatching,
|
|
31
|
+
media: query,
|
|
32
|
+
onchange: null,
|
|
33
|
+
addListener: import_globals.jest.fn(),
|
|
34
|
+
// Deprecated
|
|
35
|
+
removeListener: import_globals.jest.fn(),
|
|
36
|
+
// Deprecated
|
|
37
|
+
addEventListener: import_globals.jest.fn(),
|
|
38
|
+
removeEventListener: import_globals.jest.fn(),
|
|
39
|
+
dispatchEvent: import_globals.jest.fn()
|
|
40
|
+
}))
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function clearMatchMediaMock() {
|
|
44
|
+
window.matchMedia = prisitineMatchMedia;
|
|
45
|
+
}
|
|
@@ -1 +1,39 @@
|
|
|
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 offset_height_mock_exports = {};
|
|
19
|
+
__export(offset_height_mock_exports, {
|
|
20
|
+
clearOffsetHeightMock: () => clearOffsetHeightMock,
|
|
21
|
+
setupOffsetHeightMock: () => setupOffsetHeightMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(offset_height_mock_exports);
|
|
24
|
+
const pristineOffsetHeightDescriptor = Object.getOwnPropertyDescriptor(
|
|
25
|
+
HTMLElement.prototype,
|
|
26
|
+
"offsetHeight"
|
|
27
|
+
);
|
|
28
|
+
function setupOffsetHeightMock(containerHeightOrMockFn) {
|
|
29
|
+
Object.defineProperty(HTMLElement.prototype, "offsetHeight", {
|
|
30
|
+
configurable: true,
|
|
31
|
+
get: typeof containerHeightOrMockFn === "number" ? () => containerHeightOrMockFn : containerHeightOrMockFn
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function clearOffsetHeightMock() {
|
|
35
|
+
Object.defineProperty(HTMLElement.prototype, "offsetHeight", {
|
|
36
|
+
configurable: true,
|
|
37
|
+
get: pristineOffsetHeightDescriptor?.get ?? (() => 0)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -1 +1,39 @@
|
|
|
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 offset_width_mock_exports = {};
|
|
19
|
+
__export(offset_width_mock_exports, {
|
|
20
|
+
clearOffsetWidthMock: () => clearOffsetWidthMock,
|
|
21
|
+
setupOffsetWidthMock: () => setupOffsetWidthMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(offset_width_mock_exports);
|
|
24
|
+
const pristineOffsetWidthDescriptor = Object.getOwnPropertyDescriptor(
|
|
25
|
+
HTMLElement.prototype,
|
|
26
|
+
"offsetWidth"
|
|
27
|
+
);
|
|
28
|
+
function setupOffsetWidthMock(containerWidthOrMockFn) {
|
|
29
|
+
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
30
|
+
configurable: true,
|
|
31
|
+
get: typeof containerWidthOrMockFn === "number" ? () => containerWidthOrMockFn : containerWidthOrMockFn
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function clearOffsetWidthMock() {
|
|
35
|
+
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
36
|
+
configurable: true,
|
|
37
|
+
get: pristineOffsetWidthDescriptor?.get ?? (() => 0)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -1 +1,42 @@
|
|
|
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 pointer_event_mock_exports = {};
|
|
19
|
+
__export(pointer_event_mock_exports, {
|
|
20
|
+
clearPointerEventMock: () => clearPointerEventMock,
|
|
21
|
+
setupPointerEventMock: () => setupPointerEventMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(pointer_event_mock_exports);
|
|
24
|
+
class MockPointerEvent extends Event {
|
|
25
|
+
button;
|
|
26
|
+
ctrlKey;
|
|
27
|
+
pointerType;
|
|
28
|
+
/** Creates a new MockPointerEvent. */
|
|
29
|
+
constructor(type, props) {
|
|
30
|
+
super(type, props);
|
|
31
|
+
this.button = props.button || 0;
|
|
32
|
+
this.ctrlKey = props.ctrlKey || false;
|
|
33
|
+
this.pointerType = props.pointerType || "mouse";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const pristinePointerEvent = global.PointerEvent;
|
|
37
|
+
function setupPointerEventMock() {
|
|
38
|
+
global.PointerEvent = MockPointerEvent;
|
|
39
|
+
}
|
|
40
|
+
function clearPointerEventMock() {
|
|
41
|
+
global.PointerEvent = pristinePointerEvent;
|
|
42
|
+
}
|
|
@@ -1 +1,42 @@
|
|
|
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 resize_observer_mock_exports = {};
|
|
19
|
+
__export(resize_observer_mock_exports, {
|
|
20
|
+
clearResizeObserverMock: () => clearResizeObserverMock,
|
|
21
|
+
setupResizeObserverMock: () => setupResizeObserverMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(resize_observer_mock_exports);
|
|
24
|
+
var import_globals = require("@jest/globals");
|
|
25
|
+
const pristineResizeObserver = window.ResizeObserver;
|
|
26
|
+
function setupResizeObserverMock(mockedObserveCallbackValue) {
|
|
27
|
+
Object.defineProperty(window, "ResizeObserver", {
|
|
28
|
+
writable: true,
|
|
29
|
+
value: import_globals.jest.fn(
|
|
30
|
+
(callback) => ({
|
|
31
|
+
observe: mockedObserveCallbackValue ? import_globals.jest.fn().mockImplementation(() => {
|
|
32
|
+
callback(mockedObserveCallbackValue);
|
|
33
|
+
}) : import_globals.jest.fn(),
|
|
34
|
+
unobserve: import_globals.jest.fn(),
|
|
35
|
+
disconnect: import_globals.jest.fn()
|
|
36
|
+
})
|
|
37
|
+
)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function clearResizeObserverMock() {
|
|
41
|
+
window.ResizeObserver = pristineResizeObserver;
|
|
42
|
+
}
|
|
@@ -1 +1,34 @@
|
|
|
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 screen_size_mock_exports = {};
|
|
19
|
+
__export(screen_size_mock_exports, {
|
|
20
|
+
clearScreenSizeMock: () => clearScreenSizeMock,
|
|
21
|
+
setupScreenSizeMock: () => setupScreenSizeMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(screen_size_mock_exports);
|
|
24
|
+
const pristineScreenWidth = window.screen.width;
|
|
25
|
+
const pristineScreenHeight = window.screen.height;
|
|
26
|
+
function setupScreenSizeMock(width = 1024, height = 768) {
|
|
27
|
+
Object.defineProperty(window, "screen", {
|
|
28
|
+
configurable: true,
|
|
29
|
+
value: { width, height }
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function clearScreenSizeMock() {
|
|
33
|
+
setupScreenSizeMock(pristineScreenWidth, pristineScreenHeight);
|
|
34
|
+
}
|
|
@@ -1 +1,34 @@
|
|
|
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 scroll_into_view_mock_exports = {};
|
|
19
|
+
__export(scroll_into_view_mock_exports, {
|
|
20
|
+
clearScrollIntoViewMock: () => clearScrollIntoViewMock,
|
|
21
|
+
setupScrollIntoViewMock: () => setupScrollIntoViewMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(scroll_into_view_mock_exports);
|
|
24
|
+
var import_globals = require("@jest/globals");
|
|
25
|
+
const pristineScrollIntoView = window.HTMLElement.prototype.scrollIntoView;
|
|
26
|
+
function setupScrollIntoViewMock() {
|
|
27
|
+
Object.defineProperty(HTMLElement.prototype, "scrollIntoView", {
|
|
28
|
+
writable: true,
|
|
29
|
+
value: import_globals.jest.fn()
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function clearScrollIntoViewMock() {
|
|
33
|
+
window.HTMLElement.prototype.scrollIntoView = pristineScrollIntoView;
|
|
34
|
+
}
|
|
@@ -1 +1,39 @@
|
|
|
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 scroll_width_mock_exports = {};
|
|
19
|
+
__export(scroll_width_mock_exports, {
|
|
20
|
+
clearScrollWidthMock: () => clearScrollWidthMock,
|
|
21
|
+
setupScrollWidthMock: () => setupScrollWidthMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(scroll_width_mock_exports);
|
|
24
|
+
const pristineScrollWidthDescriptor = Object.getOwnPropertyDescriptor(
|
|
25
|
+
HTMLElement.prototype,
|
|
26
|
+
"scrollWidth"
|
|
27
|
+
);
|
|
28
|
+
function setupScrollWidthMock(scrollWidth) {
|
|
29
|
+
Object.defineProperty(HTMLElement.prototype, "scrollWidth", {
|
|
30
|
+
configurable: true,
|
|
31
|
+
get: () => scrollWidth
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function clearScrollWidthMock() {
|
|
35
|
+
Object.defineProperty(HTMLElement.prototype, "scrollWidth", {
|
|
36
|
+
configurable: true,
|
|
37
|
+
get: pristineScrollWidthDescriptor?.get ? pristineScrollWidthDescriptor.get : () => 0
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -1 +1,45 @@
|
|
|
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 select_mock_exports = {};
|
|
19
|
+
__export(select_mock_exports, {
|
|
20
|
+
_setupSelectMocks: () => _setupSelectMocks
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(select_mock_exports);
|
|
23
|
+
var import_globals = require("@jest/globals");
|
|
24
|
+
function _setupSelectMocks() {
|
|
25
|
+
let offsetWidth;
|
|
26
|
+
let offsetHeight;
|
|
27
|
+
let scrollHeight;
|
|
28
|
+
(0, import_globals.beforeAll)(function() {
|
|
29
|
+
offsetWidth = import_globals.jest.spyOn(window.HTMLElement.prototype, "clientWidth", "get").mockImplementation(() => 1e3);
|
|
30
|
+
offsetHeight = import_globals.jest.spyOn(window.HTMLElement.prototype, "clientHeight", "get").mockImplementation(() => 1e3);
|
|
31
|
+
scrollHeight = import_globals.jest.spyOn(window.HTMLElement.prototype, "scrollHeight", "get").mockImplementation(() => 48);
|
|
32
|
+
import_globals.jest.spyOn(window, "requestAnimationFrame").mockImplementation((cb) => {
|
|
33
|
+
cb(500);
|
|
34
|
+
return 1;
|
|
35
|
+
});
|
|
36
|
+
import_globals.jest.useFakeTimers();
|
|
37
|
+
});
|
|
38
|
+
(0, import_globals.afterAll)(function() {
|
|
39
|
+
offsetWidth.mockReset();
|
|
40
|
+
offsetHeight.mockReset();
|
|
41
|
+
scrollHeight.mockReset();
|
|
42
|
+
import_globals.jest.runOnlyPendingTimers();
|
|
43
|
+
import_globals.jest.useRealTimers();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -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 table_virtualization_mock_exports = {};
|
|
19
|
+
__export(table_virtualization_mock_exports, {
|
|
20
|
+
clearTableVirtualizationMock: () => clearTableVirtualizationMock,
|
|
21
|
+
setupTableVirtualizationMock: () => setupTableVirtualizationMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(table_virtualization_mock_exports);
|
|
24
|
+
var import_bounding_client_rect_mock = require("./bounding-client-rect-mock.js");
|
|
25
|
+
var import_dom_rect_mock = require("./dom-rect-mock.js");
|
|
26
|
+
var import_offset_height_mock = require("./offset-height-mock.js");
|
|
27
|
+
function setupTableVirtualizationMock(containerHeight = 15e3) {
|
|
28
|
+
(0, import_bounding_client_rect_mock.setupGetBoundingClientRectMock)(function() {
|
|
29
|
+
if (this.classList.contains("strato-table-header-group")) {
|
|
30
|
+
return (0, import_dom_rect_mock.createDOMRect)(0, 32);
|
|
31
|
+
}
|
|
32
|
+
if (this.classList.contains("strato-table-virtualization-container")) {
|
|
33
|
+
return (0, import_dom_rect_mock.createDOMRect)(0, containerHeight);
|
|
34
|
+
}
|
|
35
|
+
if (this.classList.contains("strato-table-row")) {
|
|
36
|
+
return (0, import_dom_rect_mock.createDOMRect)(0, 56);
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
});
|
|
40
|
+
(0, import_offset_height_mock.setupOffsetHeightMock)(function() {
|
|
41
|
+
return this.classList.contains("strato-table-row") ? 56 : 0;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function clearTableVirtualizationMock() {
|
|
45
|
+
(0, import_bounding_client_rect_mock.clearGetBoundingClientRectMock)();
|
|
46
|
+
(0, import_offset_height_mock.clearOffsetHeightMock)();
|
|
47
|
+
}
|
|
@@ -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 text_ellipsis_mock_exports = {};
|
|
19
|
+
__export(text_ellipsis_mock_exports, {
|
|
20
|
+
clearTextEllipsisMock: () => clearTextEllipsisMock,
|
|
21
|
+
setupTextEllipsisMock: () => setupTextEllipsisMock
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(text_ellipsis_mock_exports);
|
|
24
|
+
var import_bounding_client_rect_mock = require("./bounding-client-rect-mock.js");
|
|
25
|
+
var import_canvas_mock = require("./canvas-mock.js");
|
|
26
|
+
var import_scroll_width_mock = require("./scroll-width-mock.js");
|
|
27
|
+
function setupTextEllipsisMock(availableWidth = 250, textWidth = 200, mockCanvas = false) {
|
|
28
|
+
(0, import_bounding_client_rect_mock.setupGetBoundingClientRectMock)(availableWidth);
|
|
29
|
+
(0, import_scroll_width_mock.setupScrollWidthMock)(textWidth);
|
|
30
|
+
if (mockCanvas) {
|
|
31
|
+
(0, import_canvas_mock.setupCanvasMeasureTextMock)();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function clearTextEllipsisMock() {
|
|
35
|
+
(0, import_bounding_client_rect_mock.clearGetBoundingClientRectMock)();
|
|
36
|
+
(0, import_scroll_width_mock.clearScrollWidthMock)();
|
|
37
|
+
(0, import_canvas_mock.clearCanvasMeasureTextMock)();
|
|
38
|
+
}
|
package/testing/setup.js
CHANGED
|
@@ -1 +1,57 @@
|
|
|
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 setup_exports = {};
|
|
19
|
+
__export(setup_exports, {
|
|
20
|
+
clear: () => clear,
|
|
21
|
+
setup: () => setup
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(setup_exports);
|
|
24
|
+
var import_canvas_mock = require("./mocks/canvas-mock.js");
|
|
25
|
+
var import_create_range_mock = require("./mocks/create-range-mock.js");
|
|
26
|
+
var import_dom_rect_mock = require("./mocks/dom-rect-mock.js");
|
|
27
|
+
var import_intersection_observer_mock = require("./mocks/intersection-observer-mock.js");
|
|
28
|
+
var import_match_media_mock = require("./mocks/match-media-mock.js");
|
|
29
|
+
var import_offset_width_mock = require("./mocks/offset-width-mock.js");
|
|
30
|
+
var import_pointer_event_mock = require("./mocks/pointer-event-mock.js");
|
|
31
|
+
var import_resize_observer_mock = require("./mocks/resize-observer-mock.js");
|
|
32
|
+
var import_screen_size_mock = require("./mocks/screen-size-mock.js");
|
|
33
|
+
var import_scroll_into_view_mock = require("./mocks/scroll-into-view-mock.js");
|
|
34
|
+
function setup() {
|
|
35
|
+
(0, import_resize_observer_mock.setupResizeObserverMock)();
|
|
36
|
+
(0, import_pointer_event_mock.setupPointerEventMock)();
|
|
37
|
+
(0, import_intersection_observer_mock.setupIntersectionObserverMock)();
|
|
38
|
+
(0, import_create_range_mock.setupCreateRangeMock)();
|
|
39
|
+
(0, import_match_media_mock.setupMatchMediaMock)();
|
|
40
|
+
(0, import_dom_rect_mock.setupDomRectMock)();
|
|
41
|
+
(0, import_screen_size_mock.setupScreenSizeMock)();
|
|
42
|
+
(0, import_offset_width_mock.setupOffsetWidthMock)(0);
|
|
43
|
+
(0, import_canvas_mock.setupCanvasMeasureTextMock)(-Infinity);
|
|
44
|
+
(0, import_scroll_into_view_mock.setupScrollIntoViewMock)();
|
|
45
|
+
}
|
|
46
|
+
function clear() {
|
|
47
|
+
(0, import_resize_observer_mock.clearResizeObserverMock)();
|
|
48
|
+
(0, import_pointer_event_mock.clearPointerEventMock)();
|
|
49
|
+
(0, import_intersection_observer_mock.clearIntersectionObserverMock)();
|
|
50
|
+
(0, import_create_range_mock.clearCreateRangeMock)();
|
|
51
|
+
(0, import_offset_width_mock.clearOffsetWidthMock)();
|
|
52
|
+
(0, import_canvas_mock.clearCanvasMeasureTextMock)();
|
|
53
|
+
(0, import_match_media_mock.clearMatchMediaMock)();
|
|
54
|
+
(0, import_dom_rect_mock.clearDomRectMock)();
|
|
55
|
+
(0, import_screen_size_mock.clearScreenSizeMock)();
|
|
56
|
+
(0, import_scroll_into_view_mock.clearScrollIntoViewMock)();
|
|
57
|
+
}
|