@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,2 @@
1
+ var foundationTesting;(()=>{"use strict";var e,t,r,n,a,o,i,f,l,s,u,d,c={451:(e,t,r)=>{var n={"./index":()=>r.e(755).then((()=>()=>r(755)))},a=(e,t)=>(r.R=t,t=r.o(n,e)?n[e]():Promise.resolve().then((()=>{throw new Error('Module "'+e+'" does not exist in container.')})),r.R=void 0,t),o=(e,t)=>{if(r.S){var n=r.S.default,a="default";if(n&&n!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return r.S[a]=e,r.I(a,t)}};r.d(t,{get:()=>a,init:()=>o})}},p={};function h(e){var t=p[e];if(void 0!==t)return t.exports;var r=p[e]={exports:{}},n=!0;try{c[e].call(r.exports,r,r.exports,h),n=!1}finally{n&&delete p[e]}return r.exports}h.m=c,h.c=p,e=[],h.O=(t,r,n,a)=>{if(!r){var o=1/0;for(s=0;s<e.length;s++){for(var[r,n,a]=e[s],i=!0,f=0;f<r.length;f++)(!1&a||o>=a)&&Object.keys(h.O).every((e=>h.O[e](r[f])))?r.splice(f--,1):(i=!1,a<o&&(o=a));if(i){e.splice(s--,1);var l=n();void 0!==l&&(t=l)}}return t}a=a||0;for(var s=e.length;s>0&&e[s-1][2]>a;s--)e[s]=e[s-1];e[s]=[r,n,a]},h.d=(e,t)=>{for(var r in t)h.o(t,r)&&!h.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},h.f={},h.e=e=>Promise.all(Object.keys(h.f).reduce(((t,r)=>(h.f[r](e,t),t)),[])),h.u=e=>(({127:"npm.microsoft",713:"npm.consola",852:"npm.diff"}[e]||e)+"."+e+"."+{127:"8c2d0309b2c5ee49f9ed",147:"a54af8a5adb9094ffaff",191:"613504f8a55556ba573c",259:"724449a74ba114ef0d82",415:"ee8e35767118401bccab",495:"b11308e0e345099bb22e",623:"148af50848667bfda381",713:"2f64f3cac7864c3b4057",755:"5f9603173373118bd373",758:"a5dc6c57a41294ba6b90",772:"6fed5dfc27e91bebaacc",852:"9166591dbfda57fefcc7"}[e]+".js"),h.miniCssF=e=>{},h.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@genesislcap/foundation-testing:",h.l=(e,n,a,o)=>{if(t[e])t[e].push(n);else{var i,f;if(void 0!==a)for(var l=document.getElementsByTagName("script"),s=0;s<l.length;s++){var u=l[s];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+a){i=u;break}}i||(f=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,h.nc&&i.setAttribute("nonce",h.nc),i.setAttribute("data-webpack",r+a),i.src=e),t[e]=[n];var d=(r,n)=>{i.onerror=i.onload=null,clearTimeout(c);var a=t[e];if(delete t[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach((e=>e(n))),r)return r(n)},c=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),f&&document.head.appendChild(i)}},h.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{h.S={};var e={},t={};h.I=(r,n)=>{n||(n=[]);var a=t[r];if(a||(a=t[r]={}),!(n.indexOf(a)>=0)){if(n.push(a),e[r])return e[r];h.o(h.S,r)||(h.S[r]={});var o=h.S[r],i="@genesislcap/foundation-testing",f=(e,t,r,n)=>{var a=o[e]=o[e]||{},f=a[t];(!f||!f.loaded&&(!n!=!f.eager?n:i>f.from))&&(a[t]={get:r,from:i,eager:!!n})},l=[];if("default"===r)f("@genesislcap/foundation-utils","9.0.0",(()=>Promise.all([h.e(127),h.e(713),h.e(147),h.e(259),h.e(758)]).then((()=>()=>h(259))))),f("@microsoft/fast-element","1.11.0",(()=>h.e(127).then((()=>()=>h(759))))),f("@microsoft/fast-foundation","2.47.0",(()=>Promise.all([h.e(127),h.e(147),h.e(495),h.e(415)]).then((()=>()=>h(916))))),f("tslib","1.14.1",(()=>h.e(127).then((()=>()=>h(160))))),f("tslib","1.14.1",(()=>h.e(127).then((()=>()=>h(726))))),f("tslib","2.5.0",(()=>h.e(191).then((()=>()=>h(191)))));return l.length?e[r]=Promise.all(l).then((()=>e[r]=1)):e[r]=1}}})(),h.p="/",n=e=>{var t=e=>e.split(".").map((e=>+e==e?+e:e)),r=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=r[1]?t(r[1]):[];return r[2]&&(n.length++,n.push.apply(n,t(r[2]))),r[3]&&(n.push([]),n.push.apply(n,t(r[3]))),n},a=(e,t)=>{e=n(e),t=n(t);for(var r=0;;){if(r>=e.length)return r<t.length&&"u"!=(typeof t[r])[0];var a=e[r],o=(typeof a)[0];if(r>=t.length)return"u"==o;var i=t[r],f=(typeof i)[0];if(o!=f)return"o"==o&&"n"==f||"s"==f||"u"==o;if("o"!=o&&"u"!=o&&a!=i)return a<i;r++}},o=(e,t)=>{if(0 in e){t=n(t);var r=e[0],a=r<0;a&&(r=-r-1);for(var i=0,f=1,l=!0;;f++,i++){var s,u,d=f<e.length?(typeof e[f])[0]:"";if(i>=t.length||"o"==(u=(typeof(s=t[i]))[0]))return!l||("u"==d?f>r&&!a:""==d!=a);if("u"==u){if(!l||"u"!=d)return!1}else if(l)if(d==u)if(f<=r){if(s!=e[f])return!1}else{if(a?s>e[f]:s<e[f])return!1;s!=e[f]&&(l=!1)}else if("s"!=d&&"n"!=d){if(a||f<=r)return!1;l=!1,f--}else{if(f<=r||u<d!=a)return!1;l=!1}else"s"!=d&&"n"!=d&&(l=!1,f--)}}var c=[],p=c.pop.bind(c);for(i=1;i<e.length;i++){var h=e[i];c.push(1==h?p()|p():2==h?p()&p():h?o(h,t):!p())}return!!p()},i=(e,t,r)=>{var n=e[t];return(t=Object.keys(n).reduce(((e,t)=>!o(r,t)||e&&!a(e,t)?e:t),0))&&n[t]},f=e=>(e.loaded=1,e.get()),l=(e=>function(t,r,n,a){var o=h.I(t);return o&&o.then?o.then(e.bind(e,t,h.S[t],r,n,a)):e(t,h.S[t],r,n,a)})(((e,t,r,n,a)=>{var o=t&&h.o(t,r)&&i(t,r,n);return o?f(o):a()})),s={},u={147:()=>l("default","@microsoft/fast-element",[1,1,7,0],(()=>h.e(127).then((()=>()=>h(759))))),951:()=>l("default","@microsoft/fast-foundation",[1,2,33,2],(()=>Promise.all([h.e(127),h.e(495),h.e(623)]).then((()=>()=>h(916))))),304:()=>l("default","tslib",[1,2,3,1],(()=>h.e(191).then((()=>()=>h(191))))),495:()=>l("default","tslib",[1,2,3,1],(()=>h.e(127).then((()=>()=>h(726))))),64:()=>l("default","@genesislcap/foundation-utils",[1,9,0,0],(()=>Promise.all([h.e(127),h.e(713),h.e(259)]).then((()=>()=>h(259)))))},d={147:[147],495:[495],758:[951,304],772:[64]},h.f.consumes=(e,t)=>{h.o(d,e)&&d[e].forEach((e=>{if(h.o(s,e))return t.push(s[e]);var r=t=>{s[e]=0,h.m[e]=r=>{delete h.c[e],r.exports=t()}},n=t=>{delete s[e],h.m[e]=r=>{throw delete h.c[e],t}};try{var a=u[e]();a.then?t.push(s[e]=a.then(r).catch(n)):r(a)}catch(e){n(e)}}))},(()=>{var e={466:0,490:0};h.f.j=(t,r)=>{var n=h.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else if(/^(49[05]|147|758)$/.test(t))e[t]=0;else{var a=new Promise(((r,a)=>n=e[t]=[r,a]));r.push(n[2]=a);var o=h.p+h.u(t),i=new Error;h.l(o,(r=>{if(h.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;i.message="Loading chunk "+t+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,n[1](i)}}),"chunk-"+t,t)}},h.O.j=t=>0===e[t];var t=(t,r)=>{var n,a,[o,i,f]=r,l=0;for(n in i)h.o(i,n)&&(h.m[n]=i[n]);if(f)var s=f(h);for(t&&t(r);l<o.length;l++)a=o[l],h.o(e,a)&&e[a]&&e[a][0](),e[o[l]]=0;return h.O(s)},r=self.webpackChunk_genesislcap_foundation_testing=self.webpackChunk_genesislcap_foundation_testing||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var v=h.O(void 0,[490],(()=>h(451)));v=h.O(v),foundationTesting=v})();
2
+ //# sourceMappingURL=foundationTesting.db8dd99e6cb1a53c58d5d48831729dc0.js.map
@@ -0,0 +1,3 @@
1
+ {
2
+ "rewrites": [ { "source": "/**", "destination": "/index.html" } ]
3
+ }
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.34.4"
9
+ }
10
+ ]
11
+ }
@@ -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; [container](./foundation-testing.componentcontext.container.md)
4
+
5
+ ## ComponentContext.container property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ container: Container;
11
+ ```
@@ -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; [designSystem](./foundation-testing.componentcontext.designsystem.md)
4
+
5
+ ## ComponentContext.designSystem property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ designSystem: DesignSystem;
11
+ ```
@@ -0,0 +1,22 @@
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)
4
+
5
+ ## ComponentContext interface
6
+
7
+ Component suite context interface
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export interface ComponentContext<TElement = HTMLElement> extends Pick<Fixture<TElement>, 'element' | 'disconnect'>
13
+ ```
14
+ **Extends:** Pick&lt;[Fixture](./foundation-testing.fixture.md)<!-- -->&lt;TElement&gt;, 'element' \| 'disconnect'&gt;
15
+
16
+ ## Properties
17
+
18
+ | Property | Modifiers | Type | Description |
19
+ | --- | --- | --- | --- |
20
+ | [container](./foundation-testing.componentcontext.container.md) | | Container | |
21
+ | [designSystem](./foundation-testing.componentcontext.designsystem.md) | | DesignSystem | |
22
+
@@ -0,0 +1,93 @@
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; [createComponentSuite](./foundation-testing.createcomponentsuite.md)
4
+
5
+ ## createComponentSuite() function
6
+
7
+ Create component test suite.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function createComponentSuite<TElement = HTMLElement>(title: string, elementNameOrGetter: string | ElementGetter, context?: ComponentContext<TElement>, registrations?: Registration<any>[]): uvu.Test<ComponentContext<TElement>>;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | title | string | Title of the test suite |
20
+ | elementNameOrGetter | string \| [ElementGetter](./foundation-testing.elementgetter.md) | Element tag name or getter which is used to create the element within the fixture |
21
+ | context | [ComponentContext](./foundation-testing.componentcontext.md)<!-- -->&lt;TElement&gt; | _(Optional)_ Optional component context [ComponentContext](./foundation-testing.componentcontext.md) |
22
+ | registrations | Registration&lt;any&gt;\[\] | _(Optional)_ Optional array of DI container registrations |
23
+
24
+ **Returns:**
25
+
26
+ uvu.Test&lt;[ComponentContext](./foundation-testing.componentcontext.md)<!-- -->&lt;TElement&gt;&gt;
27
+
28
+ The test suite
29
+
30
+ ## Remarks
31
+
32
+ Used to test function output given certain input arguments.
33
+
34
+ ## Example 1
35
+
36
+ Simple suite using the tag name of the component.
37
+
38
+ ```ts
39
+ import { createComponentSuite } from '@genesislcap/foundation-testing';
40
+ import { Component } from './component';
41
+ Component; // < As we're using tag name in the Suite, we hold a reference to avoid tree shaking.
42
+ const Suite = createComponentSuite<Component>('Component', 'my-component');
43
+ // test cases...
44
+ Suite.run();
45
+ ```
46
+
47
+ ## Example 2
48
+
49
+ Mocking a DI dependency for a composable component.
50
+
51
+ ```ts
52
+ const connectMock = new ConnectMock();
53
+ const mocks = [Registration.instance(Connect, connectMock)];
54
+ const Suite = createComponentSuite<ConnectionIndicator>('ConnectionIndicator Component', () => connectionIndicator(), null, mocks);
55
+ // test cases...
56
+ Suite.run();
57
+ ```
58
+
59
+ ## Example 3
60
+
61
+ An element will be required to test anything that directly or in-directly makes use of the DI container, for example, a service that can be injected into components, or has its own injected dependencies.
62
+
63
+ ```ts
64
+ import { Service } from './service';
65
+ @customElement({
66
+ name: 'test-element',
67
+ template: html`<slot></slot>`,
68
+ })
69
+ class TestElement extends FASTElement {}
70
+ const mocks = [...];
71
+ const Suite = createComponentSuite<TestElement>('Service', 'test-element', null, mocks);
72
+ // test cases...
73
+ Suite.run();
74
+ ```
75
+ Importing the service should invoke the Service's DI registration, so in your test cases you can simply query the container to get a reference to your service.
76
+
77
+ ```ts
78
+ Suite('Service.x does something expected', async ({ container }) => {
79
+ const myService = container.get(Service);
80
+ // assert
81
+ });
82
+ ```
83
+ You can optionally add the service to the test element for lookup convenience, but this is not required.
84
+
85
+ ```ts
86
+ class TestElement extends FASTElement {
87
+ @Service service: Service;
88
+ }
89
+ Suite('Element has service injected', async ({ element }) => {
90
+ assert.ok(element.service);
91
+ });
92
+ ```
93
+
@@ -0,0 +1,54 @@
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; [createLogicSuite](./foundation-testing.createlogicsuite.md)
4
+
5
+ ## createLogicSuite() function
6
+
7
+ Create logic test suite.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function createLogicSuite<TContext = LogicContext>(title: string, context?: TContext): uvu.Test<TContext>;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | title | string | Title of the test suite |
20
+ | context | TContext | _(Optional)_ Optional context which extends [LogicContext](./foundation-testing.logiccontext.md) |
21
+
22
+ **Returns:**
23
+
24
+ uvu.Test&lt;TContext&gt;
25
+
26
+ The test suite
27
+
28
+ ## Remarks
29
+
30
+ Used to test function output given certain input arguments.
31
+
32
+ ## Example
33
+
34
+
35
+ ```ts
36
+ import { createLogicSuite } from '@genesislcap/foundation-testing';
37
+ import { myFunction } from './logic';
38
+ const Suite = createLogicSuite('myFunction');
39
+ Suite('myFunction should provide expected results', ({ runCases }) => {
40
+ runCases(myFunction, [
41
+ [['1'], true],
42
+ [[123], true],
43
+ [['60%'], true],
44
+ [['$60'], false],
45
+ [['1.1'], false],
46
+ [[''], false],
47
+ [[true], false],
48
+ [[null], false],
49
+ [[undefined], false],
50
+ ]);
51
+ });
52
+ Suite.run();
53
+ ```
54
+
@@ -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; [ElementGetter](./foundation-testing.elementgetter.md)
4
+
5
+ ## ElementGetter type
6
+
7
+
8
+ **Signature:**
9
+
10
+ ```typescript
11
+ export type ElementGetter = () => FoundationElementRegistry<FoundationElementDefinition, FoundationElement>;
12
+ ```
@@ -0,0 +1,21 @@
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; [Fixture](./foundation-testing.fixture.md) &gt; [connect](./foundation-testing.fixture.connect.md)
4
+
5
+ ## Fixture.connect() method
6
+
7
+ Adds the [Fixture.parent](./foundation-testing.fixture.parent.md) to the DOM, causing the connect lifecycle to begin.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ connect(): Promise<void>;
13
+ ```
14
+ **Returns:**
15
+
16
+ Promise&lt;void&gt;
17
+
18
+ ## Remarks
19
+
20
+ Yields control to the caller one Microtask later, in order to ensure that the DOM has settled.
21
+
@@ -0,0 +1,21 @@
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; [Fixture](./foundation-testing.fixture.md) &gt; [disconnect](./foundation-testing.fixture.disconnect.md)
4
+
5
+ ## Fixture.disconnect() method
6
+
7
+ Removes the [Fixture.parent](./foundation-testing.fixture.parent.md) from the DOM, causing the disconnect lifecycle to begin.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ disconnect(): Promise<void>;
13
+ ```
14
+ **Returns:**
15
+
16
+ Promise&lt;void&gt;
17
+
18
+ ## Remarks
19
+
20
+ Yields control to the caller one Microtask later, in order to ensure that the DOM has settled.
21
+
@@ -0,0 +1,13 @@
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; [Fixture](./foundation-testing.fixture.md) &gt; [document](./foundation-testing.fixture.document.md)
4
+
5
+ ## Fixture.document property
6
+
7
+ The document the fixture is running in.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ document: Document;
13
+ ```
@@ -0,0 +1,13 @@
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; [Fixture](./foundation-testing.fixture.md) &gt; [element](./foundation-testing.fixture.element.md)
4
+
5
+ ## Fixture.element property
6
+
7
+ The first element in the [Fixture.view](./foundation-testing.fixture.view.md)<!-- -->.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ element: TElement;
13
+ ```
@@ -0,0 +1,31 @@
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; [Fixture](./foundation-testing.fixture.md)
4
+
5
+ ## Fixture interface
6
+
7
+ Unit test fixture.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export interface Fixture<TElement = HTMLElement>
13
+ ```
14
+
15
+ ## Properties
16
+
17
+ | Property | Modifiers | Type | Description |
18
+ | --- | --- | --- | --- |
19
+ | [document](./foundation-testing.fixture.document.md) | | Document | The document the fixture is running in. |
20
+ | [element](./foundation-testing.fixture.element.md) | | TElement | The first element in the [Fixture.view](./foundation-testing.fixture.view.md)<!-- -->. |
21
+ | [parent](./foundation-testing.fixture.parent.md) | | HTMLElement | The parent element that the view was appended to. |
22
+ | [template](./foundation-testing.fixture.template.md) | | ViewTemplate | The template the fixture was created from. |
23
+ | [view](./foundation-testing.fixture.view.md) | | HTMLView | The view that was created from the fixture's template. |
24
+
25
+ ## Methods
26
+
27
+ | Method | Description |
28
+ | --- | --- |
29
+ | [connect()](./foundation-testing.fixture.connect.md) | Adds the [Fixture.parent](./foundation-testing.fixture.parent.md) to the DOM, causing the connect lifecycle to begin. |
30
+ | [disconnect()](./foundation-testing.fixture.disconnect.md) | Removes the [Fixture.parent](./foundation-testing.fixture.parent.md) from the DOM, causing the disconnect lifecycle to begin. |
31
+
@@ -0,0 +1,18 @@
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; [Fixture](./foundation-testing.fixture.md) &gt; [parent](./foundation-testing.fixture.parent.md)
4
+
5
+ ## Fixture.parent property
6
+
7
+ The parent element that the view was appended to.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ parent: HTMLElement;
13
+ ```
14
+
15
+ ## Remarks
16
+
17
+ This element will be appended to the DOM only after [Fixture.connect()](./foundation-testing.fixture.connect.md) has been called.
18
+
@@ -0,0 +1,13 @@
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; [Fixture](./foundation-testing.fixture.md) &gt; [template](./foundation-testing.fixture.template.md)
4
+
5
+ ## Fixture.template property
6
+
7
+ The template the fixture was created from.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ template: ViewTemplate;
13
+ ```
@@ -0,0 +1,13 @@
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; [Fixture](./foundation-testing.fixture.md) &gt; [view](./foundation-testing.fixture.view.md)
4
+
5
+ ## Fixture.view property
6
+
7
+ The view that was created from the fixture's template.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ view: HTMLView;
13
+ ```
@@ -0,0 +1,13 @@
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; [FixtureOptions](./foundation-testing.fixtureoptions.md) &gt; [context](./foundation-testing.fixtureoptions.context.md)
4
+
5
+ ## FixtureOptions.context property
6
+
7
+ The execution context to use during binding.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ context?: ExecutionContext;
13
+ ```
@@ -0,0 +1,13 @@
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; [FixtureOptions](./foundation-testing.fixtureoptions.md) &gt; [designSystem](./foundation-testing.fixtureoptions.designsystem.md)
4
+
5
+ ## FixtureOptions.designSystem property
6
+
7
+ A pre-configured design system instance used in setting up the fixture.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ designSystem?: DesignSystem;
13
+ ```
@@ -0,0 +1,13 @@
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; [FixtureOptions](./foundation-testing.fixtureoptions.md) &gt; [document](./foundation-testing.fixtureoptions.document.md)
4
+
5
+ ## FixtureOptions.document property
6
+
7
+ The document to run the fixture in.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ document?: Document;
13
+ ```
@@ -0,0 +1,24 @@
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; [FixtureOptions](./foundation-testing.fixtureoptions.md)
4
+
5
+ ## FixtureOptions interface
6
+
7
+ Options used to customize the creation of the unit test fixture.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export interface FixtureOptions
13
+ ```
14
+
15
+ ## Properties
16
+
17
+ | Property | Modifiers | Type | Description |
18
+ | --- | --- | --- | --- |
19
+ | [context?](./foundation-testing.fixtureoptions.context.md) | | ExecutionContext | _(Optional)_ The execution context to use during binding. |
20
+ | [designSystem?](./foundation-testing.fixtureoptions.designsystem.md) | | DesignSystem | _(Optional)_ A pre-configured design system instance used in setting up the fixture. |
21
+ | [document?](./foundation-testing.fixtureoptions.document.md) | | Document | _(Optional)_ The document to run the fixture in. |
22
+ | [parent?](./foundation-testing.fixtureoptions.parent.md) | | HTMLElement | _(Optional)_ The parent element to append the fixture to. |
23
+ | [source?](./foundation-testing.fixtureoptions.source.md) | | any | _(Optional)_ The data source to bind the HTML to. |
24
+
@@ -0,0 +1,13 @@
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; [FixtureOptions](./foundation-testing.fixtureoptions.md) &gt; [parent](./foundation-testing.fixtureoptions.parent.md)
4
+
5
+ ## FixtureOptions.parent property
6
+
7
+ The parent element to append the fixture to.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ parent?: HTMLElement;
13
+ ```
@@ -0,0 +1,13 @@
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; [FixtureOptions](./foundation-testing.fixtureoptions.md) &gt; [source](./foundation-testing.fixtureoptions.source.md)
4
+
5
+ ## FixtureOptions.source property
6
+
7
+ The data source to bind the HTML to.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ source?: any;
13
+ ```
@@ -0,0 +1,18 @@
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; [logger](./foundation-testing.logger.md)
4
+
5
+ ## logger variable
6
+
7
+ Test logger
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ logger: import("@genesislcap/foundation-utils").Logger
13
+ ```
14
+
15
+ ## Remarks
16
+
17
+ Exported so you can set log levels differently across packages when needed.
18
+
@@ -0,0 +1,20 @@
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; [LogicContext](./foundation-testing.logiccontext.md)
4
+
5
+ ## LogicContext interface
6
+
7
+ Logic suite context interface
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export interface LogicContext
13
+ ```
14
+
15
+ ## Methods
16
+
17
+ | Method | Description |
18
+ | --- | --- |
19
+ | [runCases(fn, cases)?](./foundation-testing.logiccontext.runcases.md) | _(Optional)_ |
20
+
@@ -0,0 +1,23 @@
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; [LogicContext](./foundation-testing.logiccontext.md) &gt; [runCases](./foundation-testing.logiccontext.runcases.md)
4
+
5
+ ## LogicContext.runCases() method
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ runCases?(fn: (value: any) => any, cases: [any, any, assert.Message?][]): void;
11
+ ```
12
+
13
+ ## Parameters
14
+
15
+ | Parameter | Type | Description |
16
+ | --- | --- | --- |
17
+ | fn | (value: any) =&gt; any | |
18
+ | cases | \[any, any, assert.Message?\]\[\] | |
19
+
20
+ **Returns:**
21
+
22
+ void
23
+
@@ -0,0 +1,35 @@
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)
4
+
5
+ ## foundation-testing package
6
+
7
+ ## Functions
8
+
9
+ | Function | Description |
10
+ | --- | --- |
11
+ | [createComponentSuite(title, elementNameOrGetter, context, registrations)](./foundation-testing.createcomponentsuite.md) | Create component test suite. |
12
+ | [createLogicSuite(title, context)](./foundation-testing.createlogicsuite.md) | Create logic test suite. |
13
+ | [fixture(templateNameOrRegistry, options)](./foundation-testing.fixture.md) | Creates a test fixture suitable for testing custom elements, templates, and bindings. |
14
+
15
+ ## Interfaces
16
+
17
+ | Interface | Description |
18
+ | --- | --- |
19
+ | [ComponentContext](./foundation-testing.componentcontext.md) | Component suite context interface |
20
+ | [Fixture](./foundation-testing.fixture.md) | Unit test fixture. |
21
+ | [FixtureOptions](./foundation-testing.fixtureoptions.md) | Options used to customize the creation of the unit test fixture. |
22
+ | [LogicContext](./foundation-testing.logiccontext.md) | Logic suite context interface |
23
+
24
+ ## Variables
25
+
26
+ | Variable | Description |
27
+ | --- | --- |
28
+ | [logger](./foundation-testing.logger.md) | Test logger |
29
+
30
+ ## Type Aliases
31
+
32
+ | Type Alias | Description |
33
+ | --- | --- |
34
+ | [ElementGetter](./foundation-testing.elementgetter.md) | |
35
+
@@ -0,0 +1,12 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md)
4
+
5
+ ## API Reference
6
+
7
+ ## Packages
8
+
9
+ | Package | Description |
10
+ | --- | --- |
11
+ | [@genesislcap/foundation-testing](./foundation-testing.md) | |
12
+