@pega/cosmos-react-test-utils 4.0.0-dev.16.1 → 4.0.0-dev.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/mocks/createRange.d.ts +1 -0
- package/lib/mocks/createRange.d.ts.map +1 -0
- package/lib/mocks/createRange.js +14 -0
- package/lib/mocks/createRange.js.map +1 -0
- package/lib/mocks/index.d.ts +1 -1
- package/lib/mocks/index.d.ts.map +1 -1
- package/lib/mocks/index.js +1 -1
- package/lib/mocks/index.js.map +1 -1
- package/package.json +8 -8
- package/lib/mocks/displayNamesMock.d.ts +0 -11
- package/lib/mocks/displayNamesMock.d.ts.map +0 -1
- package/lib/mocks/displayNamesMock.js +0 -101
- package/lib/mocks/displayNamesMock.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=createRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRange.d.ts","sourceRoot":"","sources":["../../src/mocks/createRange.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
document.createRange = () => {
|
|
3
|
+
const range = new Range();
|
|
4
|
+
range.getBoundingClientRect = jest.fn();
|
|
5
|
+
range.getClientRects = () => {
|
|
6
|
+
return {
|
|
7
|
+
item: () => null,
|
|
8
|
+
length: 0,
|
|
9
|
+
[Symbol.iterator]: jest.fn()
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
return range;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=createRange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRange.js","sourceRoot":"","sources":["../../src/mocks/createRange.ts"],"names":[],"mappings":";AAAA,QAAQ,CAAC,WAAW,GAAG,GAAG,EAAE;IAC1B,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;IAE1B,KAAK,CAAC,qBAAqB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAExC,KAAK,CAAC,cAAc,GAAG,GAAG,EAAE;QAC1B,OAAO;YACL,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI;YAChB,MAAM,EAAE,CAAC;YACT,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE;SAC7B,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["document.createRange = () => {\n const range = new Range();\n\n range.getBoundingClientRect = jest.fn();\n\n range.getClientRects = () => {\n return {\n item: () => null,\n length: 0,\n [Symbol.iterator]: jest.fn()\n };\n };\n\n return range;\n};\n"]}
|
package/lib/mocks/index.d.ts
CHANGED
package/lib/mocks/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,wBAAwB,CAAC;AAChC,OAAO,YAAY,CAAC;AACpB,OAAO,4BAA4B,CAAC;AACpC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC"}
|
package/lib/mocks/index.js
CHANGED
package/lib/mocks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,wBAAwB,CAAC;AAChC,OAAO,YAAY,CAAC;AACpB,OAAO,4BAA4B,CAAC;AACpC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC","sourcesContent":["import './createRange';\nimport './elementFromPointMock';\nimport './iconMock';\nimport './intersectionObserverMock';\nimport './matchMediaMock';\nimport './qrcodeMock';\nimport './resizeObserverMock';\nimport './useBreakpointMock';\n"]}
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-test-utils",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
4
|
-
"author": "Pegasystems",
|
|
5
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
3
|
+
"version": "4.0.0-dev.17.0",
|
|
6
4
|
"repository": {
|
|
7
5
|
"type": "git",
|
|
8
6
|
"url": "https://github.com/pegasystems/cosmos-react.git",
|
|
9
7
|
"directory": "packages/cosmos-test-utils"
|
|
10
8
|
},
|
|
9
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
10
|
+
"author": "Pegasystems",
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"./src/mocks/*.ts",
|
|
13
|
+
"./lib/mocks/*.js"
|
|
14
|
+
],
|
|
11
15
|
"main": "lib/index.js",
|
|
12
16
|
"types": "lib/index.d.ts",
|
|
13
17
|
"files": [
|
|
14
18
|
"LICENSE",
|
|
15
19
|
"lib"
|
|
16
20
|
],
|
|
17
|
-
"sideEffects": [
|
|
18
|
-
"./src/mocks/*.ts",
|
|
19
|
-
"./lib/mocks/*.js"
|
|
20
|
-
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsc -b"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@pega/cosmos-react-core": "4.0.0-dev.
|
|
25
|
+
"@pega/cosmos-react-core": "4.0.0-dev.17.0",
|
|
26
26
|
"@testing-library/react": "^12.1.3",
|
|
27
27
|
"@types/jest": "^29.5.1",
|
|
28
28
|
"@types/react": "^16.14.24 || ^17.0.38",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="custom-intl-displaynames" />
|
|
2
|
-
declare class MockedIntlDisplayNames implements Intl.DisplayNames {
|
|
3
|
-
static localeData: Record<NonNullable<Intl.DisplayNamesOptions['style']>, Record<Intl.DateTimeFieldUnit, string>>;
|
|
4
|
-
locales: Intl.LocalesArgument;
|
|
5
|
-
options: Intl.DisplayNamesOptions;
|
|
6
|
-
style: NonNullable<Intl.DisplayNamesOptions['style']>;
|
|
7
|
-
constructor(locales: Intl.LocalesArgument, options: Intl.DisplayNamesOptions);
|
|
8
|
-
of(unit: Intl.DateTimeFieldUnit): string | undefined;
|
|
9
|
-
resolvedOptions(): Intl.ResolvedDisplayNamesOptions;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=displayNamesMock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"displayNamesMock.d.ts","sourceRoot":"","sources":["../../src/mocks/displayNamesMock.ts"],"names":[],"mappings":";AAAA,cAAM,sBAAuB,YAAW,IAAI,CAAC,YAAY;IACvD,MAAM,CAAC,UAAU,EAAE,MAAM,CACvB,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,EAC9C,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CACvC,CAwCC;IAEF,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC;IAC9B,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAAC;IAElC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;gBAE1C,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,mBAAmB;IAM5E,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,GAAG,MAAM,GAAG,SAAS;IAMpD,eAAe,IAAI,IAAI,CAAC,2BAA2B;CASpD"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
class MockedIntlDisplayNames {
|
|
3
|
-
constructor(locales, options) {
|
|
4
|
-
Object.defineProperty(this, "locales", {
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true,
|
|
8
|
-
value: void 0
|
|
9
|
-
});
|
|
10
|
-
Object.defineProperty(this, "options", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: void 0
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(this, "style", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
this.locales = locales;
|
|
23
|
-
this.options = options;
|
|
24
|
-
this.style = options.style ?? 'long';
|
|
25
|
-
}
|
|
26
|
-
of(unit) {
|
|
27
|
-
if (Object.prototype.hasOwnProperty.call(MockedIntlDisplayNames.localeData[this.style], unit)) {
|
|
28
|
-
return MockedIntlDisplayNames.localeData[this.style][unit];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
resolvedOptions() {
|
|
32
|
-
return {
|
|
33
|
-
locale: 'en',
|
|
34
|
-
style: this.style,
|
|
35
|
-
fallback: this.options.fallback ?? 'code',
|
|
36
|
-
languageDisplay: this.options.languageDisplay ?? 'standard',
|
|
37
|
-
type: 'dateTimeField'
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
Object.defineProperty(MockedIntlDisplayNames, "localeData", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true,
|
|
45
|
-
value: {
|
|
46
|
-
narrow: {
|
|
47
|
-
second: 'sec.',
|
|
48
|
-
minute: 'min.',
|
|
49
|
-
hour: 'hr.',
|
|
50
|
-
day: 'day',
|
|
51
|
-
month: 'mo.',
|
|
52
|
-
year: 'yr.',
|
|
53
|
-
weekOfYear: 'wk.',
|
|
54
|
-
dayPeriod: 'am/pm',
|
|
55
|
-
weekday: 'day of wk.',
|
|
56
|
-
quarter: 'qtr.',
|
|
57
|
-
era: 'era'
|
|
58
|
-
},
|
|
59
|
-
short: {
|
|
60
|
-
second: 'sec.',
|
|
61
|
-
minute: 'min.',
|
|
62
|
-
hour: 'hr.',
|
|
63
|
-
day: 'day',
|
|
64
|
-
month: 'mo.',
|
|
65
|
-
year: 'yr.',
|
|
66
|
-
weekOfYear: 'wk.',
|
|
67
|
-
dayPeriod: 'am/pm',
|
|
68
|
-
weekday: 'day of wk.',
|
|
69
|
-
quarter: 'qtr.',
|
|
70
|
-
era: 'era'
|
|
71
|
-
},
|
|
72
|
-
long: {
|
|
73
|
-
second: 'second',
|
|
74
|
-
minute: 'minute',
|
|
75
|
-
hour: 'hour',
|
|
76
|
-
day: 'day',
|
|
77
|
-
month: 'month',
|
|
78
|
-
year: 'year',
|
|
79
|
-
weekOfYear: 'week',
|
|
80
|
-
dayPeriod: 'am/pm',
|
|
81
|
-
weekday: 'day of the week',
|
|
82
|
-
quarter: 'quarter',
|
|
83
|
-
era: 'era'
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
// Currently Node.JS Intl.DisplayNames lacks 'dateTimeField' style - need to polyfill.
|
|
88
|
-
Object.defineProperty(Intl, 'DisplayNames', {
|
|
89
|
-
writable: true,
|
|
90
|
-
enumerable: false,
|
|
91
|
-
configurable: true,
|
|
92
|
-
value: new Proxy(Intl.DisplayNames, {
|
|
93
|
-
construct(Target, args) {
|
|
94
|
-
const [, { type }] = args;
|
|
95
|
-
if (type === 'dateTimeField')
|
|
96
|
-
return new MockedIntlDisplayNames(...args);
|
|
97
|
-
return new Target(...args);
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
//# sourceMappingURL=displayNamesMock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,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,EAAE,KAAK;YACX,GAAG,EAAE,KAAK;YACV,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,KAAK;YACX,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,OAAO;YAClB,OAAO,EAAE,YAAY;YACrB,OAAO,EAAE,MAAM;YACf,GAAG,EAAE,KAAK;SACX;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,MAAM;YACZ,GAAG,EAAE,KAAK;YACV,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,MAAM;YACZ,UAAU,EAAE,MAAM;YAClB,SAAS,EAAE,OAAO;YAClB,OAAO,EAAE,iBAAiB;YAC1B,OAAO,EAAE,SAAS;YAClB,GAAG,EAAE,KAAK;SACX;KACF;EA3CgB,CA2Cf;AA8BJ,sFAAsF;AACtF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,EAAE;IAC1C,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,KAAK;IACjB,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE;QAClC,SAAS,CAAC,MAAM,EAAE,IAAsD;YACtE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;YAC1B,IAAI,IAAI,KAAK,eAAe;gBAAE,OAAO,IAAI,sBAAsB,CAAC,GAAG,IAAI,CAAC,CAAC;YACzE,OAAO,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC7B,CAAC;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["class MockedIntlDisplayNames implements Intl.DisplayNames {\n static localeData: Record<\n NonNullable<Intl.DisplayNamesOptions['style']>,\n Record<Intl.DateTimeFieldUnit, string>\n > = {\n narrow: {\n second: 'sec.',\n minute: 'min.',\n hour: 'hr.',\n day: 'day',\n month: 'mo.',\n year: 'yr.',\n weekOfYear: 'wk.',\n dayPeriod: 'am/pm',\n weekday: 'day of wk.',\n quarter: 'qtr.',\n era: 'era'\n },\n short: {\n second: 'sec.',\n minute: 'min.',\n hour: 'hr.',\n day: 'day',\n month: 'mo.',\n year: 'yr.',\n weekOfYear: 'wk.',\n dayPeriod: 'am/pm',\n weekday: 'day of wk.',\n quarter: 'qtr.',\n era: 'era'\n },\n long: {\n second: 'second',\n minute: 'minute',\n hour: 'hour',\n day: 'day',\n month: 'month',\n year: 'year',\n weekOfYear: 'week',\n dayPeriod: 'am/pm',\n weekday: 'day of the week',\n quarter: 'quarter',\n era: 'era'\n }\n };\n\n locales: Intl.LocalesArgument;\n options: Intl.DisplayNamesOptions;\n\n style: NonNullable<Intl.DisplayNamesOptions['style']>;\n\n constructor(locales: Intl.LocalesArgument, options: Intl.DisplayNamesOptions) {\n this.locales = locales;\n this.options = options;\n this.style = options.style ?? 'long';\n }\n\n of(unit: Intl.DateTimeFieldUnit): string | undefined {\n if (Object.prototype.hasOwnProperty.call(MockedIntlDisplayNames.localeData[this.style], unit)) {\n return MockedIntlDisplayNames.localeData[this.style][unit];\n }\n }\n\n resolvedOptions(): Intl.ResolvedDisplayNamesOptions {\n return {\n locale: 'en',\n style: this.style,\n fallback: this.options.fallback ?? 'code',\n languageDisplay: this.options.languageDisplay ?? 'standard',\n type: 'dateTimeField'\n };\n }\n}\n\n// Currently Node.JS Intl.DisplayNames lacks 'dateTimeField' style - need to polyfill.\nObject.defineProperty(Intl, 'DisplayNames', {\n writable: true,\n enumerable: false,\n configurable: true,\n value: new Proxy(Intl.DisplayNames, {\n construct(Target, args: [Intl.LocalesArgument, Intl.DisplayNamesOptions]) {\n const [, { type }] = args;\n if (type === 'dateTimeField') return new MockedIntlDisplayNames(...args);\n return new Target(...args);\n }\n })\n});\n"]}
|