@genesislcap/foundation-testing 9.0.1-alpha-b5c5eb7.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.
Files changed (124) hide show
  1. package/MODULE_FEDERATION.md +11 -0
  2. package/README.md +255 -0
  3. package/dist/1.0.0.remoteEntry.js +1 -0
  4. package/dist/191.0099ca6c24422254d51d36c222dc6023.js.map +1 -0
  5. package/dist/191.191.613504f8a55556ba573c.js +2 -0
  6. package/dist/259.1ff0e7689abdc0527a57f2eb20369ada.js.map +1 -0
  7. package/dist/259.259.724449a74ba114ef0d82.js +2 -0
  8. package/dist/415.32cf4cabeed75f5d759d12434a4de5c7.js.map +1 -0
  9. package/dist/415.415.ee8e35767118401bccab.js +3 -0
  10. package/dist/415.415.ee8e35767118401bccab.js.LICENSE.txt +4 -0
  11. package/dist/623.1b885cabcffad0807eeb0de7ad5dd497.js.map +1 -0
  12. package/dist/623.623.148af50848667bfda381.js +3 -0
  13. package/dist/623.623.148af50848667bfda381.js.LICENSE.txt +4 -0
  14. package/dist/755.497b49c90948bc3e157823cb2632c52a.js.map +1 -0
  15. package/dist/755.755.5f9603173373118bd373.js +2 -0
  16. package/dist/772.772.6fed5dfc27e91bebaacc.js +2 -0
  17. package/dist/772.8116969a190f5c8bc076b1604d507de7.js.map +1 -0
  18. package/dist/dashboard.json +1 -0
  19. package/dist/dts/component/fixture.d.ts +93 -0
  20. package/dist/dts/component/fixture.d.ts.map +1 -0
  21. package/dist/dts/component/index.d.ts +2 -0
  22. package/dist/dts/component/index.d.ts.map +1 -0
  23. package/dist/dts/index.d.ts +11 -0
  24. package/dist/dts/index.d.ts.map +1 -0
  25. package/dist/dts/index.federated.d.ts +1 -0
  26. package/dist/dts/index.federated.d.ts.map +1 -0
  27. package/dist/dts/jsdom/setup.d.ts +14 -0
  28. package/dist/dts/jsdom/setup.d.ts.map +1 -0
  29. package/dist/dts/playwright/index.d.ts +5 -0
  30. package/dist/dts/playwright/index.d.ts.map +1 -0
  31. package/dist/dts/playwright/setup.d.ts +13 -0
  32. package/dist/dts/playwright/setup.d.ts.map +1 -0
  33. package/dist/dts/playwright/test.d.ts +16 -0
  34. package/dist/dts/playwright/test.d.ts.map +1 -0
  35. package/dist/dts/suite/index.d.ts +2 -0
  36. package/dist/dts/suite/index.d.ts.map +1 -0
  37. package/dist/dts/suite/suite.d.ts +127 -0
  38. package/dist/dts/suite/suite.d.ts.map +1 -0
  39. package/dist/dts/utils/index.d.ts +2 -0
  40. package/dist/dts/utils/index.d.ts.map +1 -0
  41. package/dist/dts/utils/logger.d.ts +8 -0
  42. package/dist/dts/utils/logger.d.ts.map +1 -0
  43. package/dist/dts/uvu/index.d.ts +2 -0
  44. package/dist/dts/uvu/index.d.ts.map +1 -0
  45. package/dist/dts/uvu/uvu.d.ts +8 -0
  46. package/dist/dts/uvu/uvu.d.ts.map +1 -0
  47. package/dist/esm/component/fixture.js +87 -0
  48. package/dist/esm/component/fixture.js.map +1 -0
  49. package/dist/esm/component/index.js +2 -0
  50. package/dist/esm/component/index.js.map +1 -0
  51. package/dist/esm/index.federated.js +2 -0
  52. package/dist/esm/index.federated.js.map +1 -0
  53. package/dist/esm/index.js +11 -0
  54. package/dist/esm/index.js.map +1 -0
  55. package/dist/esm/jsdom/setup.js +92 -0
  56. package/dist/esm/jsdom/setup.js.map +1 -0
  57. package/dist/esm/playwright/index.js +5 -0
  58. package/dist/esm/playwright/index.js.map +1 -0
  59. package/dist/esm/playwright/setup.js +24 -0
  60. package/dist/esm/playwright/setup.js.map +1 -0
  61. package/dist/esm/playwright/test.js +22 -0
  62. package/dist/esm/playwright/test.js.map +1 -0
  63. package/dist/esm/suite/index.js +2 -0
  64. package/dist/esm/suite/index.js.map +1 -0
  65. package/dist/esm/suite/suite.js +144 -0
  66. package/dist/esm/suite/suite.js.map +1 -0
  67. package/dist/esm/utils/index.js +2 -0
  68. package/dist/esm/utils/index.js.map +1 -0
  69. package/dist/esm/utils/logger.js +9 -0
  70. package/dist/esm/utils/logger.js.map +1 -0
  71. package/dist/esm/uvu/index.js +2 -0
  72. package/dist/esm/uvu/index.js.map +1 -0
  73. package/dist/esm/uvu/uvu.js +8 -0
  74. package/dist/esm/uvu/uvu.js.map +1 -0
  75. package/dist/favicon.ico +0 -0
  76. package/dist/foundation-testing.api.json +1288 -0
  77. package/dist/foundation-testing.d.ts +255 -0
  78. package/dist/foundation-testing.iife.min.js +15 -0
  79. package/dist/foundation-testing.js +6991 -0
  80. package/dist/foundation-testing.min.js +15 -0
  81. package/dist/foundationTesting.db8dd99e6cb1a53c58d5d48831729dc0.js.map +1 -0
  82. package/dist/index.ejs +23 -0
  83. package/dist/index.html +14 -0
  84. package/dist/info.ejs +13 -0
  85. package/dist/main.c5f312e26acb28a2836d58614701899c.js.map +1 -0
  86. package/dist/main.ce9669d02474786f9fdc.js +2 -0
  87. package/dist/npm.consola.713.2f64f3cac7864c3b4057.js +2 -0
  88. package/dist/npm.consola.8813a44257414a02ed3be5608793f087.js.map +1 -0
  89. package/dist/npm.diff.83d06b572c2ee1bd4957fc9f121bf65a.js.map +1 -0
  90. package/dist/npm.diff.852.9166591dbfda57fefcc7.js +2 -0
  91. package/dist/npm.microsoft.127.8c2d0309b2c5ee49f9ed.js +1469 -0
  92. package/dist/npm.microsoft.127.8c2d0309b2c5ee49f9ed.js.LICENSE.txt +14 -0
  93. package/dist/npm.microsoft.53571229b0cfc6a6b1b069cfe9a8483d.js.map +1 -0
  94. package/dist/remoteEntry.js +2 -0
  95. package/dist/serve.json +3 -0
  96. package/dist/tsdoc-metadata.json +11 -0
  97. package/docs/api/foundation-testing.componentcontext.container.md +11 -0
  98. package/docs/api/foundation-testing.componentcontext.designsystem.md +11 -0
  99. package/docs/api/foundation-testing.componentcontext.md +22 -0
  100. package/docs/api/foundation-testing.createcomponentsuite.md +93 -0
  101. package/docs/api/foundation-testing.createlogicsuite.md +54 -0
  102. package/docs/api/foundation-testing.elementgetter.md +12 -0
  103. package/docs/api/foundation-testing.fixture.connect.md +21 -0
  104. package/docs/api/foundation-testing.fixture.disconnect.md +21 -0
  105. package/docs/api/foundation-testing.fixture.document.md +13 -0
  106. package/docs/api/foundation-testing.fixture.element.md +13 -0
  107. package/docs/api/foundation-testing.fixture.md +31 -0
  108. package/docs/api/foundation-testing.fixture.parent.md +18 -0
  109. package/docs/api/foundation-testing.fixture.template.md +13 -0
  110. package/docs/api/foundation-testing.fixture.view.md +13 -0
  111. package/docs/api/foundation-testing.fixtureoptions.context.md +13 -0
  112. package/docs/api/foundation-testing.fixtureoptions.designsystem.md +13 -0
  113. package/docs/api/foundation-testing.fixtureoptions.document.md +13 -0
  114. package/docs/api/foundation-testing.fixtureoptions.md +24 -0
  115. package/docs/api/foundation-testing.fixtureoptions.parent.md +13 -0
  116. package/docs/api/foundation-testing.fixtureoptions.source.md +13 -0
  117. package/docs/api/foundation-testing.logger.md +18 -0
  118. package/docs/api/foundation-testing.logiccontext.md +20 -0
  119. package/docs/api/foundation-testing.logiccontext.runcases.md +23 -0
  120. package/docs/api/foundation-testing.md +35 -0
  121. package/docs/api/index.md +12 -0
  122. package/docs/api-report.md +87 -0
  123. package/license.txt +46 -0
  124. package/package.json +116 -0
@@ -0,0 +1,127 @@
1
+ import type { FoundationElement, FoundationElementDefinition, FoundationElementRegistry, Registration } from '@microsoft/fast-foundation';
2
+ import { Container, DesignSystem } from '@microsoft/fast-foundation';
3
+ import { assert, uvu } from '../uvu';
4
+ import { Fixture } from '../component';
5
+ /**
6
+ * @public
7
+ */
8
+ export type ElementGetter = () => FoundationElementRegistry<FoundationElementDefinition, FoundationElement>;
9
+ /**
10
+ * Component suite context interface
11
+ * @public
12
+ */
13
+ export interface ComponentContext<TElement = HTMLElement> extends Pick<Fixture<TElement>, 'element' | 'disconnect'> {
14
+ designSystem: DesignSystem;
15
+ container: Container;
16
+ }
17
+ /**
18
+ * Logic suite context interface
19
+ * @public
20
+ */
21
+ export interface LogicContext {
22
+ runCases?(fn: (value: any) => any, cases: [any, any, assert.Message?][]): void;
23
+ }
24
+ /**
25
+ * Create component test suite.
26
+ *
27
+ * @example
28
+ * Simple suite using the tag name of the component.
29
+ * ```ts
30
+ * import { createComponentSuite } from '@genesislcap/foundation-testing';
31
+ * import { Component } from './component';
32
+ * Component; // < As we're using tag name in the Suite, we hold a reference to avoid tree shaking.
33
+ * const Suite = createComponentSuite<Component>('Component', 'my-component');
34
+ * // test cases...
35
+ * Suite.run();
36
+ * ```
37
+ *
38
+ * @example
39
+ * Mocking a DI dependency for a composable component.
40
+ * ```ts
41
+ * const connectMock = new ConnectMock();
42
+ * const mocks = [Registration.instance(Connect, connectMock)];
43
+ * const Suite = createComponentSuite<ConnectionIndicator>('ConnectionIndicator Component', () => connectionIndicator(), null, mocks);
44
+ * // test cases...
45
+ * Suite.run();
46
+ * ```
47
+ *
48
+ * @example
49
+ * An element will be required to test anything that directly or in-directly makes use of the DI container, for example,
50
+ * a service that can be injected into components, or has its own injected dependencies.
51
+ * ```ts
52
+ * import { Service } from './service';
53
+ * @customElement({
54
+ * name: 'test-element',
55
+ * template: html`<slot></slot>`,
56
+ * })
57
+ * class TestElement extends FASTElement {}
58
+ * const mocks = [...];
59
+ * const Suite = createComponentSuite<TestElement>('Service', 'test-element', null, mocks);
60
+ * // test cases...
61
+ * Suite.run();
62
+ * ```
63
+ *
64
+ * Importing the service should invoke the Service's DI registration, so in your test cases you can simply query the
65
+ * container to get a reference to your service.
66
+ * ```ts
67
+ * Suite('Service.x does something expected', async ({ container }) => {
68
+ * const myService = container.get(Service);
69
+ * // assert
70
+ * });
71
+ * ```
72
+ *
73
+ * You can optionally add the service to the test element for lookup convenience, but this is not required.
74
+ * ```ts
75
+ * class TestElement extends FASTElement {
76
+ * @Service service: Service;
77
+ * }
78
+ * Suite('Element has service injected', async ({ element }) => {
79
+ * assert.ok(element.service);
80
+ * });
81
+ * ```
82
+ *
83
+ * @typeParam TElement - The element interface.
84
+ * @param title - Title of the test suite
85
+ * @param elementNameOrGetter - Element tag name or getter which is used to create the element within the fixture
86
+ * @param context - Optional component context {@link ComponentContext}
87
+ * @param registrations - Optional array of DI container registrations
88
+ * @returns The test suite
89
+ * @public
90
+ * @remarks
91
+ * Used to test function output given certain input arguments.
92
+ */
93
+ export declare function createComponentSuite<TElement = HTMLElement>(title: string, elementNameOrGetter: string | ElementGetter, context?: ComponentContext<TElement>, registrations?: Registration<any>[]): uvu.Test<ComponentContext<TElement>>;
94
+ /**
95
+ * Create logic test suite.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * import { createLogicSuite } from '@genesislcap/foundation-testing';
100
+ * import { myFunction } from './logic';
101
+ * const Suite = createLogicSuite('myFunction');
102
+ * Suite('myFunction should provide expected results', ({ runCases }) => {
103
+ * runCases(myFunction, [
104
+ * [['1'], true],
105
+ * [[123], true],
106
+ * [['60%'], true],
107
+ * [['$60'], false],
108
+ * [['1.1'], false],
109
+ * [[''], false],
110
+ * [[true], false],
111
+ * [[null], false],
112
+ * [[undefined], false],
113
+ * ]);
114
+ * });
115
+ * Suite.run();
116
+ * ```
117
+ *
118
+ * @typeParam TContext - The context interface.
119
+ * @param title - Title of the test suite
120
+ * @param context - Optional context which extends {@link LogicContext}
121
+ * @returns The test suite
122
+ * @public
123
+ * @remarks
124
+ * Used to test function output given certain input arguments.
125
+ */
126
+ export declare function createLogicSuite<TContext = LogicContext>(title: string, context?: TContext): uvu.Test<TContext>;
127
+ //# sourceMappingURL=suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../../../src/suite/suite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,2BAA2B,EAC3B,yBAAyB,EACzB,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAM,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,MAAM,EAAS,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,OAAO,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.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Test logger
3
+ * @public
4
+ * @remarks
5
+ * Exported so you can set log levels differently across packages when needed.
6
+ */
7
+ export declare const logger: import("@genesislcap/foundation-utils").Logger;
8
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,MAAM,gDAAqC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './uvu';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/uvu/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { suite, test, uvu } from 'uvu';
2
+ import * as assert from 'uvu/assert';
3
+ /**
4
+ * UVU assert, suite, test and uvu itself
5
+ * @public
6
+ */
7
+ export { assert, suite, test, uvu };
8
+ //# sourceMappingURL=uvu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uvu.d.ts","sourceRoot":"","sources":["../../../src/uvu/uvu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,YAAY,CAAC;AAErC;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { __awaiter } from "tslib";
2
+ import { defaultExecutionContext, ViewTemplate, } from '@microsoft/fast-element';
3
+ import { DesignSystem, } from '@microsoft/fast-foundation';
4
+ function findElement(view) {
5
+ let current = view.firstChild;
6
+ while (current !== null && current.nodeType !== 1) {
7
+ current = current.nextSibling;
8
+ }
9
+ return current;
10
+ }
11
+ function isElementRegistry(obj) {
12
+ return typeof obj.register === 'function';
13
+ }
14
+ /**
15
+ * Creates a test fixture suitable for testing custom elements, templates, and bindings.
16
+ * @param templateNameOrRegistry - An HTML template or single element name to create the fixture for.
17
+ * @param options - Enables customizing fixture creation behavior.
18
+ * @returns A promise of the test fixture {@link Fixture}.
19
+ *
20
+ * @public
21
+ * @remarks
22
+ * Yields control to the caller one Microtask later, in order to
23
+ * ensure that the DOM has settled. This has changed in the latest version of FAST!
24
+ */
25
+ export function fixture(templateNameOrRegistry, options = {}) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const document = options.document || globalThis.document;
28
+ const parent = options.parent || document.createElement('div');
29
+ const source = options.source || {};
30
+ const context = options.context || defaultExecutionContext;
31
+ if (typeof templateNameOrRegistry === 'string') {
32
+ const html = `<${templateNameOrRegistry}></${templateNameOrRegistry}>`;
33
+ templateNameOrRegistry = new ViewTemplate(html, []);
34
+ }
35
+ else if (isElementRegistry(templateNameOrRegistry)) {
36
+ templateNameOrRegistry = [templateNameOrRegistry];
37
+ }
38
+ if (Array.isArray(templateNameOrRegistry)) {
39
+ const first = templateNameOrRegistry[0];
40
+ const ds = options.designSystem || DesignSystem.getOrCreate(parent);
41
+ let prefix = '';
42
+ ds.register(templateNameOrRegistry, {
43
+ register(container, dsContext) {
44
+ prefix = dsContext.elementPrefix;
45
+ },
46
+ });
47
+ const elementName = `${prefix}-${first.definition.baseName}`;
48
+ const html = `<${elementName}></${elementName}>`;
49
+ templateNameOrRegistry = new ViewTemplate(html, []);
50
+ }
51
+ const view = templateNameOrRegistry.create();
52
+ const element = findElement(view);
53
+ let isConnected = false;
54
+ view.bind(source, context);
55
+ view.appendTo(parent);
56
+ customElements.upgrade(parent);
57
+ // Hook into the Microtask Queue to ensure the DOM is settled
58
+ // before yielding control to the caller.
59
+ yield Promise.resolve();
60
+ const connect = () => __awaiter(this, void 0, void 0, function* () {
61
+ if (isConnected) {
62
+ return;
63
+ }
64
+ isConnected = true;
65
+ document.body.appendChild(parent);
66
+ yield Promise.resolve();
67
+ });
68
+ const disconnect = () => __awaiter(this, void 0, void 0, function* () {
69
+ if (!isConnected) {
70
+ return;
71
+ }
72
+ isConnected = false;
73
+ document.body.removeChild(parent);
74
+ yield Promise.resolve();
75
+ });
76
+ return {
77
+ document,
78
+ template: templateNameOrRegistry,
79
+ view,
80
+ parent,
81
+ element,
82
+ connect,
83
+ disconnect,
84
+ };
85
+ });
86
+ }
87
+ //# sourceMappingURL=fixture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixture.js","sourceRoot":"","sources":["../../../src/component/fixture.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,uBAAuB,EAGvB,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,YAAY,GAIb,MAAM,4BAA4B,CAAC;AAyFpC,SAAS,WAAW,CAAC,IAAc;IACjC,IAAI,OAAO,GAAgB,IAAI,CAAC,UAAU,CAAC;IAE3C,OAAO,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;QACjD,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;KAC/B;IAED,OAAO,OAAc,CAAC;AACxB,CAAC;AAED,SAAS,iBAAiB,CACxB,GAAQ;IAER,OAAO,OAAO,GAAG,CAAC,QAAQ,KAAK,UAAU,CAAC;AAC5C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAgB,OAAO,CAC3B,sBAOK,EACL,UAA0B,EAAE;;QAE5B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC;QACzD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,O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AC,MAAM,CAAC,CAAC;QAE/B,6DAA6D;QAC7D,yCAAyC;QACzC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QAExB,MAAM,OAAO,GAAG,GAAS,EAAE;YACzB,IAAI,WAAW,EAAE;gBACf,OAAO;aACR;YAED,WAAW,GAAG,IAAI,CAAC;YACnB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAClC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC,CAAA,CAAC;QAEF,MAAM,UAAU,GAAG,GAAS,EAAE;YAC5B,IAAI,CAAC,WAAW,EAAE;gBAChB,OAAO;aACR;YAED,WAAW,GAAG,KAAK,CAAC;YACpB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAClC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC,CAAA,CAAC;QAEF,OAAO;YACL,QAAQ;YACR,QAAQ,EAAE,sBAAsB;YAChC,IAAI;YACJ,MAAM;YACN,OAAO;YACP,OAAO;YACP,UAAU;SACX,CAAC;IACJ,CAAC;CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './fixture';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/component/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ import('./index');
2
+ //# sourceMappingURL=index.federated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.federated.js","sourceRoot":"","sources":["../../src/index.federated.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,SAAS,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Implemented by objects that wish to register dependencies in the container
3
+ * by creating resolvers.
4
+ * @public
5
+ */
6
+ export { Registration } from '@microsoft/fast-foundation';
7
+ export * from './component';
8
+ export * from './suite';
9
+ export * from './utils';
10
+ export * from './uvu';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { __awaiter } from "tslib";
2
+ import { JSDOM } from 'jsdom';
3
+ /**
4
+ * Jsdom setup.
5
+ * @public
6
+ */
7
+ export const setup = () => __awaiter(void 0, void 0, void 0, function* () {
8
+ const { window } = new JSDOM('<!DOCTYPE html><html lang="en"><head></head><body></body></html>', {
9
+ pretendToBeVisual: true,
10
+ url: 'https://localhost',
11
+ });
12
+ window.matchMedia = () => ({
13
+ matches: false,
14
+ addListener: () => { },
15
+ removeListener: () => { },
16
+ });
17
+ window.CSSStyleSheet.prototype.insertRule = function (rule, index) {
18
+ const styleElement = document.createElement('style');
19
+ const textNode = document.createTextNode(rule);
20
+ styleElement.appendChild(textNode);
21
+ document.head.appendChild(styleElement);
22
+ return 0;
23
+ };
24
+ globalThis.window = window;
25
+ globalThis.customElements = window.customElements;
26
+ globalThis.CSSStyleSheet = window.CSSStyleSheet;
27
+ globalThis.CustomEvent = window.CustomEvent;
28
+ globalThis.document = window.document;
29
+ globalThis.Document = window.Document;
30
+ globalThis.HTMLDialogElement = window.HTMLDialogElement;
31
+ globalThis.HTMLElement = window.HTMLElement;
32
+ globalThis.HTMLInputElement = window.HTMLInputElement;
33
+ globalThis.HTMLOptionElement = window.HTMLOptionElement;
34
+ globalThis.HTMLSelectElement = window.HTMLSelectElement;
35
+ globalThis.HTMLStyleElement = window.HTMLStyleElement;
36
+ globalThis.KeyboardEvent = window.KeyboardEvent;
37
+ globalThis.localStorage = window.localStorage;
38
+ globalThis.sessionStorage = window.sessionStorage;
39
+ globalThis.MutationObserver = window.MutationObserver;
40
+ globalThis.navigator = window.navigator;
41
+ globalThis.location = window.location;
42
+ globalThis.Node = window.Node;
43
+ globalThis.Option = window.Option;
44
+ globalThis.requestAnimationFrame = window.requestAnimationFrame;
45
+ globalThis.ShadowRoot = window.ShadowRoot;
46
+ // Cross-Env Variables
47
+ globalThis.FORCE_HTTP = false;
48
+ globalThis.HTTP_CONFIG = '';
49
+ });
50
+ /**
51
+ * Jsdom teardown / cleanup.
52
+ * @public
53
+ * @remarks
54
+ * This strictly is not required, but may be useful for certain test runs. If used, be mindful that you will need to
55
+ * call setup again before the next test run.
56
+ */
57
+ export const teardown = () => __awaiter(void 0, void 0, void 0, function* () {
58
+ delete window.matchMedia;
59
+ delete globalThis.window;
60
+ delete globalThis.customElements;
61
+ delete globalThis.CSSStyleSheet;
62
+ delete globalThis.CustomEvent;
63
+ delete globalThis.document;
64
+ delete globalThis.Document;
65
+ delete globalThis.HTMLDialogElement;
66
+ delete globalThis.HTMLElement;
67
+ delete globalThis.HTMLInputElement;
68
+ delete globalThis.HTMLOptionElement;
69
+ delete globalThis.HTMLSelectElement;
70
+ delete globalThis.HTMLStyleElement;
71
+ delete globalThis.KeyboardEvent;
72
+ delete globalThis.localStorage;
73
+ delete globalThis.MutationObserver;
74
+ delete globalThis.navigator;
75
+ delete globalThis.location;
76
+ delete globalThis.Node;
77
+ delete globalThis.Option;
78
+ delete globalThis.requestAnimationFrame;
79
+ delete globalThis.ShadowRoot;
80
+ // Cross-Env Variables
81
+ delete globalThis.FORCE_HTTP;
82
+ delete globalThis.HTTP_CONFIG;
83
+ /**
84
+ * Cancel all timers etc.
85
+ */
86
+ window.close();
87
+ });
88
+ /**
89
+ * Run setup on import by default.
90
+ */
91
+ setup();
92
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/jsdom/setup.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE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U,CAAC,iBAAiB,CAAC;IACpC,OAAO,UAAU,CAAC,WAAW,CAAC;IAC9B,OAAO,UAAU,CAAC,gBAAgB,CAAC;IACnC,OAAO,UAAU,CAAC,iBAAiB,CAAC;IACpC,OAAO,UAAU,CAAC,iBAAiB,CAAC;IACpC,OAAO,UAAU,CAAC,gBAAgB,CAAC;IACnC,OAAO,UAAU,CAAC,aAAa,CAAC;IAChC,OAAO,UAAU,CAAC,YAAY,CAAC;IAC/B,OAAO,UAAU,CAAC,gBAAgB,CAAC;IACnC,OAAO,UAAU,CAAC,SAAS,CAAC;IAC5B,OAAO,UAAU,CAAC,QAAQ,CAAC;IAC3B,OAAO,UAAU,CAAC,IAAI,CAAC;IACvB,OAAO,UAAU,CAAC,MAAM,CAAC;IACzB,OAAO,UAAU,CAAC,qBAAqB,CAAC;IACxC,OAAO,UAAU,CAAC,UAAU,CAAC;IAE7B,sBAAsB;IACtB,OAAO,UAAU,CAAC,UAAU,CAAC;IAC7B,OAAO,UAAU,CAAC,WAAW,CAAC;IAE9B;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,CAAC;AACjB,CAAC,CAAA,CAAC;AAEF;;GAEG;AACH,KAAK,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Do not export setup
3
+ */
4
+ export * from './test';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/playwright/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { __awaiter } from "tslib";
2
+ /**
3
+ * @param config - A playwright configuration object.
4
+ * @returns A teardown function.
5
+ *
6
+ * @public
7
+ * @remarks
8
+ * This is just an example playwright setup that returns a noddy teardown. In reality, you will likely create a custom
9
+ * setup / page for your e2e tests depending on the needs of your app or micro frontend.
10
+ */
11
+ function setup(config) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ process.env.FOO = 'some data';
14
+ process.env.BAR = JSON.stringify({ some: 'data' });
15
+ return function teardown() {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ delete process.env.FOO;
18
+ delete process.env.BAR;
19
+ });
20
+ };
21
+ });
22
+ }
23
+ export default setup;
24
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/playwright/setup.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AACH,SAAe,KAAK,CAAC,MAAkB;;QACrC,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,WAAW,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACnD,OAAO,SAAe,QAAQ;;gBAC5B,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBACvB,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YACzB,CAAC;SAAA,CAAC;IACJ,CAAC;CAAA;AAED,eAAe,KAAK,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { __awaiter } from "tslib";
2
+ import { test as base } from '@playwright/test';
3
+ /**
4
+ * Playwright test.
5
+ * @public
6
+ * @remarks
7
+ * This is just an example playwright test fixture stub. In reality, you will likely create a custom
8
+ * fixture for your e2e tests depending on the needs of your app or micro frontend.
9
+ */
10
+ export const test = base.extend({
11
+ hostPage: ({ page }, use) => __awaiter(void 0, void 0, void 0, function* () {
12
+ /**
13
+ * const host = new HostPage(page);
14
+ * await host.goto();
15
+ * await host.addSomeThing('something');
16
+ * await use(host);
17
+ * await host.destroy();
18
+ */
19
+ yield use(null);
20
+ }),
21
+ });
22
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.js","sourceRoot":"","sources":["../../../src/playwright/test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAUhD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAW;IACxC,QAAQ,EAAE,CAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;QAChC;;;;;;WAMG;QACH,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './suite';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/suite/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,144 @@
1
+ import { __awaiter } from "tslib";
2
+ import { DesignSystem, DI } from '@microsoft/fast-foundation';
3
+ import { assert, suite } from '../uvu';
4
+ import { fixture as FASTFixture } from '../component';
5
+ /**
6
+ * Create component test suite.
7
+ *
8
+ * @example
9
+ * Simple suite using the tag name of the component.
10
+ * ```ts
11
+ * import { createComponentSuite } from '@genesislcap/foundation-testing';
12
+ * import { Component } from './component';
13
+ * Component; // < As we're using tag name in the Suite, we hold a reference to avoid tree shaking.
14
+ * const Suite = createComponentSuite<Component>('Component', 'my-component');
15
+ * // test cases...
16
+ * Suite.run();
17
+ * ```
18
+ *
19
+ * @example
20
+ * Mocking a DI dependency for a composable component.
21
+ * ```ts
22
+ * const connectMock = new ConnectMock();
23
+ * const mocks = [Registration.instance(Connect, connectMock)];
24
+ * const Suite = createComponentSuite<ConnectionIndicator>('ConnectionIndicator Component', () => connectionIndicator(), null, mocks);
25
+ * // test cases...
26
+ * Suite.run();
27
+ * ```
28
+ *
29
+ * @example
30
+ * An element will be required to test anything that directly or in-directly makes use of the DI container, for example,
31
+ * a service that can be injected into components, or has its own injected dependencies.
32
+ * ```ts
33
+ * import { Service } from './service';
34
+ * @customElement({
35
+ * name: 'test-element',
36
+ * template: html`<slot></slot>`,
37
+ * })
38
+ * class TestElement extends FASTElement {}
39
+ * const mocks = [...];
40
+ * const Suite = createComponentSuite<TestElement>('Service', 'test-element', null, mocks);
41
+ * // test cases...
42
+ * Suite.run();
43
+ * ```
44
+ *
45
+ * Importing the service should invoke the Service's DI registration, so in your test cases you can simply query the
46
+ * container to get a reference to your service.
47
+ * ```ts
48
+ * Suite('Service.x does something expected', async ({ container }) => {
49
+ * const myService = container.get(Service);
50
+ * // assert
51
+ * });
52
+ * ```
53
+ *
54
+ * You can optionally add the service to the test element for lookup convenience, but this is not required.
55
+ * ```ts
56
+ * class TestElement extends FASTElement {
57
+ * @Service service: Service;
58
+ * }
59
+ * Suite('Element has service injected', async ({ element }) => {
60
+ * assert.ok(element.service);
61
+ * });
62
+ * ```
63
+ *
64
+ * @typeParam TElement - The element interface.
65
+ * @param title - Title of the test suite
66
+ * @param elementNameOrGetter - Element tag name or getter which is used to create the element within the fixture
67
+ * @param context - Optional component context {@link ComponentContext}
68
+ * @param registrations - Optional array of DI container registrations
69
+ * @returns The test suite
70
+ * @public
71
+ * @remarks
72
+ * Used to test function output given certain input arguments.
73
+ */
74
+ export function createComponentSuite(title, elementNameOrGetter, context, registrations = []) {
75
+ const Suite = suite(title, Object.assign({ element: undefined, disconnect: undefined, designSystem: undefined, container: undefined }, context));
76
+ Suite.before.each((c) => __awaiter(this, void 0, void 0, function* () {
77
+ const parent = document.createElement('div');
78
+ const designSystem = DesignSystem.getOrCreate(parent).register(...registrations);
79
+ const container = DI.getOrCreateDOMContainer(parent);
80
+ const fixtureOptions = {
81
+ parent,
82
+ designSystem,
83
+ };
84
+ /**
85
+ * We might need to spread element getters for some test case, for example look at the following Fast test:
86
+ * packages/web-components/fast-foundation/src/picker/picker.spec.ts
87
+ */
88
+ const { element, connect, disconnect } = yield FASTFixture(typeof elementNameOrGetter === 'string' ? elementNameOrGetter : elementNameOrGetter(), fixtureOptions);
89
+ c.element = element;
90
+ c.disconnect = disconnect;
91
+ c.designSystem = designSystem;
92
+ c.container = container;
93
+ yield connect();
94
+ }));
95
+ /* eslint-disable require-atomic-updates */
96
+ Suite.after.each((c) => __awaiter(this, void 0, void 0, function* () {
97
+ yield c.disconnect();
98
+ c.element = undefined;
99
+ c.disconnect = undefined;
100
+ c.designSystem = undefined;
101
+ c.container = undefined;
102
+ }));
103
+ return Suite;
104
+ }
105
+ /**
106
+ * Create logic test suite.
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * import { createLogicSuite } from '@genesislcap/foundation-testing';
111
+ * import { myFunction } from './logic';
112
+ * const Suite = createLogicSuite('myFunction');
113
+ * Suite('myFunction should provide expected results', ({ runCases }) => {
114
+ * runCases(myFunction, [
115
+ * [['1'], true],
116
+ * [[123], true],
117
+ * [['60%'], true],
118
+ * [['$60'], false],
119
+ * [['1.1'], false],
120
+ * [[''], false],
121
+ * [[true], false],
122
+ * [[null], false],
123
+ * [[undefined], false],
124
+ * ]);
125
+ * });
126
+ * Suite.run();
127
+ * ```
128
+ *
129
+ * @typeParam TContext - The context interface.
130
+ * @param title - Title of the test suite
131
+ * @param context - Optional context which extends {@link LogicContext}
132
+ * @returns The test suite
133
+ * @public
134
+ * @remarks
135
+ * Used to test function output given certain input arguments.
136
+ */
137
+ export function createLogicSuite(title, context) {
138
+ const Suite = suite(title, Object.assign({ runCases: (fn, cases) => {
139
+ assert.type(fn, 'function');
140
+ cases.forEach(([actual, expects, msg]) => assert.is(fn(...actual), expects, msg));
141
+ } }, context));
142
+ return Suite;
143
+ }
144
+ //# sourceMappingURL=suite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suite.js","sourceRoot":"","sources":["../../../src/suite/suite.ts"],"names":[],"mappings":";AAMA,OAAO,EAAa,YAAY,EAAE,EAAE,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAO,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAW,OAAO,IAAI,WAAW,EAAkB,MAAM,cAAc,CAAC;AA4B/E;;;;;;;;;;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AAU,EAAE,CAAC;QACrB,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC;QACtB,CAAC,CAAC,UAAU,GAAG,SAAS,CAAC;QACzB,CAAC,CAAC,YAAY,GAAG,SAAS,CAAC;QAC3B,CAAC,CAAC,SAAS,GAAG,SAAS,CAAC;IAC1B,CAAC,CAAA,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAa,EACb,OAAkB;IAElB,MAAM,KAAK,GAAG,KAAK,CAAW,KAAK,kBACjC,QAAQ,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;YACtB,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;YAC5B,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QACpF,CAAC,IACE,OAAO,EACV,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './logger';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { createLogger } from '@genesislcap/foundation-utils';
2
+ /**
3
+ * Test logger
4
+ * @public
5
+ * @remarks
6
+ * Exported so you can set log levels differently across packages when needed.
7
+ */
8
+ export const logger = createLogger('foundation-testing');
9
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './uvu';
2
+ //# sourceMappingURL=index.js.map