@3t-transform/threeteeui 0.1.28 → 0.1.30

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 (190) hide show
  1. package/dist/cjs/{index-dc6cc829.js → index-457ca775.js} +104 -2
  2. package/dist/cjs/loader.cjs.js +4 -3
  3. package/dist/cjs/tttx-button.cjs.entry.js +24 -24
  4. package/dist/cjs/tttx-filter.cjs.entry.js +159 -159
  5. package/dist/cjs/tttx-form.cjs.entry.js +376 -364
  6. package/dist/cjs/tttx-icon.cjs.entry.js +11 -11
  7. package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +59 -59
  8. package/dist/cjs/tttx-list.cjs.entry.js +43 -43
  9. package/dist/cjs/tttx-loading-spinner.cjs.entry.js +16 -16
  10. package/dist/cjs/tttx-sorter.cjs.entry.js +102 -102
  11. package/dist/cjs/tttx-standalone-input.cjs.entry.js +62 -62
  12. package/dist/cjs/tttx-toolbar.cjs.entry.js +10 -10
  13. package/dist/cjs/tttx.cjs.js +7 -3
  14. package/dist/collection/collection-manifest.json +2 -2
  15. package/dist/collection/components/atoms/tttx-button/tttx-button.js +110 -110
  16. package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +14 -14
  17. package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +62 -62
  18. package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +22 -22
  19. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +109 -109
  20. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +38 -38
  21. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +67 -67
  22. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -17
  23. package/dist/collection/components/molecules/tttx-filter/tttx-filter.js +334 -334
  24. package/dist/collection/components/molecules/tttx-filter/tttx-filter.stories.js +62 -62
  25. package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +37 -35
  26. package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +58 -58
  27. package/dist/collection/components/molecules/tttx-form/tttx-form.css +5 -0
  28. package/dist/collection/components/molecules/tttx-form/tttx-form.js +396 -364
  29. package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +248 -127
  30. package/dist/collection/components/molecules/tttx-list/tttx-list.js +105 -105
  31. package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +43 -43
  32. package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.js +224 -224
  33. package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.stories.js +42 -42
  34. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +27 -5
  35. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +645 -645
  36. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +163 -163
  37. package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +44 -44
  38. package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +14 -14
  39. package/dist/collection/components/palette.stories.js +7 -7
  40. package/dist/collection/docs/gettingstarted-developer.stories.js +5 -5
  41. package/dist/collection/icons.js +2838 -2838
  42. package/dist/collection/index.js +1 -1
  43. package/dist/collection/shared/domsanitiser.options.js +14 -14
  44. package/dist/components/index.d.ts +9 -0
  45. package/dist/components/index.js +1 -1
  46. package/dist/components/tttx-button.js +48 -48
  47. package/dist/components/tttx-filter.js +191 -191
  48. package/dist/components/tttx-form.js +394 -381
  49. package/dist/components/tttx-icon2.js +28 -28
  50. package/dist/components/tttx-keyvalue-block.js +76 -76
  51. package/dist/components/tttx-list.js +65 -65
  52. package/dist/components/tttx-loading-spinner.js +33 -33
  53. package/dist/components/tttx-sorter.js +130 -130
  54. package/dist/components/tttx-standalone-input.js +110 -110
  55. package/dist/components/tttx-toolbar.js +26 -26
  56. package/dist/esm/{index-86faeaab.js → index-d784fb3e.js} +104 -3
  57. package/dist/esm/loader.js +4 -3
  58. package/dist/esm/polyfills/core-js.js +0 -0
  59. package/dist/esm/polyfills/css-shim.js +1 -1
  60. package/dist/esm/polyfills/dom.js +0 -0
  61. package/dist/esm/polyfills/es5-html-element.js +0 -0
  62. package/dist/esm/polyfills/index.js +0 -0
  63. package/dist/esm/polyfills/system.js +0 -0
  64. package/dist/esm/tttx-button.entry.js +24 -24
  65. package/dist/esm/tttx-filter.entry.js +159 -159
  66. package/dist/esm/tttx-form.entry.js +376 -364
  67. package/dist/esm/tttx-icon.entry.js +11 -11
  68. package/dist/esm/tttx-keyvalue-block.entry.js +59 -59
  69. package/dist/esm/tttx-list.entry.js +43 -43
  70. package/dist/esm/tttx-loading-spinner.entry.js +16 -16
  71. package/dist/esm/tttx-sorter.entry.js +102 -102
  72. package/dist/esm/tttx-standalone-input.entry.js +62 -62
  73. package/dist/esm/tttx-toolbar.entry.js +10 -10
  74. package/dist/esm/tttx.js +4 -3
  75. package/dist/tttx/p-0ebffdfc.js +2 -0
  76. package/dist/tttx/p-1112ed2e.entry.js +1 -0
  77. package/dist/tttx/p-13495422.entry.js +1 -0
  78. package/dist/tttx/{p-ae00cae3.entry.js → p-1ed7a43d.entry.js} +1 -1
  79. package/dist/tttx/p-237fe0d5.entry.js +1 -0
  80. package/dist/tttx/p-2731fbc6.entry.js +1 -0
  81. package/dist/tttx/p-280b8e45.entry.js +1 -0
  82. package/dist/tttx/p-3772f4d0.entry.js +1 -0
  83. package/dist/tttx/p-390d97dd.entry.js +1 -0
  84. package/dist/tttx/p-49796abf.entry.js +1 -0
  85. package/dist/tttx/p-4f68f1eb.entry.js +1 -0
  86. package/dist/tttx/p-53793ed2.entry.js +1 -0
  87. package/dist/tttx/p-5f335153.entry.js +1 -0
  88. package/dist/tttx/p-60a0fee2.entry.js +1 -0
  89. package/dist/tttx/p-6ab75c0b.entry.js +1 -0
  90. package/dist/tttx/{p-daa27411.entry.js → p-6b006ccf.entry.js} +1 -1
  91. package/dist/tttx/p-6cbe1824.entry.js +1 -0
  92. package/dist/tttx/p-6cefa1ce.entry.js +1 -0
  93. package/dist/tttx/p-72e7f7dd.entry.js +3 -0
  94. package/dist/tttx/{p-c72d1a03.entry.js → p-798a098a.entry.js} +1 -1
  95. package/dist/tttx/p-824af346.entry.js +1 -0
  96. package/dist/tttx/{p-f1d7eb35.entry.js → p-91e42647.entry.js} +1 -1
  97. package/dist/tttx/{p-8f3badad.entry.js → p-b720c4ad.entry.js} +1 -1
  98. package/dist/tttx/p-c06f1207.entry.js +1 -0
  99. package/dist/tttx/p-c0a15524.entry.js +1 -0
  100. package/dist/tttx/{p-e25d5fe2.entry.js → p-c4162029.entry.js} +1 -1
  101. package/dist/tttx/p-c7c968dd.entry.js +1 -0
  102. package/dist/tttx/{p-c4538d55.entry.js → p-cac26a1b.entry.js} +1 -1
  103. package/dist/tttx/p-ce728715.entry.js +1 -0
  104. package/dist/tttx/p-d3932db5.entry.js +1 -0
  105. package/dist/tttx/p-d575ef2d.entry.js +1 -0
  106. package/dist/tttx/p-d83edcfb.entry.js +1 -0
  107. package/dist/tttx/p-d8e03ed6.entry.js +1 -0
  108. package/dist/tttx/p-ebb496a2.entry.js +1 -0
  109. package/dist/tttx/p-fb5e737b.entry.js +1 -0
  110. package/dist/tttx/p-fce571c2.entry.js +1 -0
  111. package/dist/tttx/tttx.esm.js +1 -1
  112. package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +10 -10
  113. package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +10 -10
  114. package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +5 -5
  115. package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +20 -20
  116. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +7 -7
  117. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +9 -9
  118. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -6
  119. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -17
  120. package/dist/types/components/molecules/tttx-filter/tttx-filter.d.ts +39 -39
  121. package/dist/types/components/molecules/tttx-filter/tttx-filter.stories.d.ts +68 -68
  122. package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +13 -13
  123. package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +17 -17
  124. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +111 -114
  125. package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +13 -13
  126. package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +11 -11
  127. package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +14 -14
  128. package/dist/types/components/molecules/tttx-sorter/tttx-sorter.d.ts +19 -19
  129. package/dist/types/components/molecules/tttx-sorter/tttx-sorter.stories.d.ts +30 -30
  130. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +60 -60
  131. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +128 -128
  132. package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.d.ts +4 -4
  133. package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.stories.d.ts +13 -13
  134. package/dist/types/components/palette.stories.d.ts +6 -6
  135. package/dist/types/components.d.ts +3 -2
  136. package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -5
  137. package/dist/types/icons.d.ts +2 -2
  138. package/dist/types/index.d.ts +1 -1
  139. package/dist/types/shared/domsanitiser.options.d.ts +10 -10
  140. package/dist/types/stencil-public-runtime.d.ts +59 -3
  141. package/loader/index.d.ts +9 -0
  142. package/package.json +1 -1
  143. package/dist/cjs/domsanitiser.options-277161b9.js +0 -1667
  144. package/dist/collection/components/atoms/tttx-button/test/tttx-button.e2e.js +0 -9
  145. package/dist/collection/components/atoms/tttx-button/test/tttx-button.spec.js +0 -83
  146. package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.e2e.js +0 -9
  147. package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.spec.js +0 -16
  148. package/dist/collection/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.js +0 -216
  149. package/dist/collection/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.js +0 -64
  150. package/dist/collection/components/molecules/tttx-filter/test/tttx-filter.spec.js +0 -231
  151. package/dist/collection/components/molecules/tttx-form/lib/setErrorState.spec.js +0 -38
  152. package/dist/collection/components/molecules/tttx-form/lib/validityCheck.spec.js +0 -214
  153. package/dist/collection/components/molecules/tttx-form/test/tttx-form.e2e.js +0 -9
  154. package/dist/collection/components/molecules/tttx-form/test/tttx-form.spec.js +0 -232
  155. package/dist/collection/components/molecules/tttx-list/test/ttttx-list.spec.e2e.js +0 -26
  156. package/dist/collection/components/molecules/tttx-list/test/tttx-list.spec.js +0 -183
  157. package/dist/collection/components/molecules/tttx-sorter/test/tttx-sorter.spec.js +0 -87
  158. package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.js +0 -9
  159. package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.js +0 -215
  160. package/dist/collection/components/molecules/tttx-toolbar/test/tttx-toolbar.spec.js +0 -52
  161. package/dist/collection/shared/test/domsanitiser.options.spec.js +0 -23
  162. package/dist/components/domsanitiser.options.js +0 -1664
  163. package/dist/esm/domsanitiser.options-cc420431.js +0 -1664
  164. package/dist/tttx/p-12fc0b16.entry.js +0 -3
  165. package/dist/tttx/p-2e43a578.entry.js +0 -1
  166. package/dist/tttx/p-33c0cbdc.entry.js +0 -1
  167. package/dist/tttx/p-52a47b7c.js +0 -2
  168. package/dist/tttx/p-72b4c98a.entry.js +0 -1
  169. package/dist/tttx/p-7e6fa227.entry.js +0 -1
  170. package/dist/tttx/p-90b0f72a.entry.js +0 -1
  171. package/dist/tttx/p-b4290a5b.js +0 -3
  172. package/dist/tttx/p-c4f2186e.entry.js +0 -1
  173. package/dist/types/components/atoms/tttx-button/test/tttx-button.e2e.d.ts +0 -1
  174. package/dist/types/components/atoms/tttx-button/test/tttx-button.spec.d.ts +0 -1
  175. package/dist/types/components/atoms/tttx-icon/test/tttx-icon.e2e.d.ts +0 -1
  176. package/dist/types/components/atoms/tttx-icon/test/tttx-icon.spec.d.ts +0 -1
  177. package/dist/types/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.d.ts +0 -1
  178. package/dist/types/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.d.ts +0 -1
  179. package/dist/types/components/molecules/tttx-filter/test/tttx-filter.spec.d.ts +0 -1
  180. package/dist/types/components/molecules/tttx-form/lib/setErrorState.spec.d.ts +0 -1
  181. package/dist/types/components/molecules/tttx-form/lib/validityCheck.spec.d.ts +0 -1
  182. package/dist/types/components/molecules/tttx-form/test/tttx-form.e2e.d.ts +0 -1
  183. package/dist/types/components/molecules/tttx-form/test/tttx-form.spec.d.ts +0 -1
  184. package/dist/types/components/molecules/tttx-list/test/ttttx-list.spec.e2e.d.ts +0 -1
  185. package/dist/types/components/molecules/tttx-list/test/tttx-list.spec.d.ts +0 -1
  186. package/dist/types/components/molecules/tttx-sorter/test/tttx-sorter.spec.d.ts +0 -1
  187. package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.d.ts +0 -1
  188. package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.d.ts +0 -1
  189. package/dist/types/components/molecules/tttx-toolbar/test/tttx-toolbar.spec.d.ts +0 -1
  190. package/dist/types/shared/test/domsanitiser.options.spec.d.ts +0 -1
@@ -1,9 +0,0 @@
1
- import { newE2EPage } from '@stencil/core/testing';
2
- describe('tttx-button', () => {
3
- it('renders', async () => {
4
- const page = await newE2EPage();
5
- await page.setContent('<tttx-button></tttx-button>');
6
- const element = await page.find('tttx-button');
7
- expect(element).toHaveClass('hydrated');
8
- });
9
- });
@@ -1,83 +0,0 @@
1
- import { newSpecPage } from '@stencil/core/testing';
2
- import { TttxButton } from '../tttx-button';
3
- describe('tttx-button', () => {
4
- it('renders', async () => {
5
- const page = await newSpecPage({
6
- components: [TttxButton],
7
- html: '<tttx-button></tttx-button>',
8
- });
9
- expect(page.root).toEqualHtml(`
10
- <tttx-button>
11
- <mock:shadow-root>
12
- <button class="button default">
13
- <div class="button-content">
14
- <slot></slot>
15
- </div>
16
- </button>
17
- </mock:shadow-root>
18
- </tttx-button>
19
- `);
20
- });
21
- it('renders a white icon', async () => {
22
- const page = await newSpecPage({
23
- components: [TttxButton],
24
- html: '<tttx-button design="primary" icon="person"></tttx-button>',
25
- });
26
- expect(page.root).toEqualHtml(`
27
- <tttx-button design="primary" icon="person">
28
- <mock:shadow-root>
29
- <button class="button iconleft primary withicon">
30
- <div class="icon-left">
31
- <tttx-icon color="white" icon="person"></tttx-icon>
32
- </div>
33
- <div class="button-content">
34
- <slot></slot>
35
- </div>
36
- </button>
37
- </mock:shadow-root>
38
- </tttx-button>
39
- `);
40
- });
41
- it('design doesn\'t exist', async () => {
42
- const page = await newSpecPage({
43
- components: [TttxButton],
44
- html: '<tttx-button design="memphis" icon="person"></tttx-button>',
45
- });
46
- expect(page.root).toEqualHtml(`
47
- <tttx-button design="memphis" icon="person">
48
- <mock:shadow-root>
49
- <button class="button default iconleft withicon">
50
- <div class="icon-left">
51
- <tttx-icon color="black" icon="person"></tttx-icon>
52
- </div>
53
- <div class="button-content">
54
- <slot></slot>
55
- </div>
56
- </button>
57
- </mock:shadow-root>
58
- </tttx-button>
59
- `);
60
- });
61
- it('clicks', async () => {
62
- const page = await newSpecPage({
63
- components: [TttxButton],
64
- html: '<tttx-button></tttx-button>',
65
- });
66
- expect(page.root).toEqualHtml(`
67
- <tttx-button>
68
- <mock:shadow-root>
69
- <button class="button default">
70
- <div class="button-content">
71
- <slot></slot>
72
- </div>
73
- </button>
74
- </mock:shadow-root>
75
- </tttx-button>
76
- `);
77
- const callbackFn = jest.fn();
78
- // add an event listener directly to the tttx-button host and click it
79
- page.root.addEventListener('click', callbackFn);
80
- page.root.click();
81
- expect(callbackFn).toHaveBeenCalled();
82
- });
83
- });
@@ -1,9 +0,0 @@
1
- import { newE2EPage } from '@stencil/core/testing';
2
- describe('tttx-icon', () => {
3
- it('renders', async () => {
4
- const page = await newE2EPage();
5
- await page.setContent('<tttx-icon></tttx-icon>');
6
- const element = await page.find('tttx-icon');
7
- expect(element).toHaveClass('hydrated');
8
- });
9
- });
@@ -1,16 +0,0 @@
1
- import { newSpecPage } from '@stencil/core/testing';
2
- import { TttxIcon } from '../tttx-icon';
3
- describe('tttx-icon', () => {
4
- it('renders', async () => {
5
- const page = await newSpecPage({
6
- components: [TttxIcon],
7
- html: '<tttx-icon color="danger" icon="warning"></tttx-icon>',
8
- });
9
- expect(page.root).toEqualHtml(`
10
- <tttx-icon color="danger" icon="warning">
11
- <mock:shadow-root>
12
- <span class="material-symbols-rounded danger">warning</span>
13
- </mock:shadow-root>
14
- </tttx-icon>`);
15
- });
16
- });
@@ -1,216 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { newSpecPage } from '@stencil/core/testing';
3
- import { TttxKeyvalueBlock } from '../tttx-keyvalue-block';
4
- describe('tttx-keyvalue-block', () => {
5
- it('renders multiple key value pairs', async () => {
6
- const keyValuePair = {
7
- 'Name': 'John Doe',
8
- 'Date of birth': '14 Jan 1981',
9
- 'Start of postcode': 'AB10'
10
- };
11
- const page = await newSpecPage({
12
- components: [TttxKeyvalueBlock],
13
- html: `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValuePair)}' />`
14
- });
15
- await page.waitForChanges();
16
- expect(page.root).toEqualHtml(`
17
- <tttx-keyvalue-block keyvalues='{"Name":"John Doe","Date of birth":"14 Jan 1981","Start of postcode":"AB10"}'>
18
- <mock:shadow-root>
19
- <dl>
20
- <dt>
21
- Name
22
- </dt>
23
- <dd>
24
- John Doe
25
- </dd>
26
- <dt>
27
- Date of birth
28
- </dt>
29
- <dd>
30
- 14 Jan 1981
31
- </dd>
32
- <dt>
33
- Start of postcode
34
- </dt>
35
- <dd>
36
- AB10
37
- </dd>
38
- </dl>
39
- </mock:shadow-root>
40
- </tttx-keyvalue-block>
41
- `);
42
- });
43
- it('renders multiple key value pairs from a stencil template', async () => {
44
- const keyValuePair = {
45
- 'Name': 'John Doe',
46
- 'Date of birth': '14 Jan 1981',
47
- 'Start of postcode': 'AB10'
48
- };
49
- const page = await newSpecPage({
50
- components: [TttxKeyvalueBlock],
51
- template: () => (h("tttx-keyvalue-block", { keyvalues: keyValuePair }))
52
- });
53
- await page.waitForChanges();
54
- expect(page.root).toEqualHtml(`
55
- <tttx-keyvalue-block>
56
- <mock:shadow-root>
57
- <dl>
58
- <dt>
59
- Name
60
- </dt>
61
- <dd>
62
- John Doe
63
- </dd>
64
- <dt>
65
- Date of birth
66
- </dt>
67
- <dd>
68
- 14 Jan 1981
69
- </dd>
70
- <dt>
71
- Start of postcode
72
- </dt>
73
- <dd>
74
- AB10
75
- </dd>
76
- </dl>
77
- </mock:shadow-root>
78
- </tttx-keyvalue-block>
79
- `);
80
- });
81
- it('renders with missing keyvalue object', async () => {
82
- const page = await newSpecPage({
83
- components: [TttxKeyvalueBlock],
84
- template: () => (h("tttx-keyvalue-block", null))
85
- });
86
- await page.waitForChanges();
87
- expect(page.root).toEqualHtml(`
88
- <tttx-keyvalue-block>
89
- <mock:shadow-root>
90
- </mock:shadow-root>
91
- </tttx-keyvalue-block>
92
- `);
93
- });
94
- it('renders an array of key value subtitles', async () => {
95
- const keyValueArray = [
96
- { title: 'title', subTitle: 'sub', data: 'data' },
97
- { title: 'title2', subTitle: 'sub2', data: 'data2' }
98
- ];
99
- const page = await newSpecPage({
100
- components: [TttxKeyvalueBlock],
101
- html: `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValueArray)}' />`
102
- });
103
- await page.waitForChanges();
104
- expect(page.root).toEqualHtml(`
105
- <tttx-keyvalue-block keyvalues='[{"title":"title","subTitle":"sub","data":"data"},{"title":"title2","subTitle":"sub2","data":"data2"}]'>
106
- <mock:shadow-root>
107
- <dl>
108
- <dt class="mainTitle">
109
- title
110
- </dt>
111
- <dt class="subTitle">
112
- sub
113
- </dt>
114
- <dd>
115
- data
116
- </dd>
117
- <dt class="mainTitle">
118
- title2
119
- </dt>
120
- <dt class="subTitle">
121
- sub2
122
- </dt>
123
- <dd>
124
- data2
125
- </dd>
126
- </dl>
127
- </mock:shadow-root>
128
- </tttx-keyvalue-block>
129
- `);
130
- });
131
- it('renders multiple horizontal key value pairs', async () => {
132
- const keyValuePair = {
133
- 'Name': 'John Doe',
134
- 'Date of birth': '14 Jan 1981',
135
- 'Start of postcode': 'AB10'
136
- };
137
- const page = await newSpecPage({
138
- components: [TttxKeyvalueBlock],
139
- html: `<tttx-keyvalue-block horizontal="true" keyvalues='${JSON.stringify(keyValuePair)}' />`
140
- });
141
- await page.waitForChanges();
142
- expect(page.root).toEqualHtml(`
143
- <tttx-keyvalue-block horizontal="true" keyvalues='{"Name":"John Doe","Date of birth":"14 Jan 1981","Start of postcode":"AB10"}'>
144
- <mock:shadow-root>
145
- <dl class="horizontal">
146
- <div style="max-width: 33.333333333333336%;">
147
- <dt>
148
- Name
149
- </dt>
150
- <dd>
151
- John Doe
152
- </dd>
153
- </div>
154
- <div style="max-width: 33.333333333333336%;">
155
- <dt>
156
- Date of birth
157
- </dt>
158
- <dd>
159
- 14 Jan 1981
160
- </dd>
161
- </div>
162
- <div style="max-width: 33.333333333333336%;">
163
- <dt>
164
- Start of postcode
165
- </dt>
166
- <dd>
167
- AB10
168
- </dd>
169
- </div>
170
- </dl>
171
- </mock:shadow-root>
172
- </tttx-keyvalue-block>
173
- `);
174
- });
175
- it('renders an array of horizontal key value subtitles', async () => {
176
- const keyValueArray = [
177
- { title: 'title', subTitle: 'sub', data: 'data' },
178
- { title: 'title2', subTitle: 'sub2', data: 'data2' }
179
- ];
180
- const page = await newSpecPage({
181
- components: [TttxKeyvalueBlock],
182
- html: `<tttx-keyvalue-block horizontal="true" keyvalues='${JSON.stringify(keyValueArray)}' />`
183
- });
184
- await page.waitForChanges();
185
- expect(page.root).toEqualHtml(`
186
- <tttx-keyvalue-block horizontal="true" keyvalues='[{"title":"title","subTitle":"sub","data":"data"},{"title":"title2","subTitle":"sub2","data":"data2"}]'>
187
- <mock:shadow-root>
188
- <dl class="horizontal">
189
- <div style="max-width: 50%;">
190
- <dt class="mainTitle">
191
- title
192
- </dt>
193
- <dt class="subTitle">
194
- sub
195
- </dt>
196
- <dd>
197
- data
198
- </dd>
199
- </div>
200
- <div style="max-width: 50%;">
201
- <dt class="mainTitle">
202
- title2
203
- </dt>
204
- <dt class="subTitle">
205
- sub2
206
- </dt>
207
- <dd>
208
- data2
209
- </dd>
210
- </div>
211
- </dl>
212
- </mock:shadow-root>
213
- </tttx-keyvalue-block>
214
- `);
215
- });
216
- });
@@ -1,64 +0,0 @@
1
- import { newSpecPage } from '@stencil/core/testing';
2
- import { TttxLoadingSpinner } from '../tttx-loading-spinner';
3
- describe('tttx-loading-spinner', () => {
4
- it('renders the loading text when the loading message prop is set to true', async () => {
5
- const page = await newSpecPage({
6
- components: [TttxLoadingSpinner],
7
- html: '<tttx-loading-spinner></tttx-loading-spinner>',
8
- });
9
- page.rootInstance.loadingMessage = true;
10
- await page.waitForChanges();
11
- expect(page.root).toEqualHtml(`
12
- <tttx-loading-spinner>
13
- <mock:shadow-root>
14
- <div class='spinner-container'><div class="loading-box"><span class='spinner large'></span></div><div class='loading-text'>Loading, please wait...</div></div>
15
- </mock:shadow-root>
16
- </tttx-loading-spinner>
17
- `);
18
- });
19
- it('renders without the loading text when the loading message prop is set to false', async () => {
20
- const page = await newSpecPage({
21
- components: [TttxLoadingSpinner],
22
- html: '<tttx-loading-spinner></tttx-loading-spinner>',
23
- });
24
- page.rootInstance.loadingMessage = false;
25
- await page.waitForChanges();
26
- expect(page.root).toEqualHtml(`
27
- <tttx-loading-spinner>
28
- <mock:shadow-root>
29
- <div class='spinner-container'><div class="loading-box"><span class='spinner large'></span></div></div>
30
- </mock:shadow-root>
31
- </tttx-loading-spinner>
32
- `);
33
- });
34
- it('renders the small spinner when the size prop is set to small', async () => {
35
- const page = await newSpecPage({
36
- components: [TttxLoadingSpinner],
37
- html: '<tttx-loading-spinner></tttx-loading-spinner>',
38
- });
39
- page.rootInstance.size = 'small';
40
- await page.waitForChanges();
41
- expect(page.root).toEqualHtml(`
42
- <tttx-loading-spinner>
43
- <mock:shadow-root>
44
- <div class='spinner-container'><div class="loading-box"><span class='spinner small'></span></div></div>
45
- </mock:shadow-root>
46
- </tttx-loading-spinner>
47
- `);
48
- });
49
- it('renders the large spinner when the size prop is set to large', async () => {
50
- const page = await newSpecPage({
51
- components: [TttxLoadingSpinner],
52
- html: '<tttx-loading-spinner></tttx-loading-spinner>',
53
- });
54
- page.rootInstance.size = 'large';
55
- await page.waitForChanges();
56
- expect(page.root).toEqualHtml(`
57
- <tttx-loading-spinner>
58
- <mock:shadow-root>
59
- <div class='spinner-container'><div class="loading-box"><span class='spinner large'></span></div></div>
60
- </mock:shadow-root>
61
- </tttx-loading-spinner>
62
- `);
63
- });
64
- });
@@ -1,231 +0,0 @@
1
- import { newSpecPage } from '@stencil/core/testing';
2
- import { TttxFilter } from '../tttx-filter';
3
- describe('tttx-filter', () => {
4
- let tttxFilter;
5
- beforeEach(() => {
6
- tttxFilter = new TttxFilter();
7
- });
8
- it('should render the filter button', async () => {
9
- const page = await newSpecPage({
10
- components: [TttxFilter],
11
- html: '<tttx-filter></tttx-filter>',
12
- });
13
- expect(page.root).toEqualHtml(`
14
- <tttx-filter id="filter__undefined">
15
- <mock:shadow-root>
16
- <div class="filter-container">
17
- <button class="filter-button" type="button">
18
- <tttx-icon class="filter-icon" color="black" icon="filter_list"></tttx-icon>
19
- Filter
20
- </button>
21
- </div>
22
- </mock:shadow-root>
23
- </tttx-filter>
24
- `);
25
- });
26
- it('should render the filter button without select all option', async () => {
27
- const page = await newSpecPage({
28
- components: [TttxFilter],
29
- html: '<tttx-filter show-select-all="false"></tttx-filter>',
30
- });
31
- const filterButton = page.root.shadowRoot.querySelector('.filter-button');
32
- filterButton === null || filterButton === void 0 ? void 0 : filterButton.dispatchEvent(new Event('click'));
33
- await page.waitForChanges();
34
- const selectAllIcon = page.root.shadowRoot.querySelector('.select-all-icon');
35
- expect(selectAllIcon).toBeNull();
36
- });
37
- it('should render the filter button with search field', async () => {
38
- const page = await newSpecPage({
39
- components: [TttxFilter],
40
- html: '<tttx-filter show-search-field ></tttx-filter>',
41
- });
42
- const filterButton = page.root.shadowRoot.querySelector('.filter-button');
43
- filterButton === null || filterButton === void 0 ? void 0 : filterButton.dispatchEvent(new Event('click'));
44
- await page.waitForChanges();
45
- const searchField = page.root.shadowRoot.querySelector('.--with-search-field');
46
- expect(searchField).toEqualHtml(`
47
- <div class="--with-search-field filter-popover-container">
48
- <div class="filter-header">
49
- Qualification status
50
- </div>
51
- <div class="search-field-container">
52
- <tttx-icon class="search-icon" icon="search"></tttx-icon>
53
- <input class="search-input" placeholder="Search" type="text" value="">
54
- </div>
55
- <div class="filter-options-container">
56
- <div class="filter-option" tabindex="-1">
57
- <tttx-icon class="select-all-icon" color="blue" icon="check_box"></tttx-icon>
58
- <label class="filter-label">
59
- Select all
60
- </label>
61
- </div>
62
- <div class="filter-option" tabindex="-1">
63
- <tttx-icon class="checkbox-icon" color="blue" icon="check_box"></tttx-icon>
64
- <tttx-icon color="darkred" icon="cancel"></tttx-icon>
65
- <label class="filter-label">
66
- Expired
67
- </label>
68
- </div>
69
- <div class="filter-option" tabindex="-1">
70
- <tttx-icon class="checkbox-icon" color="blue" icon="check_box"></tttx-icon>
71
- <tttx-icon color="orange" icon="warning"></tttx-icon>
72
- <label class="filter-label">
73
- Expiring soon
74
- </label>
75
- </div>
76
- <div class="filter-option" tabindex="-1">
77
- <tttx-icon class="checkbox-icon" color="blue" icon="check_box"></tttx-icon>
78
- <tttx-icon color="green" icon="check_circle"></tttx-icon>
79
- <label class="filter-label">
80
- Active
81
- </label>
82
- </div>
83
- </div>
84
- <div class="filter-popover-button-container">
85
- <button class="close-button" type="button">
86
- Close
87
- </button>
88
- <button class="apply-button" type="button">
89
- Apply
90
- </button>
91
- </div>
92
- </div>
93
- `);
94
- });
95
- it('should hide filter popover when close button is clicked', async () => {
96
- const page = await newSpecPage({
97
- components: [TttxFilter],
98
- html: '<tttx-filter></tttx-filter>',
99
- });
100
- const filterButton = page.root.shadowRoot.querySelector('.filter-button');
101
- filterButton === null || filterButton === void 0 ? void 0 : filterButton.dispatchEvent(new Event('click'));
102
- await page.waitForChanges();
103
- const closeButton = page.root.shadowRoot.querySelector('.close-button');
104
- closeButton === null || closeButton === void 0 ? void 0 : closeButton.dispatchEvent(new Event('click'));
105
- await page.waitForChanges();
106
- const popoverContainer = page.root.shadowRoot.querySelector('.filter-popover-container');
107
- expect(popoverContainer).toBeFalsy();
108
- });
109
- it('should select all options when select all checkbox is clicked', async () => {
110
- const page = await newSpecPage({
111
- components: [TttxFilter],
112
- html: '<tttx-filter></tttx-filter>',
113
- });
114
- const filterButton = page.root.shadowRoot.querySelector('.filter-button');
115
- filterButton === null || filterButton === void 0 ? void 0 : filterButton.dispatchEvent(new Event('click'));
116
- await page.waitForChanges();
117
- const selectAllCheckbox = page.root.shadowRoot.querySelector('.filter-option');
118
- selectAllCheckbox === null || selectAllCheckbox === void 0 ? void 0 : selectAllCheckbox.dispatchEvent(new Event('click'));
119
- await page.waitForChanges();
120
- const filterOptionsUnchecked = page.root.shadowRoot.querySelectorAll('.filter-option');
121
- filterOptionsUnchecked.forEach(option => {
122
- const checkbox = option.querySelector('.checkbox-icon');
123
- if (checkbox) {
124
- expect(checkbox.getAttribute('icon')).toBe('check_box_outline_blank');
125
- }
126
- });
127
- selectAllCheckbox === null || selectAllCheckbox === void 0 ? void 0 : selectAllCheckbox.dispatchEvent(new Event('click'));
128
- await page.waitForChanges();
129
- const filterOptionsChecked = page.root.shadowRoot.querySelectorAll('.filter-option');
130
- filterOptionsChecked.forEach(option => {
131
- const checkbox = option.querySelector('.checkbox-icon');
132
- if (checkbox) {
133
- expect(checkbox.getAttribute('icon')).toBe('check_box');
134
- }
135
- });
136
- });
137
- it('should handle filter option selection', async () => {
138
- const page = await newSpecPage({
139
- components: [TttxFilter],
140
- html: '<tttx-filter show-select-all="false" ></tttx-filter>',
141
- });
142
- const filterButton = page.root.shadowRoot.querySelector('.filter-button');
143
- filterButton === null || filterButton === void 0 ? void 0 : filterButton.dispatchEvent(new Event('click'));
144
- await page.waitForChanges();
145
- const checkbox = page.root.shadowRoot.querySelector('.filter-option');
146
- checkbox === null || checkbox === void 0 ? void 0 : checkbox.dispatchEvent(new Event('click'));
147
- await page.waitForChanges();
148
- const icon = checkbox.querySelector('tttx-icon');
149
- expect(icon.getAttribute('icon')).toBe('check_box_outline_blank');
150
- checkbox === null || checkbox === void 0 ? void 0 : checkbox.dispatchEvent(new Event('click'));
151
- await page.waitForChanges();
152
- expect(icon.getAttribute('icon')).toBe('check_box');
153
- });
154
- it('should update filterSearchTerm and displayedFilterSettings when handleFilterChange is called', async () => {
155
- const page = await newSpecPage({
156
- components: [TttxFilter],
157
- html: '<tttx-filter show-search-field></tttx-filter>',
158
- });
159
- const filter = page.root.shadowRoot.querySelector('.filter-button');
160
- filter.dispatchEvent(new Event('click'));
161
- await page.waitForChanges();
162
- const searchTextField = page.root.shadowRoot.querySelector('.search-input');
163
- searchTextField.value = 'exp';
164
- searchTextField.dispatchEvent(new Event('input'));
165
- await page.waitForChanges();
166
- const filterOptions = page.root.shadowRoot.querySelectorAll('.filter-option');
167
- expect(filterOptions.length).toEqual(3);
168
- });
169
- it('should update selectedFilters and allSelected when onSelectAllClick is called', () => {
170
- tttxFilter.displayedFilterSettings = [
171
- { optionIcon: 'cancel', optionIconColor: 'darkred', optionText: 'Expired' },
172
- { optionIcon: 'warning', optionIconColor: 'orange', optionText: 'Expiring soon' },
173
- { optionIcon: 'check_circle', optionIconColor: 'green', optionText: 'Active' },
174
- ];
175
- tttxFilter.allSelected = false;
176
- tttxFilter.selectedFilters = [];
177
- tttxFilter.onSelectAllClick();
178
- expect(tttxFilter.selectedFilters).toEqual(['Expired', 'Expiring soon', 'Active']);
179
- expect(tttxFilter.allSelected).toBe(true);
180
- });
181
- it('should return the correct class name for the button style', () => {
182
- const tableIconClass = tttxFilter.getFilterButtonClassName('table icon');
183
- expect(tableIconClass).toBe('--table-icon');
184
- const listIconClass = tttxFilter.getFilterButtonClassName('list icon');
185
- expect(listIconClass).toBe('--list-icon');
186
- const defaultClass = tttxFilter.getFilterButtonClassName('unknown style');
187
- expect(defaultClass).toBe('');
188
- });
189
- it('emits filterChangeEvent on apply button click', async () => {
190
- const page = await newSpecPage({
191
- components: [TttxFilter],
192
- html: '<tttx-filter></tttx-filter>',
193
- });
194
- const filterComponent = page.rootInstance;
195
- const filterChangeEvent = jest.fn();
196
- page.root.addEventListener('filterChangeEvent', filterChangeEvent);
197
- filterComponent.onApplyFilterButtonClick();
198
- expect(filterChangeEvent).toHaveBeenCalled();
199
- });
200
- it('should toggle the popover on the filter button', async () => {
201
- const page = await newSpecPage({
202
- components: [TttxFilter],
203
- html: '<tttx-filter></tttx-filter>',
204
- });
205
- const filter = page.root.shadowRoot.querySelector('.filter-button');
206
- filter.dispatchEvent(new Event('click'));
207
- await page.waitForChanges();
208
- const filterOptions = page.root.shadowRoot.querySelector('.filter-option');
209
- expect(filterOptions).not.toBeNull();
210
- filter.dispatchEvent(new Event('click'));
211
- await page.waitForChanges();
212
- const filterOptionsNew = page.root.shadowRoot.querySelector('.filter-option');
213
- expect(filterOptionsNew).toBeNull();
214
- });
215
- it('should toggle the popover when the close button is clicked', async () => {
216
- const page = await newSpecPage({
217
- components: [TttxFilter],
218
- html: '<tttx-filter></tttx-filter>',
219
- });
220
- const filter = page.root.shadowRoot.querySelector('.filter-button');
221
- filter.dispatchEvent(new Event('click'));
222
- await page.waitForChanges();
223
- const filterOptions = page.root.shadowRoot.querySelector('.filter-option');
224
- expect(filterOptions).not.toBeNull();
225
- const closeButton = page.root.shadowRoot.querySelector('.close-button');
226
- closeButton.dispatchEvent(new Event('click'));
227
- await page.waitForChanges();
228
- const filterOptionsNew = page.root.shadowRoot.querySelector('.filter-option');
229
- expect(filterOptionsNew).toBeNull();
230
- });
231
- });
@@ -1,38 +0,0 @@
1
- import setErrorState from './setErrorState';
2
- describe('setErrorState', () => {
3
- let target;
4
- let errorBubble;
5
- beforeEach(() => {
6
- target = document.createElement('input');
7
- errorBubble = document.createElement('div');
8
- errorBubble.className = 'errorBubble';
9
- target.parentElement = document.createElement('div');
10
- target.parentElement.appendChild(errorBubble);
11
- });
12
- afterEach(() => {
13
- target = null;
14
- errorBubble = null;
15
- });
16
- test('should set error state correctly when hasError is true', () => {
17
- setErrorState(target, true, 'Invalid value');
18
- expect(target.className).toBe('invalid');
19
- expect(errorBubble.innerHTML).toBe('<span class="material-symbols-rounded">warning</span>Invalid value');
20
- });
21
- test('should clear error state correctly when hasError is false', () => {
22
- target.className = 'invalid';
23
- errorBubble.innerHTML = '<span class="material-symbols-rounded">warning</span>Invalid value';
24
- setErrorState(target, false, '');
25
- expect(target.className).toBe('');
26
- expect(errorBubble.innerHTML).toBe('');
27
- });
28
- test('should set error state correctly with custom error message', () => {
29
- setErrorState(target, true, 'Custom error message');
30
- expect(target.className).toBe('invalid');
31
- expect(errorBubble.innerHTML).toBe('<span class="material-symbols-rounded">warning</span>Custom error message');
32
- });
33
- test('should set error state correctly with no error message', () => {
34
- setErrorState(target, true, '');
35
- expect(target.className).toBe('invalid');
36
- expect(errorBubble.innerHTML).toBe('<span class="material-symbols-rounded">warning</span> ');
37
- });
38
- });