@open-pioneer/test-utils 4.9.0-dev.20260930055642 → 4.9.0-dev.20261029090037
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/CHANGELOG.md +12 -1
- package/README.md +7 -7
- package/package.json +7 -6
- package/react.d.ts +10 -0
- package/react.js +23 -5
- package/react.js.map +1 -1
- package/services.d.ts +1 -1
- package/services.js.map +1 -1
- package/web-components.d.ts +2 -0
- package/web-components.js +3 -3
- package/web-components.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
# @open-pioneer/test-utils
|
|
2
2
|
|
|
3
|
-
## 4.9.0-dev.
|
|
3
|
+
## 4.9.0-dev.20261029090037
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6145961: Update `@formatjs/intl` to version 6.
|
|
8
|
+
- 31f8961: Add the `chakraSystemConfig` prop to `PackageContextProvider`.
|
|
9
|
+
It takes a chakra `SystemConfig`, like the `chakraSystemConfig` option of `createCustomElement()`, so tests can render components with a custom theme.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 6b160f3: `PackageContextProvider` keeps its package context stable across re-renders with equal props, so `useIntl()` and `useService()` return the same objects.
|
|
14
|
+
- 42ca366: Update dependencies
|
|
4
15
|
|
|
5
16
|
## 4.8.0
|
|
6
17
|
|
package/README.md
CHANGED
|
@@ -14,14 +14,14 @@ Example:
|
|
|
14
14
|
/**
|
|
15
15
|
* @vitest-environment happy-dom
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
import { createElement } from "react";
|
|
17
|
+
|
|
19
18
|
import { createCustomElement } from "@open-pioneer/runtime";
|
|
20
19
|
import { renderComponentShadowDOM } from "@open-pioneer/test-utils/web-components";
|
|
20
|
+
import { createElement } from "react";
|
|
21
|
+
import { it, expect } from "vitest";
|
|
21
22
|
|
|
22
23
|
it("should render a custom component into the dom", async () => {
|
|
23
24
|
// Define a custom element class.
|
|
24
|
-
// The shadow root must be open for testing to work (which is the default during development).
|
|
25
25
|
const elem = createCustomElement({
|
|
26
26
|
component: () => createElement("div", { className: "test" }, "hello world")
|
|
27
27
|
});
|
|
@@ -41,15 +41,15 @@ Take a look at the tests in this package for more examples.
|
|
|
41
41
|
|
|
42
42
|
Provides helpers to make testing of react components easier that use the hooks from the `"open-pioneer:react-hooks"` module (e.g. `useService`).
|
|
43
43
|
|
|
44
|
-
The developer can provide custom service implementations, properties etc. using a simple parent component.
|
|
44
|
+
The developer can provide custom service implementations, properties, a chakra theme, etc. using a simple parent component.
|
|
45
45
|
|
|
46
46
|
Example:
|
|
47
47
|
|
|
48
48
|
```js
|
|
49
|
-
import { expect, it } from "vitest";
|
|
50
|
-
import { screen, render } from "@testing-library/react";
|
|
51
49
|
import { PackageContextProvider } from "@open-pioneer/test-utils/react";
|
|
50
|
+
import { screen, render } from "@testing-library/react";
|
|
52
51
|
import { useProperties, useService, useServices } from "open-pioneer:react-hooks";
|
|
52
|
+
import { expect, it } from "vitest";
|
|
53
53
|
|
|
54
54
|
it("should allow injection of service from the test", async () => {
|
|
55
55
|
// A simple component that uses a service.
|
|
@@ -91,8 +91,8 @@ References to other service instances can be mocked with user defined test value
|
|
|
91
91
|
Example:
|
|
92
92
|
|
|
93
93
|
```js
|
|
94
|
-
import { expect, it } from "vitest";
|
|
95
94
|
import { createService } from "@open-pioneer/test-utils/services";
|
|
95
|
+
import { expect, it } from "vitest";
|
|
96
96
|
import { MyService } from "./MyService"; // User defined service
|
|
97
97
|
|
|
98
98
|
it("creates a new service instance with the defined references", async () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/test-utils",
|
|
4
|
-
"version": "4.9.0-dev.
|
|
4
|
+
"version": "4.9.0-dev.20261029090037",
|
|
5
5
|
"description": "Contains test utilities that make it easier to test parts of an Open Pioneer Trails application.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
"directory": "src/packages/test-utils"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@
|
|
18
|
-
"@
|
|
19
|
-
"@
|
|
17
|
+
"@chakra-ui/react": "^3.37.0",
|
|
18
|
+
"@conterra/reactivity-core": "^0.8.9",
|
|
19
|
+
"@formatjs/intl": "^6.1.4",
|
|
20
|
+
"@open-pioneer/runtime": "4.9.0-dev.20261029090037",
|
|
20
21
|
"@testing-library/dom": "^10.4.2",
|
|
21
22
|
"@testing-library/react": "^16.3.3",
|
|
22
|
-
"react": "^19.3.
|
|
23
|
-
"react-dom": "^19.3.
|
|
23
|
+
"react": "^19.3.1",
|
|
24
|
+
"react-dom": "^19.3.1"
|
|
24
25
|
},
|
|
25
26
|
"publishConfig": {
|
|
26
27
|
"directory": "dist",
|
package/react.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { SystemConfig as ChakraSystemConfig } from "@chakra-ui/react";
|
|
1
2
|
import type { ColorModeValue, Service } from "@open-pioneer/runtime";
|
|
2
3
|
import { FC, ReactNode } from "react";
|
|
4
|
+
/** Any service instance. The type is relaxed on purpose to allow test mocks. */
|
|
3
5
|
export type AnyService = Service<any>;
|
|
6
|
+
/** Props of {@link PackageContextProvider}. */
|
|
4
7
|
export interface PackageContextProviderProps {
|
|
5
8
|
/** Interface implementations, keyed by interface name. */
|
|
6
9
|
services?: {
|
|
@@ -26,6 +29,13 @@ export interface PackageContextProviderProps {
|
|
|
26
29
|
* The color mode.
|
|
27
30
|
*/
|
|
28
31
|
colorMode?: ColorModeValue;
|
|
32
|
+
/**
|
|
33
|
+
* Chakra styled system object.
|
|
34
|
+
*
|
|
35
|
+
* Used to configure chakra's theme, like `chakraSystemConfig` of `createCustomElement()`.
|
|
36
|
+
* Defaults to the trails base theme.
|
|
37
|
+
*/
|
|
38
|
+
chakraSystemConfig?: ChakraSystemConfig;
|
|
29
39
|
/**
|
|
30
40
|
* I18n messages for packages
|
|
31
41
|
*/
|
package/react.js
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { constant } from '@conterra/reactivity-core';
|
|
3
3
|
import { APP_ROOT_CLASS, CustomChakraProvider, PackageContext } from '@open-pioneer/runtime/test-support';
|
|
4
4
|
import { useMemo, useInsertionEffect } from 'react';
|
|
5
5
|
import { createIntl } from './vanilla.js';
|
|
6
6
|
|
|
7
7
|
const PackageContextProvider = (props) => {
|
|
8
|
-
const {
|
|
8
|
+
const {
|
|
9
|
+
children,
|
|
10
|
+
services,
|
|
11
|
+
qualifiedServices,
|
|
12
|
+
properties,
|
|
13
|
+
locale: localeProp,
|
|
14
|
+
colorMode: colorModeProp,
|
|
15
|
+
chakraSystemConfig,
|
|
16
|
+
messages
|
|
17
|
+
} = props;
|
|
18
|
+
const config = useMemo(() => constant(chakraSystemConfig), [chakraSystemConfig]);
|
|
9
19
|
const [locale, colorMode, contextMethods] = useMemo(
|
|
10
|
-
() => createPackageContextMethods(
|
|
11
|
-
|
|
20
|
+
() => createPackageContextMethods({
|
|
21
|
+
services,
|
|
22
|
+
qualifiedServices,
|
|
23
|
+
properties,
|
|
24
|
+
locale: localeProp,
|
|
25
|
+
colorMode: colorModeProp,
|
|
26
|
+
messages
|
|
27
|
+
}),
|
|
28
|
+
[services, qualifiedServices, properties, localeProp, colorModeProp, messages]
|
|
12
29
|
);
|
|
13
30
|
useInsertionEffect(() => {
|
|
14
31
|
document.body.classList.add(APP_ROOT_CLASS);
|
|
@@ -23,6 +40,7 @@ const PackageContextProvider = (props) => {
|
|
|
23
40
|
appRoot: document.body,
|
|
24
41
|
locale,
|
|
25
42
|
colorMode,
|
|
43
|
+
config,
|
|
26
44
|
children: /* @__PURE__ */ jsx(PackageContext.Provider, { value: contextMethods, children })
|
|
27
45
|
}
|
|
28
46
|
);
|
|
@@ -34,7 +52,7 @@ function createPackageContextMethods(options) {
|
|
|
34
52
|
const locale = options?.locale ?? "en";
|
|
35
53
|
const messages = options?.messages ?? {};
|
|
36
54
|
const cachedIntl = {};
|
|
37
|
-
const colorMode =
|
|
55
|
+
const colorMode = constant(options?.colorMode ?? "light");
|
|
38
56
|
const methods = {
|
|
39
57
|
getService(packageName, interfaceName, options2) {
|
|
40
58
|
if (!options2.qualifier) {
|
package/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sources":["react.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { computed, constant, ReadonlyReactive } from \"@conterra/reactivity-core\";\nimport type { ColorModeValue, PackageIntl, Service } from \"@open-pioneer/runtime\";\nimport {\n APP_ROOT_CLASS,\n CustomChakraProvider,\n PackageContext,\n PackageContextMethods\n} from \"@open-pioneer/runtime/test-support\";\nimport { FC, ReactNode, useInsertionEffect, useMemo } from \"react\";\nimport { createIntl } from \"./vanilla\";\n\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyService = Service<any>;\n\nexport interface PackageContextProviderProps {\n /** Interface implementations, keyed by interface name. */\n services?: {\n [interfaceName: string]: AnyService;\n };\n\n /** Interface implementations, keyed by interface name and then by qualifier. */\n qualifiedServices?: {\n [interfaceName: string]: {\n [qualifier: string]: AnyService;\n };\n };\n\n /** Package properties (keyed by package name). */\n properties?: {\n [packageName: string]: Record<string, unknown>;\n };\n\n /**\n * The locale for i18n messages and formatting.\n *\n * @default \"en\"\n */\n locale?: string;\n\n /**\n * The color mode.\n */\n colorMode?: ColorModeValue;\n\n /**\n * I18n messages for packages\n */\n messages?: {\n /**\n * I18n messages as (messageId, message) entries.\n *\n * @default {}\n */\n [packageName: string]: Record<string, string>;\n };\n\n /** Children to render */\n children?: ReactNode;\n}\n\n/**\n * Injects services and properties into the component tree.\n * React components using Open Pioneer Trails hooks like `useService` and `useProperties`\n * will receive the mocked properties here instead.\n * Currently also wrapped with the CustomChakraProvider to support chakra-ui elements\n */\nexport const PackageContextProvider: FC<PackageContextProviderProps> = (props) => {\n const { children, ...rest } = props;\n const [locale, colorMode, contextMethods] = useMemo(\n () => createPackageContextMethods(rest),\n [rest]\n );\n\n useInsertionEffect(() => {\n // Needed for chakra tokens / theme etc. to be applied correctly.\n // In real applications, this is done as part of the web component startup code.\n // In test scenarios, the body is used as the root node (see props below).\n document.body.classList.add(APP_ROOT_CLASS);\n return () => {\n document.body.classList.remove(APP_ROOT_CLASS);\n };\n }, []);\n\n return (\n <CustomChakraProvider\n rootNode={document}\n appRoot={document.body}\n locale={locale}\n colorMode={colorMode}\n >\n <PackageContext.Provider value={contextMethods}>{children}</PackageContext.Provider>\n </CustomChakraProvider>\n );\n};\n\nfunction createPackageContextMethods(\n options: Omit<PackageContextProviderProps, \"children\">\n): [\n locale: ReadonlyReactive<string>,\n colorMode: ReadonlyReactive<ColorModeValue>,\n methods: PackageContextMethods\n] {\n const services = options?.services ?? {};\n const qualifiedServices = options?.qualifiedServices ?? {};\n const properties = options?.properties ?? {};\n const locale = options?.locale ?? \"en\";\n const messages = options?.messages ?? {};\n const cachedIntl: Record<string, PackageIntl> = {};\n const colorMode = computed(() => options?.colorMode ?? \"light\");\n const methods: PackageContextMethods = {\n getService(packageName, interfaceName, options) {\n if (!options.qualifier) {\n const service = services[interfaceName];\n if (service) {\n return service;\n }\n const qualified = qualifiedServices[interfaceName];\n if (qualified) {\n for (const value of Object.values(qualified)) {\n return value; // Return any implementation\n }\n }\n throw new Error(\n `Interface name not bound for testing: '${interfaceName}'. Update the configuration of PackageContextProvider.`\n );\n }\n\n const qualifiedService = qualifiedServices[interfaceName]?.[options.qualifier];\n if (!qualifiedService) {\n throw new Error(\n `Interface name not bound for testing: '${interfaceName}' (qualifier '${options.qualifier}'). Update the configuration of PackageContextProvider.`\n );\n }\n return qualifiedService;\n },\n getServices(packageName, interfaceName) {\n const unqualified = services[interfaceName];\n const results = Object.values(qualifiedServices[interfaceName] ?? {});\n if (unqualified) {\n results.push(unqualified);\n }\n return results;\n },\n getProperties(packageName) {\n const packageProperties = properties[packageName];\n if (!packageProperties) {\n throw new Error(\n `No properties for package '${packageName}' bound for testing. Update the configuration of PackageContextProvider.`\n );\n }\n return packageProperties;\n },\n getIntl(packageName) {\n const initIntl = () => {\n const packageMessages = messages[packageName];\n return createIntl({\n locale: locale,\n messages: packageMessages\n });\n };\n return (cachedIntl[packageName] ??= initIntl());\n }\n };\n return [constant(locale), colorMode, methods];\n}\n"],"names":["options"],"mappings":";;;;;;AAqEO,MAAM,sBAAA,GAA0D,CAAC,KAAA,KAAU;AAC9E,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,IAAA,EAAK,GAAI,KAAA;AAC9B,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAA,EAAW,cAAc,CAAA,GAAI,OAAA;AAAA,IACxC,MAAM,4BAA4B,IAAI,CAAA;AAAA,IACtC,CAAC,IAAI;AAAA,GACT;AAEA,EAAA,kBAAA,CAAmB,MAAM;AAIrB,IAAA,QAAA,CAAS,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,cAAc,CAAA;AAC1C,IAAA,OAAO,MAAM;AACT,MAAA,QAAA,CAAS,IAAA,CAAK,SAAA,CAAU,MAAA,CAAO,cAAc,CAAA;AAAA,IACjD,CAAA;AAAA,EACJ,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,uBACI,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACG,QAAA,EAAU,QAAA;AAAA,MACV,SAAS,QAAA,CAAS,IAAA;AAAA,MAClB,MAAA;AAAA,MACA,SAAA;AAAA,MAEA,8BAAC,cAAA,CAAe,QAAA,EAAf,EAAwB,KAAA,EAAO,gBAAiB,QAAA,EAAS;AAAA;AAAA,GAC9D;AAER;AAEA,S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,SAC7F;AAAA,MACJ;AACA,MAAA,OAAO,gBAAA;AAAA,IACX,CAAA;AAAA,IACA,WAAA,CAAY,aAAa,aAAA,EAAe;AACpC,MAAA,MAAM,WAAA,GAAc,SAAS,aAAa,CAAA;AAC1C,MAAA,MAAM,UAAU,MAAA,CAAO,MAAA,CAAO,kBAAkB,aAAa,CAAA,IAAK,EAAE,CAAA;AACpE,MAAA,IAAI,WAAA,EAAa;AACb,QAAA,OAAA,CAAQ,KAAK,WAAW,CAAA;AAAA,MAC5B;AACA,MAAA,OAAO,OAAA;AAAA,IACX,CAAA;AAAA,IACA,cAAc,WAAA,EAAa;AACvB,MAAA,MAAM,iBAAA,GAAoB,WAAW,WAAW,CAAA;AAChD,MAAA,IAAI,CAAC,iBAAA,EAAmB;AACpB,QAAA,MAAM,IAAI,KAAA;AAAA,UACN,8BAA8B,WAAW,CAAA,wEAAA;AAAA,SAC7C;AAAA,MACJ;AACA,MAAA,OAAO,iBAAA;AAAA,IACX,CAAA;AAAA,IACA,QAAQ,WAAA,EAAa;AACjB,MAAA,MAAM,WAAW,MAAM;AACnB,QAAA,MAAM,eAAA,GAAkB,SAAS,WAAW,CAAA;AAC5C,QAAA,OAAO,UAAA,CAAW;AAAA,UACd,MAAA;AAAA,UACA,QAAA,EAAU;AAAA,SACb,CAAA;AAAA,MACL,CAAA;AACA,MAAA,OAAQ,UAAA,CAAW,WAAW,CAAA,KAAM,QAAA,EAAS;AAAA,IACjD;AAAA,GACJ;AACA,EAAA,OAAO,CAAC,QAAA,CAAS,MAAM,CAAA,EAAG,WAAW,OAAO,CAAA;AAChD;;"}
|
|
1
|
+
{"version":3,"file":"react.js","sources":["react.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { SystemConfig as ChakraSystemConfig } from \"@chakra-ui/react\";\nimport { constant, ReadonlyReactive } from \"@conterra/reactivity-core\";\nimport type { ColorModeValue, PackageIntl, Service } from \"@open-pioneer/runtime\";\nimport {\n APP_ROOT_CLASS,\n CustomChakraProvider,\n PackageContext,\n PackageContextMethods\n} from \"@open-pioneer/runtime/test-support\";\nimport { FC, ReactNode, useInsertionEffect, useMemo } from \"react\";\nimport { createIntl } from \"./vanilla\";\n\n/** Any service instance. The type is relaxed on purpose to allow test mocks. */\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyService = Service<any>;\n\n/** Props of {@link PackageContextProvider}. */\nexport interface PackageContextProviderProps {\n /** Interface implementations, keyed by interface name. */\n services?: {\n [interfaceName: string]: AnyService;\n };\n\n /** Interface implementations, keyed by interface name and then by qualifier. */\n qualifiedServices?: {\n [interfaceName: string]: {\n [qualifier: string]: AnyService;\n };\n };\n\n /** Package properties (keyed by package name). */\n properties?: {\n [packageName: string]: Record<string, unknown>;\n };\n\n /**\n * The locale for i18n messages and formatting.\n *\n * @default \"en\"\n */\n locale?: string;\n\n /**\n * The color mode.\n */\n colorMode?: ColorModeValue;\n\n /**\n * Chakra styled system object.\n *\n * Used to configure chakra's theme, like `chakraSystemConfig` of `createCustomElement()`.\n * Defaults to the trails base theme.\n */\n chakraSystemConfig?: ChakraSystemConfig;\n\n /**\n * I18n messages for packages\n */\n messages?: {\n /**\n * I18n messages as (messageId, message) entries.\n *\n * @default {}\n */\n [packageName: string]: Record<string, string>;\n };\n\n /** Children to render */\n children?: ReactNode;\n}\n\n/**\n * Injects services and properties into the component tree.\n * React components using Open Pioneer Trails hooks like `useService` and `useProperties`\n * will receive the mocked properties here instead.\n * Currently also wrapped with the CustomChakraProvider to support chakra-ui elements\n */\nexport const PackageContextProvider: FC<PackageContextProviderProps> = (props) => {\n const {\n children,\n services,\n qualifiedServices,\n properties,\n locale: localeProp,\n colorMode: colorModeProp,\n chakraSystemConfig,\n messages\n } = props;\n const config = useMemo(() => constant(chakraSystemConfig), [chakraSystemConfig]);\n const [locale, colorMode, contextMethods] = useMemo(\n () =>\n createPackageContextMethods({\n services,\n qualifiedServices,\n properties,\n locale: localeProp,\n colorMode: colorModeProp,\n messages\n }),\n [services, qualifiedServices, properties, localeProp, colorModeProp, messages]\n );\n\n useInsertionEffect(() => {\n // Needed for chakra tokens / theme etc. to be applied correctly.\n // In real applications, this is done as part of the web component startup code.\n // In test scenarios, the body is used as the root node (see props below).\n document.body.classList.add(APP_ROOT_CLASS);\n return () => {\n document.body.classList.remove(APP_ROOT_CLASS);\n };\n }, []);\n\n return (\n <CustomChakraProvider\n rootNode={document}\n appRoot={document.body}\n locale={locale}\n colorMode={colorMode}\n config={config}\n >\n <PackageContext.Provider value={contextMethods}>{children}</PackageContext.Provider>\n </CustomChakraProvider>\n );\n};\n\nfunction createPackageContextMethods(\n options: Omit<PackageContextProviderProps, \"children\">\n): [\n locale: ReadonlyReactive<string>,\n colorMode: ReadonlyReactive<ColorModeValue>,\n methods: PackageContextMethods\n] {\n const services = options?.services ?? {};\n const qualifiedServices = options?.qualifiedServices ?? {};\n const properties = options?.properties ?? {};\n const locale = options?.locale ?? \"en\";\n const messages = options?.messages ?? {};\n const cachedIntl: Record<string, PackageIntl> = {};\n const colorMode = constant<ColorModeValue>(options?.colorMode ?? \"light\");\n const methods: PackageContextMethods = {\n getService(packageName, interfaceName, options) {\n if (!options.qualifier) {\n const service = services[interfaceName];\n if (service) {\n return service;\n }\n const qualified = qualifiedServices[interfaceName];\n if (qualified) {\n for (const value of Object.values(qualified)) {\n return value; // Return any implementation\n }\n }\n throw new Error(\n `Interface name not bound for testing: '${interfaceName}'. Update the configuration of PackageContextProvider.`\n );\n }\n\n const qualifiedService = qualifiedServices[interfaceName]?.[options.qualifier];\n if (!qualifiedService) {\n throw new Error(\n `Interface name not bound for testing: '${interfaceName}' (qualifier '${options.qualifier}'). Update the configuration of PackageContextProvider.`\n );\n }\n return qualifiedService;\n },\n getServices(packageName, interfaceName) {\n const unqualified = services[interfaceName];\n const results = Object.values(qualifiedServices[interfaceName] ?? {});\n if (unqualified) {\n results.push(unqualified);\n }\n return results;\n },\n getProperties(packageName) {\n const packageProperties = properties[packageName];\n if (!packageProperties) {\n throw new Error(\n `No properties for package '${packageName}' bound for testing. Update the configuration of PackageContextProvider.`\n );\n }\n return packageProperties;\n },\n getIntl(packageName) {\n const initIntl = () => {\n const packageMessages = messages[packageName];\n return createIntl({\n locale: locale,\n messages: packageMessages\n });\n };\n return (cachedIntl[packageName] ??= initIntl());\n }\n };\n return [constant(locale), colorMode, methods];\n}\n"],"names":["options"],"mappings":";;;;;;AAgFO,MAAM,sBAAA,GAA0D,CAAC,KAAA,KAAU;AAC9E,EAAA,MAAM;AAAA,IACF,QAAA;AAAA,IACA,QAAA;AAAA,IACA,iBAAA;AAAA,IACA,UAAA;AAAA,IACA,MAAA,EAAQ,UAAA;AAAA,IACR,SAAA,EAAW,aAAA;AAAA,IACX,kBAAA;AAAA,IACA;AAAA,GACJ,GAAI,KAAA;AACJ,EAAA,MAAM,MAAA,GAAS,QAAQ,MAAM,QAAA,CAAS,kBAAkB,CAAA,EAAG,CAAC,kBAAkB,CAAC,CAAA;AAC/E,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAA,EAAW,cAAc,CAAA,GAAI,OAAA;AAAA,IACxC,MACI,2BAAA,CAA4B;AAAA,MACxB,QAAA;AAAA,MACA,iBAAA;AAAA,MACA,UAAA;AAAA,MACA,MAAA,EAAQ,UAAA;AAAA,MACR,SAAA,EAAW,aAAA;AAAA,MACX;AAAA,KACH,CAAA;AAAA,IACL,CAAC,QAAA,EAAU,iBAAA,EAAmB,UAAA,EAAY,UAAA,EAAY,eAAe,QAAQ;AAAA,GACjF;AAEA,EAAA,kBAAA,CAAmB,MAAM;AAIrB,IAAA,QAAA,CAAS,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,cAAc,CAAA;AAC1C,IAAA,OAAO,MAAM;AACT,MAAA,QAAA,CAAS,IAAA,CAAK,SAAA,CAAU,MAAA,CAAO,cAAc,CAAA;AAAA,IACjD,CAAA;AAAA,EACJ,CAAA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AO,CAAC,QAAA,CAAS,MAAM,CAAA,EAAG,WAAW,OAAO,CAAA;AAChD;;"}
|
package/services.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ type PartialServiceReferences<References> = {
|
|
|
42
42
|
/**
|
|
43
43
|
* Creates a new service instance of `clazz`.
|
|
44
44
|
*
|
|
45
|
-
* The options passed into the constructor of `clazz` are
|
|
45
|
+
* The options passed into the constructor of `clazz` are taken from the `options` parameter.
|
|
46
46
|
*
|
|
47
47
|
* This function allows the user to define mock- or test objects as service references.
|
|
48
48
|
*
|
package/services.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.js","sources":["services.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { reactive } from \"@conterra/reactivity-core\";\nimport { ReferenceMeta, Service, ServiceConstructor } from \"@open-pioneer/runtime\";\nimport { createIntl } from \"./vanilla\";\n\n/**\n * Options for the {@link createService} function.\n */\nexport interface CreateServiceOptions<References> {\n /**\n * References provided to the service constructor.\n *\n * @default {}\n */\n references?: PartialServiceReferences<References>;\n\n /**\n * Properties provided to the service constructor.\n *\n * @default {}\n */\n properties?: Record<string, unknown>;\n\n /**\n * The locale for i18n messages and formatting.\n *\n * @default \"en\"\n */\n locale?: string;\n\n /**\n * The locale for embedded default messages.\n *\n * See also https://formatjs.io/docs/intl#message-descriptor\n *\n * @default \"en\"\n */\n defaultMessageLocale?: string;\n\n /**\n * I18n messages as (messageId, message) entries.\n *\n * @default {}\n */\n messages?: Record<string, string>;\n}\n\ntype PartialServiceReferences<References> = {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n [referenceName in keyof References]?: References[referenceName] extends any[]\n ? Partial<References[referenceName][number]>[]\n : Partial<References[referenceName]>;\n};\n\n/**\n * Creates a new service instance of `clazz`.\n *\n * The options passed into the constructor of `clazz` are
|
|
1
|
+
{"version":3,"file":"services.js","sources":["services.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { reactive } from \"@conterra/reactivity-core\";\nimport { ReferenceMeta, Service, ServiceConstructor } from \"@open-pioneer/runtime\";\nimport { createIntl } from \"./vanilla\";\n\n/**\n * Options for the {@link createService} function.\n */\nexport interface CreateServiceOptions<References> {\n /**\n * References provided to the service constructor.\n *\n * @default {}\n */\n references?: PartialServiceReferences<References>;\n\n /**\n * Properties provided to the service constructor.\n *\n * @default {}\n */\n properties?: Record<string, unknown>;\n\n /**\n * The locale for i18n messages and formatting.\n *\n * @default \"en\"\n */\n locale?: string;\n\n /**\n * The locale for embedded default messages.\n *\n * See also https://formatjs.io/docs/intl#message-descriptor\n *\n * @default \"en\"\n */\n defaultMessageLocale?: string;\n\n /**\n * I18n messages as (messageId, message) entries.\n *\n * @default {}\n */\n messages?: Record<string, string>;\n}\n\ntype PartialServiceReferences<References> = {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n [referenceName in keyof References]?: References[referenceName] extends any[]\n ? Partial<References[referenceName][number]>[]\n : Partial<References[referenceName]>;\n};\n\n/**\n * Creates a new service instance of `clazz`.\n *\n * The options passed into the constructor of `clazz` are taken from the `options` parameter.\n *\n * This function allows the user to define mock- or test objects as service references.\n *\n * Most type-checking features are disabled for convenience, but by default this function's types\n * enforce that a value provided for a reference must match the partial interface of the actually required type.\n *\n * For example, if a service depends on `{ ctx: ApplicationContext }`, this function ensures\n * that the test value for `ctx` implements `Partial<ApplicationContext>`.\n * This can of course be disabled by casting the value explicitly.\n *\n * @param clazz a service class\n * @param options options passed to the service constructor\n * @returns a new instance of the given service class\n */\nexport function createService<References extends {}, Interface extends {}>(\n clazz: ServiceConstructor<References, Interface>,\n options?: CreateServiceOptions<References>\n): Service<Interface> {\n const references = options?.references ?? {};\n const referencesMeta = Object.fromEntries(\n Object.entries(references).map(([referenceName, reference]) => [\n referenceName,\n referenceMeta(referenceName, reference)\n ])\n );\n\n const intl = createIntl(options);\n return new clazz({\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n references: references as any,\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n referencesMeta: referencesMeta as any,\n properties: options?.properties ?? {},\n intl,\n currentIntl: reactive(intl)\n });\n}\n\nfunction referenceMeta(referenceName: string, reference: unknown): ReferenceMeta | ReferenceMeta[] {\n if (Array.isArray(reference)) {\n return reference.map<ReferenceMeta>((_, index) => ({\n serviceId: `test-utils::${referenceName}-${index}`\n }));\n }\n return {\n serviceId: `test-utils::${referenceName}`\n };\n}\n"],"names":[],"mappings":";;;AA0EO,SAAS,aAAA,CACZ,OACA,OAAA,EACkB;AAClB,EAAA,MAAM,UAAA,GAAa,OAAA,EAAS,UAAA,IAAc,EAAC;AAC3C,EAAA,MAAM,iBAAiB,MAAA,CAAO,WAAA;AAAA,IAC1B,MAAA,CAAO,QAAQ,UAAU,CAAA,CAAE,IAAI,CAAC,CAAC,aAAA,EAAe,SAAS,CAAA,KAAM;AAAA,MAC3D,aAAA;AAAA,MACA,aAAA,CAAc,eAAe,SAAS;AAAA,KACzC;AAAA,GACL;AAEA,EAAA,MAAM,IAAA,GAAO,WAAW,OAAO,CAAA;AAC/B,EAAA,OAAO,IAAI,KAAA,CAAM;AAAA;AAAA,IAEb,UAAA;AAAA;AAAA,IAEA,cAAA;AAAA,IACA,UAAA,EAAY,OAAA,EAAS,UAAA,IAAc,EAAC;AAAA,IACpC,IAAA;AAAA,IACA,WAAA,EAAa,SAAS,IAAI;AAAA,GAC7B,CAAA;AACL;AAEA,SAAS,aAAA,CAAc,eAAuB,SAAA,EAAqD;AAC/F,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,SAAS,CAAA,EAAG;AAC1B,IAAA,OAAO,SAAA,CAAU,GAAA,CAAmB,CAAC,CAAA,EAAG,KAAA,MAAW;AAAA,MAC/C,SAAA,EAAW,CAAA,YAAA,EAAe,aAAa,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,KACpD,CAAE,CAAA;AAAA,EACN;AACA,EAAA,OAAO;AAAA,IACH,SAAA,EAAW,eAAe,aAAa,CAAA;AAAA,GAC3C;AACJ;;"}
|
package/web-components.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Renders the given component into the DOM and returns the new node.
|
|
3
|
+
*
|
|
4
|
+
* The container (`document.body` by default) is emptied before the element is appended.
|
|
3
5
|
*/
|
|
4
6
|
export declare function renderComponent(component: CustomElementConstructor | string, options?: {
|
|
5
7
|
container?: HTMLElement;
|
package/web-components.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { waitFor, within } from '@testing-library/dom';
|
|
2
2
|
|
|
3
|
-
const GLOBAL =
|
|
3
|
+
const GLOBAL = globalThis;
|
|
4
4
|
function nextId() {
|
|
5
|
-
GLOBAL
|
|
6
|
-
const id = GLOBAL
|
|
5
|
+
GLOBAL.__WEB_COMPONENT_COUNT__ ??= 0;
|
|
6
|
+
const id = GLOBAL.__WEB_COMPONENT_COUNT__ += 1;
|
|
7
7
|
return id;
|
|
8
8
|
}
|
|
9
9
|
async function renderComponent(component, options) {
|
package/web-components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-components.js","sources":["web-components.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { waitFor, within } from \"@testing-library/dom\";\n\
|
|
1
|
+
{"version":3,"file":"web-components.js","sources":["web-components.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { waitFor, within } from \"@testing-library/dom\";\n\nconst GLOBAL = globalThis as { __WEB_COMPONENT_COUNT__?: number };\n\nfunction nextId(): number {\n GLOBAL.__WEB_COMPONENT_COUNT__ ??= 0;\n const id = (GLOBAL.__WEB_COMPONENT_COUNT__ += 1);\n return id;\n}\n\n/**\n * Renders the given component into the DOM and returns the new node.\n *\n * The container (`document.body` by default) is emptied before the element is appended.\n */\nexport async function renderComponent(\n component: CustomElementConstructor | string,\n options?: {\n container?: HTMLElement;\n attributes?: Record<string, string>;\n }\n) {\n const tag = typeof component === \"string\" ? component : defineComponent(component);\n const container = options?.container ?? document.body;\n const node = container.ownerDocument.createElement(tag);\n for (const [key, value] of Object.entries(options?.attributes ?? {})) {\n node.setAttribute(key, value);\n }\n container.innerHTML = \"\";\n container.appendChild(node);\n return {\n node\n };\n}\n\n/**\n * Renders the given component into the DOM (via {@link renderComponent}) and works on its shadow root.\n * In order to use this function, the shadow root should be attached as `open` from inside the component class.\n *\n * After the shadow root has been accessed, the function searches (and waits) for an inner root container (by default `.pioneer-root`)\n * where all other searches should be executed.\n *\n * Returns the shadow root, the inner container, and a bound queries object that automatically searches in the inner container\n * instead of the whole document.\n */\nexport async function renderComponentShadowDOM(\n component: CustomElementConstructor | string,\n options?: {\n container?: HTMLElement;\n attributes?: Record<string, string>;\n innerContainerSelector?: string;\n }\n) {\n const { node } = await renderComponent(component, options);\n const selector = options?.innerContainerSelector ?? \".pioneer-root\";\n const { shadowRoot, innerContainer } = await waitFor(() => {\n const shadowRoot = node.shadowRoot;\n if (!shadowRoot) {\n throw new Error(\"Shadow root not attached.\");\n }\n const innerContainer = shadowRoot.querySelector<HTMLElement>(selector);\n if (!innerContainer) {\n throw new Error(\"Inner container not ready.\");\n }\n return { shadowRoot, innerContainer };\n });\n\n const queries = within(innerContainer);\n return {\n node,\n shadowRoot,\n innerContainer,\n queries\n };\n}\n\n/**\n * Defines the given component and returns the unique tag name.\n * This helper is necessary because tag names must not collide in the global elements registry (and\n * un-registration is not possible).\n */\nexport function defineComponent(\n component: CustomElementConstructor,\n options?: {\n nameHint?: string;\n }\n) {\n const nameHint = options?.nameHint ?? \"test-component\";\n const tag = `${nameHint}-${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