@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,87 +0,0 @@
1
- import { newSpecPage } from '@stencil/core/testing';
2
- import { TttxSorter } from '../tttx-sorter';
3
- const sorterData = { sorterOptions: [{ optionLabel: 'Expiry date' }, { optionLabel: 'Qualification name' }] };
4
- describe('tttx-sorter', () => {
5
- it('renders without errors', async () => {
6
- const page = await newSpecPage({
7
- components: [TttxSorter],
8
- html: `<tttx-sorter field-options-data='${JSON.stringify(sorterData)}'></tttx-sorter>`,
9
- });
10
- expect(page.root).toBeDefined();
11
- expect(page.root)
12
- .toEqualHtml(`<tttx-sorter field-options-data="{&quot;sorterOptions&quot;:[{&quot;optionLabel&quot;:&quot;Expiry date&quot;},{&quot;optionLabel&quot;:&quot;Qualification name&quot;}]}" id="sorter__undefined">
13
- <mock:shadow-root>
14
- <div class="sorter-container" tabindex="0">
15
- <button class="arrow-toggle-button" type="button">
16
- <tttx-icon color="black" icon="arrow_downward"></tttx-icon>
17
- </button>
18
- <div class="dropdown-selector">
19
- <div class="dropdown-selector-button">
20
- <div class="dropdown-selector-text"></div>
21
- <div class="dropdown-selector-chevron">
22
- <tttx-icon color="black" icon="expand_more"></tttx-icon>
23
- </div>
24
- </div>
25
- </div>
26
- </div>
27
- </mock:shadow-root>
28
- </tttx-sorter>`);
29
- expect(page.rootInstance).toBeInstanceOf(TttxSorter);
30
- });
31
- it('renders null without errors when no data passesd in', async () => {
32
- const page = await newSpecPage({
33
- components: [TttxSorter],
34
- html: '<tttx-sorter></tttx-sorter>',
35
- });
36
- expect(page.root).toBeDefined();
37
- expect(page.root).toEqualHtml(`
38
- <tttx-sorter>
39
- <mock:shadow-root></mock:shadow-root>
40
- </tttx-sorter>`);
41
- expect(page.rootInstance).toBeInstanceOf(TttxSorter);
42
- });
43
- it('emits sorterChangeEvent when sort toggle button is clicked', async () => {
44
- const page = await newSpecPage({
45
- components: [TttxSorter],
46
- html: `<tttx-sorter field-options-data='${JSON.stringify(sorterData)}' sorter-key='basic-sorter'></tttx-sorter>`,
47
- });
48
- await page.waitForChanges();
49
- const toggleButton = page.root.shadowRoot.querySelector('.arrow-toggle-button');
50
- const eventSpy = jest.fn();
51
- page.doc.addEventListener('sorterChangeEvent', eventSpy);
52
- await page.waitForChanges();
53
- await toggleButton.dispatchEvent(new Event('click'));
54
- expect(eventSpy).toHaveBeenCalled();
55
- expect(eventSpy.mock.calls[0][0].detail).toEqual({ sortField: '', sorterDirection: 'ascending', sorterKey: 'basic-sorter' });
56
- });
57
- it('emits sorterChangeEvent when sort toggle button is clicked', async () => {
58
- const page = await newSpecPage({
59
- components: [TttxSorter],
60
- html: `<tttx-sorter field-options-data='${JSON.stringify(sorterData)}' sorter-key='basic-sorter' default-sort-direction='ascending'></tttx-sorter>`,
61
- });
62
- await page.waitForChanges();
63
- const toggleButton = page.root.shadowRoot.querySelector('.arrow-toggle-button');
64
- const eventSpy = jest.fn();
65
- page.doc.addEventListener('sorterChangeEvent', eventSpy);
66
- await page.waitForChanges();
67
- await toggleButton.dispatchEvent(new Event('click'));
68
- expect(eventSpy).toHaveBeenCalled();
69
- expect(eventSpy.mock.calls[0][0].detail).toEqual({ sortField: '', sorterDirection: 'descending', sorterKey: 'basic-sorter' });
70
- });
71
- it('emits sorterChangeEvent when dropdown option is selected', async () => {
72
- const page = await newSpecPage({
73
- components: [TttxSorter],
74
- html: `<tttx-sorter field-options-data='${JSON.stringify(sorterData)}' sorter-key='basic-sorter' default-sort-direction='descending'></tttx-sorter>`,
75
- });
76
- const dropdownSelector = page.root.shadowRoot.querySelector('.dropdown-selector');
77
- await dropdownSelector.dispatchEvent(new Event('click'));
78
- await page.waitForChanges();
79
- const dropdownOption = page.root.shadowRoot.querySelector('.dropdown-option');
80
- const eventSpy = jest.fn();
81
- page.doc.addEventListener('sorterChangeEvent', eventSpy);
82
- await page.waitForChanges();
83
- await dropdownOption.dispatchEvent(new Event('click'));
84
- expect(eventSpy).toHaveBeenCalledTimes(1);
85
- expect(eventSpy.mock.calls[0][0].detail).toEqual({ sortField: 'Expiry date', sorterDirection: 'descending', sorterKey: 'basic-sorter' });
86
- });
87
- });
@@ -1,9 +0,0 @@
1
- import { newE2EPage } from '@stencil/core/testing';
2
- describe('tttx-standalone-input', () => {
3
- it('renders', async () => {
4
- const page = await newE2EPage();
5
- await page.setContent('<tttx-standalone-input></tttx-standalone-input>');
6
- const element = await page.find('tttx-standalone-input');
7
- expect(element).toHaveClass('hydrated');
8
- });
9
- });
@@ -1,215 +0,0 @@
1
- import { newSpecPage } from '@stencil/core/testing';
2
- import { TttxInput } from '../tttx-standalone-input';
3
- describe('tttx-standalone-input', () => {
4
- it('renders', async () => {
5
- const page = await newSpecPage({
6
- components: [TttxInput],
7
- html: '<tttx-standalone-input />',
8
- });
9
- expect(page.root).toEqualHtml(`
10
- <tttx-standalone-input>
11
- <label class="inputBlock">
12
- <span class="optional">
13
- (optional)
14
- </span>
15
- <div class="input-container">
16
- <input class="standalone" type="text">
17
- <span class="errorBubble">
18
- <span class="material-symbols-rounded validationicon">
19
- warning
20
- </span>
21
- </span>
22
- </div>
23
- </label>
24
- </tttx-standalone-input>
25
- `);
26
- });
27
- it('renders the input field with the left icon', async () => {
28
- const page = await newSpecPage({
29
- components: [TttxInput],
30
- html: '<tttx-standalone-input iconleft="info" />',
31
- });
32
- expect(page.root).toEqualHtml(`
33
- <tttx-standalone-input iconleft="info">
34
- <label class="inputBlock">
35
- <span class="optional">
36
- (optional)
37
- </span>
38
- <div class="input-container">
39
- <tttx-icon color="grey" icon="info" id="icon-left"></tttx-icon>
40
- <input class="standalone" type="text">
41
- <span class="errorBubble">
42
- <span class="material-symbols-rounded validationicon">
43
- warning
44
- </span>
45
- </span>
46
- </div>
47
- </label>
48
- </tttx-standalone-input>
49
- `);
50
- });
51
- it('renders the input field with the right icon', async () => {
52
- const page = await newSpecPage({
53
- components: [TttxInput],
54
- html: '<tttx-standalone-input iconright="info" />',
55
- });
56
- expect(page.root).toEqualHtml(`
57
- <tttx-standalone-input iconright="info">
58
- <label class="inputBlock">
59
- <span class="optional">
60
- (optional)
61
- </span>
62
- <div class="input-container">
63
- <tttx-icon color="grey" icon="info" id="icon-right"></tttx-icon>
64
- <input class="standalone" type="text">
65
- <span class="errorBubble">
66
- <span class="material-symbols-rounded validationicon">
67
- warning
68
- </span>
69
- </span>
70
- </div>
71
- </label>
72
- </tttx-standalone-input>
73
- `);
74
- });
75
- it('renders the input field with an error message', async () => {
76
- const page = await newSpecPage({
77
- components: [TttxInput],
78
- html: '<tttx-standalone-input required showerrormsg errormsg="The field is required" />',
79
- });
80
- expect(page.root).toEqualHtml(`
81
- <tttx-standalone-input errormsg="The field is required" required="" showerrormsg="">
82
- <label class="inputBlock">
83
- <div class="input-container">
84
- <input class="invalid standalone" required="" type="text">
85
- <span class="errorBubble visible">
86
- <span class="material-symbols-rounded validationicon">
87
- warning
88
- </span>
89
- The field is required
90
- </span>
91
- </div>
92
- </label>
93
- </tttx-standalone-input>
94
- `);
95
- });
96
- it('renders the label as inline', async () => {
97
- const page = await newSpecPage({
98
- components: [TttxInput],
99
- html: '<tttx-standalone-input inline />',
100
- });
101
- expect(page.root).toEqualHtml(`
102
- <tttx-standalone-input inline="">
103
- <label class="inputInline">
104
- <span class="optional">
105
- (optional)
106
- </span>
107
- <div class="input-container">
108
- <input class="standalone" type="text">
109
- <span class="errorBubble">
110
- <span class="material-symbols-rounded validationicon">
111
- warning
112
- </span>
113
- </span>
114
- </div>
115
- </label>
116
- </tttx-standalone-input>
117
- `);
118
- });
119
- it('renders the input with an icon within the field', async () => {
120
- const page = await newSpecPage({
121
- components: [TttxInput],
122
- html: '<tttx-standalone-input inputicon="search" />',
123
- });
124
- expect(page.root).toEqualHtml(`
125
- <tttx-standalone-input inputicon="search">
126
- <label class="inputBlock">
127
- <span class="optional">
128
- (optional)
129
- </span>
130
- <div class="input-container">
131
- <tttx-icon class="input-icon" icon="search" color="grey"></tttx-icon>
132
- <input class="standalone" type="text">
133
- <span class="errorBubble">
134
- <span class="material-symbols-rounded validationicon">
135
- warning
136
- </span>
137
- </span>
138
- </div>
139
- </label>
140
- </tttx-standalone-input>
141
- `);
142
- });
143
- it('renders the input without the errorbubble', async () => {
144
- const page = await newSpecPage({
145
- components: [TttxInput],
146
- html: '<tttx-standalone-input showerrorbubble="false" />',
147
- });
148
- expect(page.root).toEqualHtml(`
149
- <tttx-standalone-input showerrorbubble="false">
150
- <label class="inputBlock">
151
- <span class="optional">
152
- (optional)
153
- </span>
154
- <div class="input-container">
155
- <input class="standalone" type="text">
156
- </div>
157
- </label>
158
- </tttx-standalone-input>
159
- `);
160
- });
161
- it('can trigger onInput handler', async () => {
162
- const page = await newSpecPage({
163
- components: [TttxInput],
164
- html: '<tttx-standalone-input />',
165
- });
166
- const callbackFn = jest.fn();
167
- page.doc.addEventListener('valueChanged', callbackFn);
168
- const input = page.root.querySelector('input');
169
- input.value = 'a';
170
- const event = new CustomEvent('input', { composed: true, bubbles: true });
171
- input.dispatchEvent(event);
172
- expect(callbackFn).toHaveBeenCalled();
173
- });
174
- it('can trigger onFocus handler', async () => {
175
- const page = await newSpecPage({
176
- components: [TttxInput],
177
- html: '<tttx-standalone-input />',
178
- });
179
- const callbackFn = jest.fn();
180
- page.doc.addEventListener('focusChanged', callbackFn);
181
- const input = page.root.querySelector('input');
182
- input.focus();
183
- const event = new CustomEvent('focus', { composed: true, bubbles: true });
184
- input.dispatchEvent(event);
185
- expect(callbackFn).toHaveBeenCalled();
186
- });
187
- it('can trigger onBlur handler', async () => {
188
- const page = await newSpecPage({
189
- components: [TttxInput],
190
- html: '<tttx-standalone-input />',
191
- });
192
- const callbackFn = jest.fn();
193
- page.doc.addEventListener('blurChanged', callbackFn);
194
- const input = page.root.querySelector('input');
195
- input.blur();
196
- const event = new CustomEvent('blur', { composed: true, bubbles: true });
197
- input.dispatchEvent(event);
198
- expect(callbackFn).toHaveBeenCalled();
199
- });
200
- it('can trigger onInvalid handler', async () => {
201
- const page = await newSpecPage({
202
- components: [TttxInput],
203
- html: '<tttx-standalone-input />',
204
- });
205
- const callbackFn = jest.fn();
206
- page.doc.addEventListener('invalidChanged', callbackFn);
207
- const input = page.root.querySelector('input');
208
- // Doesn't work:
209
- // input.setCustomValidity('required');
210
- // input.checkValidity();
211
- const event = new CustomEvent('invalid', { composed: true, bubbles: true });
212
- input.dispatchEvent(event);
213
- expect(callbackFn).toHaveBeenCalled();
214
- });
215
- });
@@ -1,52 +0,0 @@
1
- import { newSpecPage } from '@stencil/core/testing';
2
- import { TttxToolbar } from '../tttx-toolbar';
3
- describe('tttx-standalone-input', () => {
4
- it('renders', async () => {
5
- const page = await newSpecPage({
6
- components: [TttxToolbar],
7
- html: `
8
- <tttx-toolbar>
9
- <span slot="before"><div>Before</div></span>
10
- <span slot="center"><div>Center</div></span>
11
- <span slot="after"><div>After</div></span>
12
- </tttx-toolbar>
13
- `,
14
- });
15
- expect(page.root).toEqualHtml(`
16
- <tttx-toolbar class="bordered">
17
- <mock:shadow-root>
18
- <slot name="before"></slot>
19
- <slot name="center"></slot>
20
- <slot name="after"></slot>
21
- </mock:shadow-root>
22
- <span slot="before"><div>Before</div></span>
23
- <span slot="center"><div>Center</div></span>
24
- <span slot="after"><div>After</div></span>
25
- </tttx-toolbar>
26
- `);
27
- });
28
- it('renders without a border', async () => {
29
- const page = await newSpecPage({
30
- components: [TttxToolbar],
31
- html: `
32
- <tttx-toolbar border="false">
33
- <span slot="before"><div>Before</div></span>
34
- <span slot="center"><div>Center</div></span>
35
- <span slot="after"><div>After</div></span>
36
- </tttx-toolbar>
37
- `,
38
- });
39
- expect(page.root).toEqualHtml(`
40
- <tttx-toolbar border="false">
41
- <mock:shadow-root>
42
- <slot name="before"></slot>
43
- <slot name="center"></slot>
44
- <slot name="after"></slot>
45
- </mock:shadow-root>
46
- <span slot="before"><div>Before</div></span>
47
- <span slot="center"><div>Center</div></span>
48
- <span slot="after"><div>After</div></span>
49
- </tttx-toolbar>
50
- `);
51
- });
52
- });
@@ -1,23 +0,0 @@
1
- import domSanitiserOptions from '../domsanitiser.options';
2
- describe('dom sanitiser options', () => {
3
- it('allows tags beginning with "tttx-"', async () => {
4
- const tagName = 'tttx-custom-element';
5
- const result = domSanitiserOptions.
6
- CUSTOM_ELEMENT_HANDLING.
7
- tagNameCheck(tagName);
8
- expect(result).not.toBe(null);
9
- });
10
- it('disallows tags not beginning with "tttx-"', async () => {
11
- const tagName = 'custom-element';
12
- const result = domSanitiserOptions.
13
- CUSTOM_ELEMENT_HANDLING.
14
- tagNameCheck(tagName);
15
- expect(result).toBe(null);
16
- });
17
- it('allows all attributes', async () => {
18
- const result = domSanitiserOptions.
19
- CUSTOM_ELEMENT_HANDLING.
20
- attributeNameCheck();
21
- expect(result).toBe(true);
22
- });
23
- });