@genesislcap/foundation-testing 13.4.0 → 13.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/jsdom/setup.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,KAAK,qBA8CjB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,qBAgCpB,CAAC"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/jsdom/setup.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,KAAK,qBA4CjB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,qBAsCpB,CAAC"}
@@ -2,6 +2,19 @@ import type { FoundationElement, FoundationElementDefinition, FoundationElementR
2
2
  import { Container, DesignSystem } from '@microsoft/fast-foundation';
3
3
  import { Fixture } from '../component';
4
4
  import { assert, uvu } from '../uvu';
5
+ /**
6
+ * @public
7
+ */
8
+ export type RunCases = (fn: (...args: unknown[]) => unknown, cases: [unknown[], unknown, string?][]) => void;
9
+ /**
10
+ * Assert a set of test cases.
11
+ *
12
+ * @remarks
13
+ * This is available as part of the suite context, but can also be run standalone.
14
+ *
15
+ * @public
16
+ */
17
+ export declare function runCases(fn: (...args: unknown[]) => unknown, cases: [unknown[], unknown, string?][]): void;
5
18
  /**
6
19
  * @public
7
20
  */
@@ -13,12 +26,17 @@ export type ElementGetter = () => FoundationElementRegistry<FoundationElementDef
13
26
  export interface ComponentContext<TElement = HTMLElement> extends Pick<Fixture<TElement>, 'element' | 'disconnect'> {
14
27
  designSystem: DesignSystem;
15
28
  container: Container;
29
+ runCases: RunCases;
16
30
  }
17
31
  /**
18
32
  * Logic suite context interface
19
33
  * @public
20
34
  */
21
35
  export interface LogicContext {
36
+ /**
37
+ * @privateRemarks
38
+ * Not hardening the typing on this to RunCases until get a feel for usages.
39
+ */
22
40
  runCases?(fn: (value: any) => any, cases: [any, any, assert.Message?][]): void;
23
41
  }
24
42
  /**
@@ -1 +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,OAAO,EAA0C,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAS,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,yBAAyB,CACzD,2BAA2B,EAC3B,iBAAiB,CAClB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,QAAQ,GAAG,WAAW,CACtD,SAAQ,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IACzD,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;CAChF;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,GAAG,W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,19 +14,18 @@ export const setup = () => __awaiter(void 0, void 0, void 0, function* () {
14
14
  addListener: () => { },
15
15
  removeListener: () => { },
16
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
17
  globalThis.window = window;
25
18
  globalThis.customElements = window.customElements;
19
+ globalThis.CSSImportRule = window.CSSImportRule;
20
+ globalThis.CSSMediaRule = window.CSSMediaRule;
21
+ globalThis.CSSRule = window.CSSRule;
22
+ globalThis.CSSStyleDeclaration = window.CSSStyleDeclaration;
23
+ globalThis.CSSStyleRule = window.CSSStyleRule;
26
24
  globalThis.CSSStyleSheet = window.CSSStyleSheet;
27
25
  globalThis.CustomEvent = window.CustomEvent;
28
26
  globalThis.document = window.document;
29
27
  globalThis.Document = window.Document;
28
+ globalThis.DocumentFragment = window.DocumentFragment;
30
29
  globalThis.HTMLDialogElement = window.HTMLDialogElement;
31
30
  globalThis.HTMLElement = window.HTMLElement;
32
31
  globalThis.HTMLInputElement = window.HTMLInputElement;
@@ -58,10 +57,16 @@ export const teardown = () => __awaiter(void 0, void 0, void 0, function* () {
58
57
  delete window.matchMedia;
59
58
  delete globalThis.window;
60
59
  delete globalThis.customElements;
60
+ delete globalThis.CSSImportRule;
61
+ delete globalThis.CSSMediaRule;
62
+ delete globalThis.CSSRule;
63
+ delete globalThis.CSSStyleDeclaration;
64
+ delete globalThis.CSSStyleRule;
61
65
  delete globalThis.CSSStyleSheet;
62
66
  delete globalThis.CustomEvent;
63
67
  delete globalThis.document;
64
68
  delete globalThis.Document;
69
+ delete globalThis.DocumentFragment;
65
70
  delete globalThis.HTMLDialogElement;
66
71
  delete globalThis.HTMLElement;
67
72
  delete globalThis.HTMLInputElement;
@@ -1,7 +1,20 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { DesignSystem, DI } from '@microsoft/fast-foundation';
3
3
  import { fixture as FASTFixture } from '../component';
4
+ import { logger } from '../utils';
4
5
  import { assert, suite } from '../uvu';
6
+ /**
7
+ * Assert a set of test cases.
8
+ *
9
+ * @remarks
10
+ * This is available as part of the suite context, but can also be run standalone.
11
+ *
12
+ * @public
13
+ */
14
+ export function runCases(fn, cases) {
15
+ assert.type(fn, 'function');
16
+ cases.forEach(([actual, expects, msg], index) => assert.is(fn(...actual), expects, msg !== null && msg !== void 0 ? msg : JSON.stringify(actual, null, 2)));
17
+ }
5
18
  /**
6
19
  * Create component test suite.
7
20
  *
@@ -72,33 +85,49 @@ import { assert, suite } from '../uvu';
72
85
  * Used to test function output given certain input arguments.
73
86
  */
74
87
  export function createComponentSuite(title, elementNameOrGetter, context, registrations = []) {
75
- const Suite = suite(title, Object.assign({ element: undefined, disconnect: undefined, designSystem: undefined, container: undefined }, context));
88
+ const Suite = suite(title, Object.assign({ element: undefined, disconnect: undefined, designSystem: undefined, container: undefined, runCases: undefined }, context));
76
89
  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();
90
+ try {
91
+ const parent = document.createElement('div');
92
+ const designSystem = DesignSystem.getOrCreate(parent).register(...registrations);
93
+ const container = DI.getOrCreateDOMContainer(parent);
94
+ const fixtureOptions = {
95
+ parent,
96
+ designSystem,
97
+ };
98
+ /**
99
+ * We might need to spread element getters for some test case, for example look at the following Fast test:
100
+ * packages/web-components/fast-foundation/src/picker/picker.spec.ts
101
+ */
102
+ const { element, connect, disconnect } = yield FASTFixture(typeof elementNameOrGetter === 'string' ? elementNameOrGetter : elementNameOrGetter(), fixtureOptions);
103
+ c.element = element;
104
+ c.disconnect = disconnect;
105
+ c.designSystem = designSystem;
106
+ c.container = container;
107
+ c.runCases = runCases.bind(Suite);
108
+ yield connect();
109
+ }
110
+ catch (e) {
111
+ logger.error(e);
112
+ throw e;
113
+ }
94
114
  }));
95
115
  /* eslint-disable require-atomic-updates */
96
116
  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;
117
+ try {
118
+ if (c.disconnect) {
119
+ yield c.disconnect();
120
+ }
121
+ c.element = undefined;
122
+ c.disconnect = undefined;
123
+ c.designSystem = undefined;
124
+ c.container = undefined;
125
+ c.runCases = undefined;
126
+ }
127
+ catch (e) {
128
+ logger.error(e);
129
+ throw e;
130
+ }
102
131
  }));
103
132
  return Suite;
104
133
  }
@@ -286,6 +286,34 @@
286
286
  "startIndex": 1,
287
287
  "endIndex": 2
288
288
  }
289
+ },
290
+ {
291
+ "kind": "PropertySignature",
292
+ "canonicalReference": "@genesislcap/foundation-testing!ComponentContext#runCases:member",
293
+ "docComment": "",
294
+ "excerptTokens": [
295
+ {
296
+ "kind": "Content",
297
+ "text": "runCases: "
298
+ },
299
+ {
300
+ "kind": "Reference",
301
+ "text": "RunCases",
302
+ "canonicalReference": "@genesislcap/foundation-testing!RunCases:type"
303
+ },
304
+ {
305
+ "kind": "Content",
306
+ "text": ";"
307
+ }
308
+ ],
309
+ "isReadonly": false,
310
+ "isOptional": false,
311
+ "releaseTag": "Public",
312
+ "name": "runCases",
313
+ "propertyTypeTokenRange": {
314
+ "startIndex": 1,
315
+ "endIndex": 2
316
+ }
289
317
  }
290
318
  ],
291
319
  "extendsTokenRanges": [
@@ -1497,6 +1525,93 @@
1497
1525
  ],
1498
1526
  "name": "resetTestHarness"
1499
1527
  },
1528
+ {
1529
+ "kind": "Function",
1530
+ "canonicalReference": "@genesislcap/foundation-testing!runCases:function(1)",
1531
+ "docComment": "/**\n * Assert a set of test cases.\n *\n * @remarks\n *\n * This is available as part of the suite context, but can also be run standalone.\n *\n * @public\n */\n",
1532
+ "excerptTokens": [
1533
+ {
1534
+ "kind": "Content",
1535
+ "text": "export declare function runCases(fn: "
1536
+ },
1537
+ {
1538
+ "kind": "Content",
1539
+ "text": "(...args: unknown[]) => unknown"
1540
+ },
1541
+ {
1542
+ "kind": "Content",
1543
+ "text": ", cases: "
1544
+ },
1545
+ {
1546
+ "kind": "Content",
1547
+ "text": "[unknown[], unknown, string?][]"
1548
+ },
1549
+ {
1550
+ "kind": "Content",
1551
+ "text": "): "
1552
+ },
1553
+ {
1554
+ "kind": "Content",
1555
+ "text": "void"
1556
+ },
1557
+ {
1558
+ "kind": "Content",
1559
+ "text": ";"
1560
+ }
1561
+ ],
1562
+ "fileUrlPath": "src/suite/suite.ts",
1563
+ "returnTypeTokenRange": {
1564
+ "startIndex": 5,
1565
+ "endIndex": 6
1566
+ },
1567
+ "releaseTag": "Public",
1568
+ "overloadIndex": 1,
1569
+ "parameters": [
1570
+ {
1571
+ "parameterName": "fn",
1572
+ "parameterTypeTokenRange": {
1573
+ "startIndex": 1,
1574
+ "endIndex": 2
1575
+ },
1576
+ "isOptional": false
1577
+ },
1578
+ {
1579
+ "parameterName": "cases",
1580
+ "parameterTypeTokenRange": {
1581
+ "startIndex": 3,
1582
+ "endIndex": 4
1583
+ },
1584
+ "isOptional": false
1585
+ }
1586
+ ],
1587
+ "name": "runCases"
1588
+ },
1589
+ {
1590
+ "kind": "TypeAlias",
1591
+ "canonicalReference": "@genesislcap/foundation-testing!RunCases:type",
1592
+ "docComment": "/**\n * @public\n */\n",
1593
+ "excerptTokens": [
1594
+ {
1595
+ "kind": "Content",
1596
+ "text": "export type RunCases = "
1597
+ },
1598
+ {
1599
+ "kind": "Content",
1600
+ "text": "(fn: (...args: unknown[]) => unknown, cases: [unknown[], unknown, string?][]) => void"
1601
+ },
1602
+ {
1603
+ "kind": "Content",
1604
+ "text": ";"
1605
+ }
1606
+ ],
1607
+ "fileUrlPath": "src/suite/suite.ts",
1608
+ "releaseTag": "Public",
1609
+ "name": "RunCases",
1610
+ "typeTokenRange": {
1611
+ "startIndex": 1,
1612
+ "endIndex": 2
1613
+ }
1614
+ },
1500
1615
  {
1501
1616
  "kind": "TypeAlias",
1502
1617
  "canonicalReference": "@genesislcap/foundation-testing!SinonWrapper:type",
@@ -24,6 +24,7 @@ export { assert }
24
24
  export declare interface ComponentContext<TElement = HTMLElement> extends Pick<Fixture<TElement>, 'element' | 'disconnect'> {
25
25
  designSystem: DesignSystem;
26
26
  container: Container;
27
+ runCases: RunCases;
27
28
  }
28
29
 
29
30
  /**
@@ -262,6 +263,10 @@ export declare const logger: Logger;
262
263
  * @public
263
264
  */
264
265
  export declare interface LogicContext {
266
+ /**
267
+ * @privateRemarks
268
+ * Not hardening the typing on this to RunCases until get a feel for usages.
269
+ */
265
270
  runCases?(fn: (value: any) => any, cases: [any, any, assert.Message?][]): void;
266
271
  }
267
272
 
@@ -275,6 +280,21 @@ export { Registration }
275
280
  */
276
281
  export declare function resetTestHarness<T>(wrapper: WithTestHarness<T>): void;
277
282
 
283
+ /**
284
+ * @public
285
+ */
286
+ export declare type RunCases = (fn: (...args: unknown[]) => unknown, cases: [unknown[], unknown, string?][]) => void;
287
+
288
+ /**
289
+ * Assert a set of test cases.
290
+ *
291
+ * @remarks
292
+ * This is available as part of the suite context, but can also be run standalone.
293
+ *
294
+ * @public
295
+ */
296
+ export declare function runCases(fn: (...args: unknown[]) => unknown, cases: [unknown[], unknown, string?][]): void;
297
+
278
298
  /**
279
299
  * Crates an object with a key value pair for each spied function
280
300
  * where the key is the function name and the value is the sinon wrapped
@@ -19,4 +19,5 @@ export interface ComponentContext<TElement = HTMLElement> extends Pick<Fixture<T
19
19
  | --- | --- | --- | --- |
20
20
  | [container](./foundation-testing.componentcontext.container.md) | | Container | |
21
21
  | [designSystem](./foundation-testing.componentcontext.designsystem.md) | | DesignSystem | |
22
+ | [runCases](./foundation-testing.componentcontext.runcases.md) | | [RunCases](./foundation-testing.runcases.md) | |
22
23
 
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-testing](./foundation-testing.md) &gt; [ComponentContext](./foundation-testing.componentcontext.md) &gt; [runCases](./foundation-testing.componentcontext.runcases.md)
4
+
5
+ ## ComponentContext.runCases property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ runCases: RunCases;
11
+ ```
@@ -12,6 +12,7 @@
12
12
  | [createLogicSuite(title, context)](./foundation-testing.createlogicsuite.md) | Create logic test suite. |
13
13
  | [fixture(templateNameOrRegistry, options)](./foundation-testing.fixture.md) | Creates a test fixture suitable for testing custom elements, templates, and bindings. |
14
14
  | [resetTestHarness(wrapper)](./foundation-testing.resettestharness.md) | Resets items tracked during testing such as calls to spied functions. Must be called at the end of every test even if not asserting on the spies. |
15
+ | [runCases(fn, cases)](./foundation-testing.runcases.md) | Assert a set of test cases. |
15
16
  | [testSpy(constructor)](./foundation-testing.testspy.md) | Decorator: Used on a test harness class based on a <code>FoundationElement</code> to give it extra functionality which can be used during testing. \*Important\* this is to be used on a parent element compared to the element under test. |
16
17
 
17
18
  ## Interfaces
@@ -37,6 +38,7 @@
37
38
  | [Equal](./foundation-testing.equal.md) | Expects that the type parameter X is equal to Y, returning true or false |
38
39
  | [Expect](./foundation-testing.expect.md) | Expects that the type parameter T resolves to true, or will be a typescript error |
39
40
  | [FilterConditionally](./foundation-testing.filterconditionally.md) | Filters out key/value pairs from an object where they value does not match a condition |
41
+ | [RunCases](./foundation-testing.runcases.md) | |
40
42
  | [SinonWrapper](./foundation-testing.sinonwrapper.md) | Crates an object with a key value pair for each spied function where the key is the function name and the value is the sinon wrapped spy function |
41
43
  | [SpiedFunctions](./foundation-testing.spiedfunctions.md) | Filters out all key/value pairs which are not functions, and omits the constructor |
42
44
  | [SuiteCallback](./foundation-testing.suitecallback.md) | Defines the Generic type for a test Suite <code>T</code> the callback function required to assert on type <code>T</code>. |
@@ -0,0 +1,12 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-testing](./foundation-testing.md) &gt; [RunCases](./foundation-testing.runcases.md)
4
+
5
+ ## RunCases type
6
+
7
+
8
+ **Signature:**
9
+
10
+ ```typescript
11
+ export type RunCases = (fn: (...args: unknown[]) => unknown, cases: [unknown[], unknown, string?][]) => void;
12
+ ```
@@ -29,6 +29,8 @@ export interface ComponentContext<TElement = HTMLElement> extends Pick<Fixture<T
29
29
  container: Container;
30
30
  // (undocumented)
31
31
  designSystem: DesignSystem;
32
+ // (undocumented)
33
+ runCases: RunCases;
32
34
  }
33
35
 
34
36
  // @public
@@ -91,6 +93,12 @@ export { Registration }
91
93
  // @public
92
94
  export function resetTestHarness<T>(wrapper: WithTestHarness<T>): void;
93
95
 
96
+ // @public (undocumented)
97
+ export type RunCases = (fn: (...args: unknown[]) => unknown, cases: [unknown[], unknown, string?][]) => void;
98
+
99
+ // @public
100
+ export function runCases(fn: (...args: unknown[]) => unknown, cases: [unknown[], unknown, string?][]): void;
101
+
94
102
  // @public
95
103
  export type SinonWrapper<T extends {
96
104
  [K in keyof T]: (...args: any) => any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-testing",
3
3
  "description": "Genesis Foundation Testing",
4
- "version": "13.4.0",
4
+ "version": "13.4.1",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -26,7 +26,8 @@
26
26
  "types": "./dist/dts/playwright/setup.d.ts",
27
27
  "default": "./dist/esm/playwright/setup.js"
28
28
  },
29
- "./package.json": "./package.json"
29
+ "./package.json": "./package.json",
30
+ "./tsm": "./tsm.js"
30
31
  },
31
32
  "config": {
32
33
  "PORT": 3050
@@ -103,7 +104,7 @@
103
104
  "webpack-merge": "^5.7.3"
104
105
  },
105
106
  "dependencies": {
106
- "@genesislcap/foundation-utils": "^13.4.0",
107
+ "@genesislcap/foundation-utils": "^13.4.1",
107
108
  "@microsoft/fast-element": "^1.7.0",
108
109
  "@microsoft/fast-foundation": "^2.33.2",
109
110
  "sinon": "15.0.1",
@@ -113,5 +114,5 @@
113
114
  "publishConfig": {
114
115
  "access": "public"
115
116
  },
116
- "gitHead": "09a56e5f2666a2ee29571d0974484439734329ff"
117
+ "gitHead": "ae97683df00f4ac5e64be542b5b25b4a1f13b86a"
117
118
  }
package/tsm.js ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Shared tsm config for apps to import and use in their tsm.js files.
3
+ *
4
+ * @example
5
+ * ```js
6
+ * const { config } = require('@genesislcap/foundation-testing/tsm');
7
+ *
8
+ * module.exports = config;
9
+ * ```
10
+ *
11
+ * @public
12
+ */
13
+ const config = {
14
+ '.css': {
15
+ loader: 'text',
16
+ },
17
+ '.svg': {
18
+ loader: 'dataurl',
19
+ },
20
+ '.jpg': {
21
+ loader: 'dataurl',
22
+ },
23
+ '.png': {
24
+ loader: 'dataurl',
25
+ },
26
+ };
27
+
28
+ module.exports = config;