@pega/custom-dx-components 0.25.3 → 0.25.5
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/package.json +1 -1
- package/src/tasks/create/templates/Constellation/Field/Date/demo.test.tsx.mustache +52 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.tsx.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.test.tsx.mustache +72 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.test.tsx.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.test.tsx.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.stories.tsx.mustache +2 -0
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.test.tsx.mustache +27 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.test.tsx.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.test.tsx.mustache +25 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/demo.test.tsx.mustache +33 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/demo.test.tsx.mustache +29 -0
- package/src/tasks/create/templates/Constellation/Field/Text/demo.test.tsx.mustache +19 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.test.tsx.mustache +20 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.test.tsx.mustache +20 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.test.tsx.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.test.tsx.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.test.tsx.mustache +20 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.test.tsx.mustache +33 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +3 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.test.tsx.mustache +47 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +3 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.test.tsx.mustache +58 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.test.tsx.mustache +40 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.test.tsx.mustache +56 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +6 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.test.tsx.mustache +24 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.tsx.mustache +5 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.test.tsx.mustache +28 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +4 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.test.tsx.mustache +36 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.tsx.mustache +4 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.test.tsx.mustache +29 -0
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.stories.tsx.mustache +3 -0
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.test.tsx.mustache +27 -0
- package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.stories.tsx.mustache +5 -0
- package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.test.tsx.mustache +28 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +4 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.test.tsx.mustache +36 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/demo.stories.tsx.mustache +4 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/demo.test.tsx.mustache +19 -0
- package/src/tasks/init/template/jest.config.cjs +3 -2
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/init/template/setupFiles.ts +5 -0
- package/src/tasks/init/template/setupTests.ts +99 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { configure } from '@testing-library/react';
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
import 'jest-canvas-mock';
|
|
4
|
+
|
|
5
|
+
// Wait time needed
|
|
6
|
+
const TIMEOUT = 300000;
|
|
7
|
+
|
|
8
|
+
// mocks open
|
|
9
|
+
global.open = jest.fn();
|
|
10
|
+
|
|
11
|
+
global.fetch = jest.fn(() =>
|
|
12
|
+
Promise.resolve({
|
|
13
|
+
json: () => Promise.resolve(() => 'xxx'),
|
|
14
|
+
arrayBuffer: () => Promise.resolve(() => 'yyy')
|
|
15
|
+
})
|
|
16
|
+
) as jest.Mock;
|
|
17
|
+
|
|
18
|
+
window.URL.createObjectURL = jest.fn();
|
|
19
|
+
|
|
20
|
+
// mocks ResizeObserver
|
|
21
|
+
window.ResizeObserver = jest.fn(() => ({
|
|
22
|
+
observe: () => {},
|
|
23
|
+
unobserve: () => {},
|
|
24
|
+
disconnect: () => {}
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
// mocks IntersectionObserver
|
|
28
|
+
window.IntersectionObserver = jest.fn(() => ({
|
|
29
|
+
root: null,
|
|
30
|
+
rootMargin: '0',
|
|
31
|
+
thresholds: [],
|
|
32
|
+
takeRecords: () => [],
|
|
33
|
+
observe: () => {},
|
|
34
|
+
unobserve: () => {},
|
|
35
|
+
disconnect: () => {}
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
39
|
+
writable: true,
|
|
40
|
+
value: jest.fn().mockImplementation(query => ({
|
|
41
|
+
matches: false,
|
|
42
|
+
media: query,
|
|
43
|
+
onchange: null,
|
|
44
|
+
addListener: jest.fn(), // Deprecated
|
|
45
|
+
removeListener: jest.fn(), // Deprecated
|
|
46
|
+
addEventListener: jest.fn(),
|
|
47
|
+
removeEventListener: jest.fn(),
|
|
48
|
+
dispatchEvent: jest.fn()
|
|
49
|
+
}))
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// // mocks createSVGPoint
|
|
53
|
+
// Object.defineProperty(global.SVGSVGElement.prototype, 'createSVGPoint', {
|
|
54
|
+
// writable: true,
|
|
55
|
+
// value: jest.fn().mockImplementation(() => ({
|
|
56
|
+
// x: 0,
|
|
57
|
+
// y: 0,
|
|
58
|
+
// matrixTransform: jest.fn().mockImplementation(() => ({
|
|
59
|
+
// x: 0,
|
|
60
|
+
// y: 0
|
|
61
|
+
// }))
|
|
62
|
+
// }))
|
|
63
|
+
// });
|
|
64
|
+
|
|
65
|
+
// // mocks getBBox on SVGTextElement
|
|
66
|
+
// (global.SVGElement.prototype as any).getBBox = () => {
|
|
67
|
+
// return {
|
|
68
|
+
// x: 0,
|
|
69
|
+
// y: 0,
|
|
70
|
+
// width: 30,
|
|
71
|
+
// height: 15,
|
|
72
|
+
// bottom: 0,
|
|
73
|
+
// left: 0,
|
|
74
|
+
// right: 0,
|
|
75
|
+
// top: 0,
|
|
76
|
+
// toJSON: () => ''
|
|
77
|
+
// };
|
|
78
|
+
// };
|
|
79
|
+
|
|
80
|
+
// // Mocks the window.matchMedia function used in useBreakpoint hook
|
|
81
|
+
// Object.defineProperty(window, 'matchMedia', {
|
|
82
|
+
// writable: true,
|
|
83
|
+
// value: jest.fn().mockImplementation(query => ({
|
|
84
|
+
// matches: false,
|
|
85
|
+
// media: query,
|
|
86
|
+
// onchange: null,
|
|
87
|
+
// addListener: jest.fn(),
|
|
88
|
+
// removeListener: jest.fn(),
|
|
89
|
+
// addEventListener: jest.fn(),
|
|
90
|
+
// removeEventListener: jest.fn(),
|
|
91
|
+
// dispatchEvent: jest.fn()
|
|
92
|
+
// }))
|
|
93
|
+
// });
|
|
94
|
+
|
|
95
|
+
// jest.setTimeout(TIMEOUT);
|
|
96
|
+
|
|
97
|
+
// // speeds up *ByRole queries a bit
|
|
98
|
+
// // https://github.com/testing-library/dom-testing-library/issues/552
|
|
99
|
+
// configure({ defaultHidden: true });
|