@dynatrace/strato-components-testing 1.18.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/esm/jest/index.js +102 -3
  2. package/esm/jest/index.js.map +2 -2
  3. package/esm/jest/mocks/create-mock-element.js +81 -0
  4. package/esm/jest/mocks/create-mock-element.js.map +7 -0
  5. package/esm/jest/mocks/create-range-mock.js +28 -0
  6. package/esm/jest/mocks/create-range-mock.js.map +7 -0
  7. package/esm/jest/mocks/crypto-mock.js +20 -0
  8. package/esm/jest/mocks/crypto-mock.js.map +7 -0
  9. package/esm/jest/mocks/dom-rect-mock.js.map +2 -2
  10. package/esm/jest/mocks/element-from-point-mock.js +12 -0
  11. package/esm/jest/mocks/element-from-point-mock.js.map +7 -0
  12. package/esm/jest/mocks/fetch-mock.js +20 -0
  13. package/esm/jest/mocks/fetch-mock.js.map +7 -0
  14. package/esm/jest/mocks/framer-motion-mock.js +59 -0
  15. package/esm/jest/mocks/framer-motion-mock.js.map +7 -0
  16. package/esm/jest/mocks/intersection-observer-mock.js +40 -0
  17. package/esm/jest/mocks/intersection-observer-mock.js.map +7 -0
  18. package/esm/jest/mocks/match-media-mock.js +27 -0
  19. package/esm/jest/mocks/match-media-mock.js.map +7 -0
  20. package/esm/jest/mocks/offset-height-mock.js +21 -0
  21. package/esm/jest/mocks/offset-height-mock.js.map +7 -0
  22. package/esm/jest/mocks/offset-width-mock.js +21 -0
  23. package/esm/jest/mocks/offset-width-mock.js.map +7 -0
  24. package/esm/jest/mocks/pointer-event-mock.js +24 -0
  25. package/esm/jest/mocks/pointer-event-mock.js.map +7 -0
  26. package/esm/jest/mocks/screen-size-mock.js +16 -0
  27. package/esm/jest/mocks/screen-size-mock.js.map +7 -0
  28. package/esm/jest/mocks/scroll-into-view-mock.js +16 -0
  29. package/esm/jest/mocks/scroll-into-view-mock.js.map +7 -0
  30. package/esm/jest/mocks/streamdown.mock.js +8 -0
  31. package/esm/jest/mocks/streamdown.mock.js.map +7 -0
  32. package/esm/jest/mocks/table-virtualization-mock.js +87 -0
  33. package/esm/jest/mocks/table-virtualization-mock.js.map +7 -0
  34. package/esm/jest/mocks/virtualization-mock.js +155 -0
  35. package/esm/jest/mocks/virtualization-mock.js.map +7 -0
  36. package/esm/jest/preset/jest-preset.js +2 -1
  37. package/esm/jest/preset/jest-preset.js.map +2 -2
  38. package/esm/jest/setup/index.js +51 -0
  39. package/esm/jest/setup/index.js.map +2 -2
  40. package/esm/jest/testing-helpers/filters/filter-field.js +424 -0
  41. package/esm/jest/testing-helpers/filters/filter-field.js.map +7 -0
  42. package/esm/jest/testing-helpers/forms/base-input.js +32 -0
  43. package/esm/jest/testing-helpers/forms/base-input.js.map +7 -0
  44. package/esm/jest/testing-helpers/forms/password-input.js +29 -0
  45. package/esm/jest/testing-helpers/forms/password-input.js.map +7 -0
  46. package/esm/jest/testing-helpers/forms/search-input.js +27 -0
  47. package/esm/jest/testing-helpers/forms/search-input.js.map +7 -0
  48. package/esm/jest/testing-helpers/forms/select.js +131 -0
  49. package/esm/jest/testing-helpers/forms/select.js.map +7 -0
  50. package/esm/jest/testing-helpers/forms/text-input.js +24 -0
  51. package/esm/jest/testing-helpers/forms/text-input.js.map +7 -0
  52. package/esm/jest/testing-helpers/tables/datatable.js +794 -0
  53. package/esm/jest/testing-helpers/tables/datatable.js.map +7 -0
  54. package/esm/jest/testing-helpers/utils/isFakeTimersEnabled.js +9 -0
  55. package/esm/jest/testing-helpers/utils/isFakeTimersEnabled.js.map +7 -0
  56. package/esm/jest/testing-helpers/utils/setup-user-event.js +15 -0
  57. package/esm/jest/testing-helpers/utils/setup-user-event.js.map +7 -0
  58. package/jest/index.d.ts +22 -1
  59. package/jest/index.js +54 -3
  60. package/jest/mocks/create-mock-element.d.ts +15 -0
  61. package/jest/mocks/create-mock-element.js +99 -0
  62. package/jest/mocks/create-range-mock.d.ts +11 -0
  63. package/jest/mocks/create-range-mock.js +46 -0
  64. package/jest/mocks/crypto-mock.d.ts +12 -0
  65. package/jest/mocks/crypto-mock.js +48 -0
  66. package/jest/mocks/dom-rect-mock.d.ts +1 -0
  67. package/jest/mocks/element-from-point-mock.d.ts +11 -0
  68. package/jest/{setup.js → mocks/element-from-point-mock.js} +10 -16
  69. package/jest/mocks/fetch-mock.d.ts +10 -0
  70. package/jest/mocks/fetch-mock.js +38 -0
  71. package/jest/mocks/framer-motion-mock.d.ts +18 -0
  72. package/jest/mocks/framer-motion-mock.js +75 -0
  73. package/jest/mocks/intersection-observer-mock.d.ts +11 -0
  74. package/jest/mocks/intersection-observer-mock.js +58 -0
  75. package/jest/mocks/match-media-mock.d.ts +11 -0
  76. package/jest/mocks/match-media-mock.js +45 -0
  77. package/jest/mocks/offset-height-mock.d.ts +10 -0
  78. package/jest/mocks/offset-height-mock.js +39 -0
  79. package/jest/mocks/offset-width-mock.d.ts +10 -0
  80. package/jest/mocks/offset-width-mock.js +39 -0
  81. package/jest/mocks/pointer-event-mock.d.ts +10 -0
  82. package/jest/mocks/pointer-event-mock.js +42 -0
  83. package/jest/mocks/screen-size-mock.d.ts +10 -0
  84. package/jest/mocks/screen-size-mock.js +34 -0
  85. package/jest/mocks/scroll-into-view-mock.d.ts +10 -0
  86. package/jest/mocks/scroll-into-view-mock.js +34 -0
  87. package/jest/mocks/streamdown.mock.d.ts +2 -0
  88. package/jest/mocks/streamdown.mock.js +26 -0
  89. package/jest/mocks/table-virtualization-mock.d.ts +15 -0
  90. package/jest/mocks/table-virtualization-mock.js +102 -0
  91. package/jest/mocks/virtualization-mock.d.ts +9 -0
  92. package/jest/mocks/virtualization-mock.js +170 -0
  93. package/jest/preset/jest-preset.d.ts +2 -3
  94. package/jest/preset/jest-preset.js +2 -1
  95. package/jest/setup/index.js +27 -0
  96. package/jest/testing-helpers/filters/filter-field.d.ts +109 -0
  97. package/jest/testing-helpers/filters/filter-field.js +436 -0
  98. package/jest/testing-helpers/forms/base-input.d.ts +17 -0
  99. package/jest/testing-helpers/forms/base-input.js +50 -0
  100. package/jest/testing-helpers/forms/password-input.d.ts +16 -0
  101. package/jest/testing-helpers/forms/password-input.js +47 -0
  102. package/jest/testing-helpers/forms/search-input.d.ts +20 -0
  103. package/jest/testing-helpers/forms/search-input.js +45 -0
  104. package/jest/testing-helpers/forms/select.d.ts +65 -0
  105. package/jest/testing-helpers/forms/select.js +159 -0
  106. package/jest/testing-helpers/forms/text-input.d.ts +19 -0
  107. package/jest/testing-helpers/forms/text-input.js +42 -0
  108. package/jest/testing-helpers/tables/datatable.d.ts +239 -0
  109. package/jest/testing-helpers/tables/datatable.js +812 -0
  110. package/jest/testing-helpers/utils/isFakeTimersEnabled.d.ts +5 -0
  111. package/jest/testing-helpers/utils/isFakeTimersEnabled.js +27 -0
  112. package/jest/testing-helpers/utils/setup-user-event.d.ts +6 -0
  113. package/jest/testing-helpers/utils/setup-user-event.js +43 -0
  114. package/package.json +11 -3
  115. package/esm/jest/setup.js +0 -24
  116. package/esm/jest/setup.js.map +0 -7
  117. package/jest/setup.d.ts +0 -14
@@ -0,0 +1,75 @@
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 framer_motion_mock_exports = {};
19
+ __export(framer_motion_mock_exports, {
20
+ clearFramerMotionMock: () => clearFramerMotionMock,
21
+ setupFramerMotionMock: () => setupFramerMotionMock
22
+ });
23
+ module.exports = __toCommonJS(framer_motion_mock_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_globals = require("@jest/globals");
26
+ var import_react = require("react");
27
+ const actual = import_globals.jest.requireActual("framer-motion");
28
+ function setupFramerMotionMock() {
29
+ const MockedTransition = import_globals.jest.fn(({ children: children2 }) => children2);
30
+ const MockedAnimatePresence = import_globals.jest.fn(({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MockedTransition, { children: children2 }));
31
+ function motionMock(Component, _customMotionComponentConfig = {}) {
32
+ const motion = {
33
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error
34
+ // @ts-ignore geo load has some weird type error here in the tests here.
35
+ div: (0, import_react.forwardRef)((props, forwardedRef) => (
36
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
37
+ // @ts-expect-error
38
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...props, ref: forwardedRef })
39
+ ))
40
+ };
41
+ return (0, import_react.forwardRef)((props, forwardedRef) => {
42
+ const componentProps = Object.fromEntries(
43
+ // do not pass framer props to DOM element
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+ Object.entries(props).filter(
46
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
47
+ // @ts-expect-error
48
+ ([key]) => !actual.isValidMotionProp(key)
49
+ )
50
+ );
51
+ if (typeof Component === "string") {
52
+ const MotionComponent = motion[Component];
53
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MotionComponent, { ...componentProps, ref: forwardedRef });
54
+ }
55
+ return (
56
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
57
+ // @ts-expect-error
58
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref: forwardedRef, ...{ ...componentProps, children } })
59
+ );
60
+ });
61
+ }
62
+ const motionProxy = new Proxy(motionMock, {
63
+ get: (_target, prop) => motionMock(prop)
64
+ });
65
+ return {
66
+ motion: motionProxy,
67
+ AnimatePresence: MockedAnimatePresence,
68
+ useReducedMotion: (value = true) => value,
69
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
+ cubicBezier: actual.cubicBezier
71
+ };
72
+ }
73
+ function clearFramerMotionMock() {
74
+ import_globals.jest.unmock("framer-motion");
75
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Mocks the IntersectionObserver
3
+ * @param entries - entries for the callback function which is called when IntersectionObserver.observe is invoked
4
+ * @public
5
+ */
6
+ export declare function setupIntersectionObserverMock(entries?: any): void;
7
+ /**
8
+ * Clears `IntersectionObserver` mock.
9
+ * @public
10
+ */
11
+ export declare function clearIntersectionObserverMock(): void;
@@ -0,0 +1,58 @@
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
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Mocks the match media on the window object
3
+ * @param isMatching - whether or not the match query matches
4
+ * @public
5
+ */
6
+ export declare function setupMatchMediaMock(isMatching?: boolean): void;
7
+ /**
8
+ * Clears the Match Media mock
9
+ * @public
10
+ */
11
+ export declare function clearMatchMediaMock(): void;
@@ -0,0 +1,45 @@
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
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Mocks the return value of the offsetHeight property on all HTMLElements.
3
+ * @public
4
+ */
5
+ export declare function setupOffsetHeightMock(containerHeightOrMockFn: number | (() => number)): void;
6
+ /**
7
+ * Clears mocked offsetHeight property on HTMLElements.
8
+ * @public
9
+ */
10
+ export declare function clearOffsetHeightMock(): void;
@@ -0,0 +1,39 @@
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
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Mocks the return value of the offsetWidth property on all HTMLElements.
3
+ * @public
4
+ */
5
+ export declare function setupOffsetWidthMock(containerWidthOrMockFn: number | (() => number)): void;
6
+ /**
7
+ * Clears mocked offsetWidth property on HTMLElements.
8
+ * @public
9
+ */
10
+ export declare function clearOffsetWidthMock(): void;
@@ -0,0 +1,39 @@
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
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Mocks `PointerEvent`.
3
+ * @public
4
+ */
5
+ export declare function setupPointerEventMock(): void;
6
+ /**
7
+ * Clears `PointerEvent` mock.
8
+ * @public
9
+ */
10
+ export declare function clearPointerEventMock(): void;
@@ -0,0 +1,42 @@
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
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Mocks the width and height on `window.screen`
3
+ * @public
4
+ */
5
+ export declare function setupScreenSizeMock(width?: number, height?: number): void;
6
+ /**
7
+ * Clears mocked width and height on `window.screen`.
8
+ * @public
9
+ */
10
+ export declare function clearScreenSizeMock(): void;
@@ -0,0 +1,34 @@
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
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Mocks the scrollIntoView function since jsdom doesn't provide it
3
+ * @public
4
+ */
5
+ export declare function setupScrollIntoViewMock(): void;
6
+ /**
7
+ * Clears the scrollIntoView
8
+ * @public
9
+ */
10
+ export declare function clearScrollIntoViewMock(): void;
@@ -0,0 +1,34 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ export declare function Streamdown(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
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 streamdown_mock_exports = {};
19
+ __export(streamdown_mock_exports, {
20
+ Streamdown: () => Streamdown
21
+ });
22
+ module.exports = __toCommonJS(streamdown_mock_exports);
23
+ var import_jsx_runtime = require("react/jsx-runtime");
24
+ function Streamdown(props) {
25
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children });
26
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Mocks virtualization scrolling away by setting the containers height to something really tall.
3
+ * Table virtualization will also rely on jest fake timers.
4
+ * @public
5
+ *
6
+ * @deprecated this mock is deprecated and will be removed in future versions. Instead, use `setupVirtualizationMock`.
7
+ */
8
+ export declare function setupTableVirtualizationMock(containerHeight?: number): void;
9
+ /**
10
+ * Clears the TableVirtualizationMock
11
+ * @public
12
+ *
13
+ * @deprecated this mock is deprecated and will be removed in future versions. Instead, use `clearVirtualizationMock`.
14
+ */
15
+ export declare function clearTableVirtualizationMock(): void;
@@ -0,0 +1,102 @@
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
+ const pristineOffsetHeight = Object.getOwnPropertyDescriptor(
27
+ HTMLElement.prototype,
28
+ "offsetHeight"
29
+ );
30
+ const pristineOffsetWidth = Object.getOwnPropertyDescriptor(
31
+ HTMLElement.prototype,
32
+ "offsetWidth"
33
+ );
34
+ function setupTableVirtualizationMock(containerHeight = 15e3) {
35
+ (0, import_bounding_client_rect_mock.clearGetBoundingClientRectMock)();
36
+ (0, import_bounding_client_rect_mock.setupGetBoundingClientRectMock)(function() {
37
+ if (this.classList.contains("strato-table-header-group")) {
38
+ return (0, import_dom_rect_mock.createDOMRect)(1e3, 32);
39
+ }
40
+ if (this.classList.contains("strato-table-virtualization-container")) {
41
+ return (0, import_dom_rect_mock.createDOMRect)(1e3, containerHeight);
42
+ }
43
+ if (this.classList.contains("strato-table-row")) {
44
+ return (0, import_dom_rect_mock.createDOMRect)(1e3, 56);
45
+ }
46
+ if (this.classList.contains("strato-table-header-cell") || this.classList.contains("strato-table-cell")) {
47
+ return (0, import_dom_rect_mock.createDOMRect)(100, 32);
48
+ }
49
+ return null;
50
+ });
51
+ Object.defineProperty(HTMLElement.prototype, "offsetHeight", {
52
+ configurable: true,
53
+ get: function() {
54
+ if (this.classList.contains("strato-table-header-group")) {
55
+ return 32;
56
+ }
57
+ if (this.classList.contains("strato-table-virtualization-container")) {
58
+ return containerHeight;
59
+ }
60
+ if (this.classList.contains("strato-table-row")) {
61
+ return 56;
62
+ }
63
+ if (this.classList.contains("strato-table-header-cell") || this.classList.contains("strato-table-cell")) {
64
+ return 32;
65
+ }
66
+ return 0;
67
+ }
68
+ });
69
+ Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
70
+ configurable: true,
71
+ get: function() {
72
+ if (this.classList.contains("strato-table-header-group")) {
73
+ return 1e3;
74
+ }
75
+ if (this.classList.contains("strato-table-virtualization-container")) {
76
+ return 1e3;
77
+ }
78
+ if (this.classList.contains("strato-table-row")) {
79
+ return 1e3;
80
+ }
81
+ if (this.classList.contains("strato-table-header-cell") || this.classList.contains("strato-table-cell")) {
82
+ return 100;
83
+ }
84
+ return 0;
85
+ }
86
+ });
87
+ }
88
+ function clearTableVirtualizationMock() {
89
+ (0, import_bounding_client_rect_mock.clearGetBoundingClientRectMock)();
90
+ Object.defineProperty(
91
+ HTMLElement.prototype,
92
+ "offsetHeight",
93
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
94
+ pristineOffsetHeight
95
+ );
96
+ Object.defineProperty(
97
+ HTMLElement.prototype,
98
+ "offsetWidth",
99
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
100
+ pristineOffsetWidth
101
+ );
102
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This mock sets up Virtualization mocking for the `Select`, `DataTable`, Chart-legends and chart tooltips.
3
+ * @public
4
+ */
5
+ export declare function setupVirtualizationMock(): void;
6
+ /**
7
+ * @public
8
+ */
9
+ export declare function clearVirtualizationMock(): void;