ngx-com 0.1.16 → 0.1.17

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 (76) hide show
  1. package/fesm2022/ngx-com-components-alert-testing.mjs +80 -0
  2. package/fesm2022/ngx-com-components-alert-testing.mjs.map +1 -0
  3. package/fesm2022/ngx-com-components-calendar-testing.mjs +157 -0
  4. package/fesm2022/ngx-com-components-calendar-testing.mjs.map +1 -0
  5. package/fesm2022/ngx-com-components-carousel-testing.mjs +121 -0
  6. package/fesm2022/ngx-com-components-carousel-testing.mjs.map +1 -0
  7. package/fesm2022/ngx-com-components-checkbox-testing.mjs +113 -0
  8. package/fesm2022/ngx-com-components-checkbox-testing.mjs.map +1 -0
  9. package/fesm2022/ngx-com-components-code-block-testing.mjs +88 -0
  10. package/fesm2022/ngx-com-components-code-block-testing.mjs.map +1 -0
  11. package/fesm2022/ngx-com-components-collapsible-testing.mjs +104 -0
  12. package/fesm2022/ngx-com-components-collapsible-testing.mjs.map +1 -0
  13. package/fesm2022/ngx-com-components-confirm-testing.mjs +150 -0
  14. package/fesm2022/ngx-com-components-confirm-testing.mjs.map +1 -0
  15. package/fesm2022/ngx-com-components-datepicker-testing.mjs +137 -0
  16. package/fesm2022/ngx-com-components-datepicker-testing.mjs.map +1 -0
  17. package/fesm2022/ngx-com-components-dialog-testing.mjs +109 -0
  18. package/fesm2022/ngx-com-components-dialog-testing.mjs.map +1 -0
  19. package/fesm2022/ngx-com-components-dialog.mjs +18 -18
  20. package/fesm2022/ngx-com-components-dialog.mjs.map +1 -1
  21. package/fesm2022/ngx-com-components-dropdown.mjs +39 -0
  22. package/fesm2022/ngx-com-components-dropdown.mjs.map +1 -1
  23. package/fesm2022/ngx-com-components-form-field-testing.mjs +140 -0
  24. package/fesm2022/ngx-com-components-form-field-testing.mjs.map +1 -0
  25. package/fesm2022/ngx-com-components-form-field.mjs +5 -1
  26. package/fesm2022/ngx-com-components-form-field.mjs.map +1 -1
  27. package/fesm2022/ngx-com-components-menu-testing.mjs +298 -0
  28. package/fesm2022/ngx-com-components-menu-testing.mjs.map +1 -0
  29. package/fesm2022/ngx-com-components-paginator-testing.mjs +128 -0
  30. package/fesm2022/ngx-com-components-paginator-testing.mjs.map +1 -0
  31. package/fesm2022/ngx-com-components-popover-testing.mjs +115 -0
  32. package/fesm2022/ngx-com-components-popover-testing.mjs.map +1 -0
  33. package/fesm2022/ngx-com-components-radio-testing.mjs +157 -0
  34. package/fesm2022/ngx-com-components-radio-testing.mjs.map +1 -0
  35. package/fesm2022/ngx-com-components-segmented-control-testing.mjs +122 -0
  36. package/fesm2022/ngx-com-components-segmented-control-testing.mjs.map +1 -0
  37. package/fesm2022/ngx-com-components-sort-testing.mjs +108 -0
  38. package/fesm2022/ngx-com-components-sort-testing.mjs.map +1 -0
  39. package/fesm2022/ngx-com-components-switch-testing.mjs +103 -0
  40. package/fesm2022/ngx-com-components-switch-testing.mjs.map +1 -0
  41. package/fesm2022/ngx-com-components-table-testing.mjs +198 -0
  42. package/fesm2022/ngx-com-components-table-testing.mjs.map +1 -0
  43. package/fesm2022/ngx-com-components-tabs-testing.mjs +126 -0
  44. package/fesm2022/ngx-com-components-tabs-testing.mjs.map +1 -0
  45. package/fesm2022/ngx-com-components-timepicker-testing.mjs +117 -0
  46. package/fesm2022/ngx-com-components-timepicker-testing.mjs.map +1 -0
  47. package/fesm2022/ngx-com-components-toast-testing.mjs +172 -0
  48. package/fesm2022/ngx-com-components-toast-testing.mjs.map +1 -0
  49. package/fesm2022/ngx-com-components-toast.mjs +4 -4
  50. package/fesm2022/ngx-com-components-toast.mjs.map +1 -1
  51. package/fesm2022/ngx-com-components-tooltip-testing.mjs +117 -0
  52. package/fesm2022/ngx-com-components-tooltip-testing.mjs.map +1 -0
  53. package/package.json +89 -1
  54. package/types/ngx-com-components-alert-testing.d.ts +41 -0
  55. package/types/ngx-com-components-calendar-testing.d.ts +80 -0
  56. package/types/ngx-com-components-carousel-testing.d.ts +51 -0
  57. package/types/ngx-com-components-checkbox-testing.d.ts +56 -0
  58. package/types/ngx-com-components-code-block-testing.d.ts +45 -0
  59. package/types/ngx-com-components-collapsible-testing.d.ts +53 -0
  60. package/types/ngx-com-components-confirm-testing.d.ts +78 -0
  61. package/types/ngx-com-components-datepicker-testing.d.ts +61 -0
  62. package/types/ngx-com-components-dialog-testing.d.ts +57 -0
  63. package/types/ngx-com-components-dropdown.d.ts +12 -0
  64. package/types/ngx-com-components-form-field-testing.d.ts +61 -0
  65. package/types/ngx-com-components-menu-testing.d.ts +167 -0
  66. package/types/ngx-com-components-paginator-testing.d.ts +58 -0
  67. package/types/ngx-com-components-popover-testing.d.ts +63 -0
  68. package/types/ngx-com-components-radio-testing.d.ts +86 -0
  69. package/types/ngx-com-components-segmented-control-testing.d.ts +66 -0
  70. package/types/ngx-com-components-sort-testing.d.ts +62 -0
  71. package/types/ngx-com-components-switch-testing.d.ts +52 -0
  72. package/types/ngx-com-components-table-testing.d.ts +124 -0
  73. package/types/ngx-com-components-tabs-testing.d.ts +67 -0
  74. package/types/ngx-com-components-timepicker-testing.d.ts +53 -0
  75. package/types/ngx-com-components-toast-testing.d.ts +93 -0
  76. package/types/ngx-com-components-tooltip-testing.d.ts +57 -0
@@ -0,0 +1,198 @@
1
+ import { ComponentHarness, HarnessPredicate, parallel } from '@angular/cdk/testing';
2
+
3
+ /**
4
+ * Harness for interacting with a table cell (`<th>` or `<td>`) in tests.
5
+ */
6
+ class ComTableCellHarness extends ComponentHarness {
7
+ static hostSelector = 'th, td';
8
+ /**
9
+ * Gets a HarnessPredicate for matching table cells.
10
+ * @param options Filter options.
11
+ */
12
+ static with(options = {}) {
13
+ return new HarnessPredicate(ComTableCellHarness, options)
14
+ .addOption('text', options.text, async (harness, text) => {
15
+ const cellText = await harness.getText();
16
+ return HarnessPredicate.stringMatches(cellText, text);
17
+ });
18
+ }
19
+ /** Gets the cell's text content. */
20
+ async getText() {
21
+ const host = await this.host();
22
+ return host.text();
23
+ }
24
+ }
25
+ /**
26
+ * Harness for interacting with a table header row (`<thead> <tr>`) in tests.
27
+ */
28
+ class ComTableHeaderRowHarness extends ComponentHarness {
29
+ static hostSelector = 'thead tr';
30
+ /**
31
+ * Gets a HarnessPredicate for matching header rows.
32
+ * @param options Filter options.
33
+ */
34
+ static with(options = {}) {
35
+ return new HarnessPredicate(ComTableHeaderRowHarness, options);
36
+ }
37
+ /** Gets all header cells in this row, optionally filtered. */
38
+ async getCells(filters = {}) {
39
+ return this.locatorForAll(ComTableCellHarness.with(filters))();
40
+ }
41
+ /** Gets the text content of all header cells. */
42
+ async getCellTexts() {
43
+ const cells = await this.getCells();
44
+ return parallel(() => cells.map((cell) => cell.getText()));
45
+ }
46
+ }
47
+ /**
48
+ * Harness for interacting with a table body row (`<tbody> <tr>`) in tests.
49
+ */
50
+ class ComTableRowHarness extends ComponentHarness {
51
+ static hostSelector = 'tbody tr';
52
+ /**
53
+ * Gets a HarnessPredicate for matching body rows.
54
+ * @param options Filter options.
55
+ */
56
+ static with(options = {}) {
57
+ return new HarnessPredicate(ComTableRowHarness, options);
58
+ }
59
+ /** Gets all cells in this row, optionally filtered. */
60
+ async getCells(filters = {}) {
61
+ return this.locatorForAll(ComTableCellHarness.with(filters))();
62
+ }
63
+ /** Gets the text content of all cells in this row. */
64
+ async getCellTexts() {
65
+ const cells = await this.getCells();
66
+ return parallel(() => cells.map((cell) => cell.getText()));
67
+ }
68
+ /** Clicks the row. Useful for tables with clickable rows. */
69
+ async click() {
70
+ const host = await this.host();
71
+ return host.click();
72
+ }
73
+ /** Whether the row is clickable (has tabindex="0"). */
74
+ async isClickable() {
75
+ const host = await this.host();
76
+ return (await host.getAttribute('tabindex')) === '0';
77
+ }
78
+ }
79
+ /**
80
+ * Harness for interacting with a table footer row (`<tfoot> <tr>`) in tests.
81
+ */
82
+ class ComTableFooterRowHarness extends ComponentHarness {
83
+ static hostSelector = 'tfoot tr';
84
+ /**
85
+ * Gets a HarnessPredicate for matching footer rows.
86
+ * @param options Filter options.
87
+ */
88
+ static with(options = {}) {
89
+ return new HarnessPredicate(ComTableFooterRowHarness, options);
90
+ }
91
+ /** Gets all cells in this footer row, optionally filtered. */
92
+ async getCells(filters = {}) {
93
+ return this.locatorForAll(ComTableCellHarness.with(filters))();
94
+ }
95
+ /** Gets the text content of all cells in this footer row. */
96
+ async getCellTexts() {
97
+ const cells = await this.getCells();
98
+ return parallel(() => cells.map((cell) => cell.getText()));
99
+ }
100
+ }
101
+ /**
102
+ * Harness for interacting with a ComTable in tests.
103
+ */
104
+ class ComTableHarness extends ComponentHarness {
105
+ static hostSelector = 'com-table';
106
+ tableElement = this.locatorFor('table');
107
+ /**
108
+ * Gets a HarnessPredicate for matching tables.
109
+ * @param options Filter options.
110
+ */
111
+ static with(options = {}) {
112
+ return new HarnessPredicate(ComTableHarness, options)
113
+ .addOption('ariaLabel', options.ariaLabel, async (harness, ariaLabel) => {
114
+ const label = await harness.getAriaLabel();
115
+ return HarnessPredicate.stringMatches(label, ariaLabel);
116
+ });
117
+ }
118
+ /** Gets the table's aria-label. */
119
+ async getAriaLabel() {
120
+ const table = await this.tableElement();
121
+ return table.getAttribute('aria-label');
122
+ }
123
+ /** Whether the table is currently loading (aria-busy="true"). */
124
+ async isLoading() {
125
+ const table = await this.tableElement();
126
+ return (await table.getAttribute('aria-busy')) === 'true';
127
+ }
128
+ /** Gets all header rows. */
129
+ async getHeaderRows() {
130
+ return this.locatorForAll(ComTableHeaderRowHarness.with({}))();
131
+ }
132
+ /** Gets the text content of all header cells from the first header row. */
133
+ async getHeaderCellTexts() {
134
+ const headerRows = await this.getHeaderRows();
135
+ if (headerRows.length === 0) {
136
+ return [];
137
+ }
138
+ return headerRows[0].getCellTexts();
139
+ }
140
+ /** Gets all body rows, optionally filtered. */
141
+ async getRows(filters = {}) {
142
+ return this.locatorForAll(ComTableRowHarness.with(filters))();
143
+ }
144
+ /** Gets the number of body rows. */
145
+ async getRowCount() {
146
+ const rows = await this.getRows();
147
+ return rows.length;
148
+ }
149
+ /**
150
+ * Gets the text content of all body cells as a 2D array.
151
+ * Each inner array contains the cell texts for a single row.
152
+ */
153
+ async getCellTexts() {
154
+ const rows = await this.getRows();
155
+ return parallel(() => rows.map((row) => row.getCellTexts()));
156
+ }
157
+ /** Gets all footer rows. */
158
+ async getFooterRows() {
159
+ return this.locatorForAll(ComTableFooterRowHarness.with({}))();
160
+ }
161
+ /** Gets the text content of all footer cells from the first footer row. */
162
+ async getFooterCellTexts() {
163
+ const footerRows = await this.getFooterRows();
164
+ if (footerRows.length === 0) {
165
+ return [];
166
+ }
167
+ return footerRows[0].getCellTexts();
168
+ }
169
+ /** Whether the table is disabled (aria-disabled). */
170
+ async isDisabled() {
171
+ const table = await this.tableElement();
172
+ return (await table.getAttribute('aria-disabled')) === 'true';
173
+ }
174
+ /** Whether the table host is focused. */
175
+ async isFocused() {
176
+ const host = await this.host();
177
+ return host.isFocused();
178
+ }
179
+ /** Focuses the table host element. */
180
+ async focus() {
181
+ const host = await this.host();
182
+ return host.focus();
183
+ }
184
+ /** Blurs the table host element. */
185
+ async blur() {
186
+ const host = await this.host();
187
+ return host.blur();
188
+ }
189
+ }
190
+
191
+ // Testing utilities for the table component
192
+
193
+ /**
194
+ * Generated bundle index. Do not edit.
195
+ */
196
+
197
+ export { ComTableCellHarness, ComTableFooterRowHarness, ComTableHarness, ComTableHeaderRowHarness, ComTableRowHarness };
198
+ //# sourceMappingURL=ngx-com-components-table-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-com-components-table-testing.mjs","sources":["../../../projects/com/components/table/testing/table.harness.ts","../../../projects/com/components/table/testing/index.ts","../../../projects/com/components/table/testing/ngx-com-components-table-testing.ts"],"sourcesContent":["import {\n ComponentHarness,\n HarnessPredicate,\n parallel,\n} from '@angular/cdk/testing';\nimport type { BaseHarnessFilters } from '@angular/cdk/testing';\n\n/** Harness filters for ComTableCellHarness. */\nexport interface ComTableCellHarnessFilters extends BaseHarnessFilters {\n /** Filter by the cell's text content. */\n text?: string | RegExp;\n}\n\n/** Harness filters for ComTableRowHarness. */\nexport type ComTableRowHarnessFilters = BaseHarnessFilters;\n\n/** Harness filters for ComTableHeaderRowHarness. */\nexport type ComTableHeaderRowHarnessFilters = BaseHarnessFilters;\n\n/** Harness filters for ComTableFooterRowHarness. */\nexport type ComTableFooterRowHarnessFilters = BaseHarnessFilters;\n\n/** Harness filters for ComTableHarness. */\nexport interface ComTableHarnessFilters extends BaseHarnessFilters {\n /** Filter by the table's aria-label. */\n ariaLabel?: string | RegExp;\n}\n\n/**\n * Harness for interacting with a table cell (`<th>` or `<td>`) in tests.\n */\nexport class ComTableCellHarness extends ComponentHarness {\n static hostSelector = 'th, td';\n\n /**\n * Gets a HarnessPredicate for matching table cells.\n * @param options Filter options.\n */\n static with(options: ComTableCellHarnessFilters = {}): HarnessPredicate<ComTableCellHarness> {\n return new HarnessPredicate(ComTableCellHarness, options)\n .addOption('text', options.text, async (harness, text) => {\n const cellText = await harness.getText();\n return HarnessPredicate.stringMatches(cellText, text);\n });\n }\n\n /** Gets the cell's text content. */\n async getText(): Promise<string> {\n const host = await this.host();\n return host.text();\n }\n}\n\n/**\n * Harness for interacting with a table header row (`<thead> <tr>`) in tests.\n */\nexport class ComTableHeaderRowHarness extends ComponentHarness {\n static hostSelector = 'thead tr';\n\n /**\n * Gets a HarnessPredicate for matching header rows.\n * @param options Filter options.\n */\n static with(options: ComTableHeaderRowHarnessFilters = {}): HarnessPredicate<ComTableHeaderRowHarness> {\n return new HarnessPredicate(ComTableHeaderRowHarness, options);\n }\n\n /** Gets all header cells in this row, optionally filtered. */\n async getCells(filters: ComTableCellHarnessFilters = {}): Promise<ComTableCellHarness[]> {\n return this.locatorForAll(ComTableCellHarness.with(filters))();\n }\n\n /** Gets the text content of all header cells. */\n async getCellTexts(): Promise<string[]> {\n const cells = await this.getCells();\n return parallel(() => cells.map((cell) => cell.getText()));\n }\n}\n\n/**\n * Harness for interacting with a table body row (`<tbody> <tr>`) in tests.\n */\nexport class ComTableRowHarness extends ComponentHarness {\n static hostSelector = 'tbody tr';\n\n /**\n * Gets a HarnessPredicate for matching body rows.\n * @param options Filter options.\n */\n static with(options: ComTableRowHarnessFilters = {}): HarnessPredicate<ComTableRowHarness> {\n return new HarnessPredicate(ComTableRowHarness, options);\n }\n\n /** Gets all cells in this row, optionally filtered. */\n async getCells(filters: ComTableCellHarnessFilters = {}): Promise<ComTableCellHarness[]> {\n return this.locatorForAll(ComTableCellHarness.with(filters))();\n }\n\n /** Gets the text content of all cells in this row. */\n async getCellTexts(): Promise<string[]> {\n const cells = await this.getCells();\n return parallel(() => cells.map((cell) => cell.getText()));\n }\n\n /** Clicks the row. Useful for tables with clickable rows. */\n async click(): Promise<void> {\n const host = await this.host();\n return host.click();\n }\n\n /** Whether the row is clickable (has tabindex=\"0\"). */\n async isClickable(): Promise<boolean> {\n const host = await this.host();\n return (await host.getAttribute('tabindex')) === '0';\n }\n}\n\n/**\n * Harness for interacting with a table footer row (`<tfoot> <tr>`) in tests.\n */\nexport class ComTableFooterRowHarness extends ComponentHarness {\n static hostSelector = 'tfoot tr';\n\n /**\n * Gets a HarnessPredicate for matching footer rows.\n * @param options Filter options.\n */\n static with(options: ComTableFooterRowHarnessFilters = {}): HarnessPredicate<ComTableFooterRowHarness> {\n return new HarnessPredicate(ComTableFooterRowHarness, options);\n }\n\n /** Gets all cells in this footer row, optionally filtered. */\n async getCells(filters: ComTableCellHarnessFilters = {}): Promise<ComTableCellHarness[]> {\n return this.locatorForAll(ComTableCellHarness.with(filters))();\n }\n\n /** Gets the text content of all cells in this footer row. */\n async getCellTexts(): Promise<string[]> {\n const cells = await this.getCells();\n return parallel(() => cells.map((cell) => cell.getText()));\n }\n}\n\n/**\n * Harness for interacting with a ComTable in tests.\n */\nexport class ComTableHarness extends ComponentHarness {\n static hostSelector = 'com-table';\n\n private readonly tableElement = this.locatorFor('table');\n\n /**\n * Gets a HarnessPredicate for matching tables.\n * @param options Filter options.\n */\n static with(options: ComTableHarnessFilters = {}): HarnessPredicate<ComTableHarness> {\n return new HarnessPredicate(ComTableHarness, options)\n .addOption('ariaLabel', options.ariaLabel, async (harness, ariaLabel) => {\n const label = await harness.getAriaLabel();\n return HarnessPredicate.stringMatches(label, ariaLabel);\n });\n }\n\n /** Gets the table's aria-label. */\n async getAriaLabel(): Promise<string | null> {\n const table = await this.tableElement();\n return table.getAttribute('aria-label');\n }\n\n /** Whether the table is currently loading (aria-busy=\"true\"). */\n async isLoading(): Promise<boolean> {\n const table = await this.tableElement();\n return (await table.getAttribute('aria-busy')) === 'true';\n }\n\n /** Gets all header rows. */\n async getHeaderRows(): Promise<ComTableHeaderRowHarness[]> {\n return this.locatorForAll(ComTableHeaderRowHarness.with({}))();\n }\n\n /** Gets the text content of all header cells from the first header row. */\n async getHeaderCellTexts(): Promise<string[]> {\n const headerRows = await this.getHeaderRows();\n if (headerRows.length === 0) {\n return [];\n }\n return headerRows[0]!.getCellTexts();\n }\n\n /** Gets all body rows, optionally filtered. */\n async getRows(filters: ComTableRowHarnessFilters = {}): Promise<ComTableRowHarness[]> {\n return this.locatorForAll(ComTableRowHarness.with(filters))();\n }\n\n /** Gets the number of body rows. */\n async getRowCount(): Promise<number> {\n const rows = await this.getRows();\n return rows.length;\n }\n\n /**\n * Gets the text content of all body cells as a 2D array.\n * Each inner array contains the cell texts for a single row.\n */\n async getCellTexts(): Promise<string[][]> {\n const rows = await this.getRows();\n return parallel(() => rows.map((row) => row.getCellTexts()));\n }\n\n /** Gets all footer rows. */\n async getFooterRows(): Promise<ComTableFooterRowHarness[]> {\n return this.locatorForAll(ComTableFooterRowHarness.with({}))();\n }\n\n /** Gets the text content of all footer cells from the first footer row. */\n async getFooterCellTexts(): Promise<string[]> {\n const footerRows = await this.getFooterRows();\n if (footerRows.length === 0) {\n return [];\n }\n return footerRows[0]!.getCellTexts();\n }\n\n /** Whether the table is disabled (aria-disabled). */\n async isDisabled(): Promise<boolean> {\n const table = await this.tableElement();\n return (await table.getAttribute('aria-disabled')) === 'true';\n }\n\n /** Whether the table host is focused. */\n async isFocused(): Promise<boolean> {\n const host = await this.host();\n return host.isFocused();\n }\n\n /** Focuses the table host element. */\n async focus(): Promise<void> {\n const host = await this.host();\n return host.focus();\n }\n\n /** Blurs the table host element. */\n async blur(): Promise<void> {\n const host = await this.host();\n return host.blur();\n }\n}\n","// Testing utilities for the table component\n\nexport {\n ComTableCellHarness,\n ComTableHeaderRowHarness,\n ComTableRowHarness,\n ComTableFooterRowHarness,\n ComTableHarness,\n} from './table.harness';\n\nexport type {\n ComTableCellHarnessFilters,\n ComTableHeaderRowHarnessFilters,\n ComTableRowHarnessFilters,\n ComTableFooterRowHarnessFilters,\n ComTableHarnessFilters,\n} from './table.harness';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AA4BA;;AAEG;AACG,MAAO,mBAAoB,SAAQ,gBAAgB,CAAA;AACvD,IAAA,OAAO,YAAY,GAAG,QAAQ;AAE9B;;;AAGG;AACH,IAAA,OAAO,IAAI,CAAC,OAAA,GAAsC,EAAE,EAAA;AAClD,QAAA,OAAO,IAAI,gBAAgB,CAAC,mBAAmB,EAAE,OAAO;AACrD,aAAA,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,OAAO,EAAE,IAAI,KAAI;AACvD,YAAA,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE;YACxC,OAAO,gBAAgB,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC;AACvD,QAAA,CAAC,CAAC;IACN;;AAGA,IAAA,MAAM,OAAO,GAAA;AACX,QAAA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE;AAC9B,QAAA,OAAO,IAAI,CAAC,IAAI,EAAE;IACpB;;AAGF;;AAEG;AACG,MAAO,wBAAyB,SAAQ,gBAAgB,CAAA;AAC5D,IAAA,OAAO,YAAY,GAAG,UAAU;AAEhC;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AAY,EAAE,CAAC,CAAC;IAC9D;;AAGA,IAAA,MAAM,aAAa,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE;IAChE;;AAGA,IAAA,MAAM,kBAAkB,GAAA;AACtB,QAAA,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE;AAC7C,QAAA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;AAC3B,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,UAAU,CAAC,CAAC,CAAE,CAAC,YAAY,EAAE;IACtC;;AAGA,IAAA,MAAM,UAAU,GAAA;AACd,QAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE;QACvC,OAAO,CAAC,MAAM,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,MAAM,MAAM;IAC/D;;AAGA,IAAA,MAAM,SAAS,GAAA;AACb,QAAA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE;AAC9B,QAAA,OAAO,IAAI,CAAC,SAAS,EAAE;IACzB;;AAGA,IAAA,MAAM,KAAK,GAAA;AACT,QAAA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE;AAC9B,QAAA,OAAO,IAAI,CAAC,KAAK,EAAE;IACrB;;AAGA,IAAA,MAAM,IAAI,GAAA;AACR,QAAA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE;AAC9B,QAAA,OAAO,IAAI,CAAC,IAAI,EAAE;IACpB;;;ACrPF;;ACAA;;AAEG;;;;"}
@@ -0,0 +1,126 @@
1
+ import { ComponentHarness, HarnessPredicate, parallel } from '@angular/cdk/testing';
2
+
3
+ /**
4
+ * Harness for interacting with an individual tab button in tests.
5
+ */
6
+ class ComTabHarness extends ComponentHarness {
7
+ static hostSelector = 'button[role="tab"]';
8
+ closeButton = this.locatorForOptional('span[aria-hidden="true"]');
9
+ /**
10
+ * Gets a HarnessPredicate for matching tab buttons.
11
+ * @param options Filter options.
12
+ */
13
+ static with(options = {}) {
14
+ return new HarnessPredicate(ComTabHarness, options)
15
+ .addOption('label', options.label, async (harness, label) => {
16
+ const text = await harness.getLabel();
17
+ return HarnessPredicate.stringMatches(text, label);
18
+ })
19
+ .addOption('selected', options.selected, async (harness, selected) => {
20
+ return (await harness.isSelected()) === selected;
21
+ })
22
+ .addOption('disabled', options.disabled, async (harness, disabled) => {
23
+ return (await harness.isDisabled()) === disabled;
24
+ });
25
+ }
26
+ /** Gets the tab's label text. */
27
+ async getLabel() {
28
+ const host = await this.host();
29
+ return host.text();
30
+ }
31
+ /** Whether the tab is currently selected. */
32
+ async isSelected() {
33
+ const host = await this.host();
34
+ return (await host.getAttribute('aria-selected')) === 'true';
35
+ }
36
+ /** Whether the tab is disabled. */
37
+ async isDisabled() {
38
+ const host = await this.host();
39
+ return host.getProperty('disabled');
40
+ }
41
+ /** Clicks the tab to select it. */
42
+ async select() {
43
+ const host = await this.host();
44
+ return host.click();
45
+ }
46
+ /** Gets the aria-controls attribute linking to the panel. */
47
+ async getAriaControls() {
48
+ const host = await this.host();
49
+ return host.getAttribute('aria-controls');
50
+ }
51
+ /** Whether the tab is closable. */
52
+ async isClosable() {
53
+ const closeBtn = await this.closeButton();
54
+ return closeBtn !== null;
55
+ }
56
+ /** Clicks the close button on the tab. Throws if not closable. */
57
+ async close() {
58
+ const closeBtn = await this.closeButton();
59
+ if (!closeBtn) {
60
+ throw new Error('Tab is not closable');
61
+ }
62
+ return closeBtn.click();
63
+ }
64
+ /** Focuses the tab button. */
65
+ async focus() {
66
+ const host = await this.host();
67
+ return host.focus();
68
+ }
69
+ /** Blurs the tab button. */
70
+ async blur() {
71
+ const host = await this.host();
72
+ return host.blur();
73
+ }
74
+ /** Whether the tab button is focused. */
75
+ async isFocused() {
76
+ const host = await this.host();
77
+ return host.isFocused();
78
+ }
79
+ }
80
+ /**
81
+ * Harness for interacting with a ComTabGroup in tests.
82
+ */
83
+ class ComTabGroupHarness extends ComponentHarness {
84
+ static hostSelector = 'com-tab-group';
85
+ /**
86
+ * Gets a HarnessPredicate for matching tab groups.
87
+ * @param options Filter options.
88
+ */
89
+ static with(options = {}) {
90
+ return new HarnessPredicate(ComTabGroupHarness, options);
91
+ }
92
+ /** Gets all tab buttons, optionally filtered. */
93
+ async getTabs(filters = {}) {
94
+ return this.locatorForAll(ComTabHarness.with(filters))();
95
+ }
96
+ /** Gets the currently selected tab. Throws if none is selected. */
97
+ async getSelectedTab() {
98
+ const tabs = await this.getTabs({ selected: true });
99
+ if (tabs.length === 0) {
100
+ throw new Error('No selected tab found');
101
+ }
102
+ return tabs[0];
103
+ }
104
+ /** Selects a tab matching the given filter. */
105
+ async selectTab(filter) {
106
+ const tabs = await this.getTabs(filter);
107
+ if (tabs.length === 0) {
108
+ throw new Error(`Could not find tab matching filter: ${JSON.stringify(filter)}`);
109
+ }
110
+ return tabs[0].select();
111
+ }
112
+ /** Gets all tab label texts. */
113
+ async getTabLabels() {
114
+ const tabs = await this.getTabs();
115
+ return parallel(() => tabs.map((t) => t.getLabel()));
116
+ }
117
+ }
118
+
119
+ // Testing utilities for the tabs component
120
+
121
+ /**
122
+ * Generated bundle index. Do not edit.
123
+ */
124
+
125
+ export { ComTabGroupHarness, ComTabHarness };
126
+ //# sourceMappingURL=ngx-com-components-tabs-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-com-components-tabs-testing.mjs","sources":["../../../projects/com/components/tabs/testing/tabs.harness.ts","../../../projects/com/components/tabs/testing/index.ts","../../../projects/com/components/tabs/testing/ngx-com-components-tabs-testing.ts"],"sourcesContent":["import {\n ComponentHarness,\n HarnessPredicate,\n parallel,\n} from '@angular/cdk/testing';\nimport type { BaseHarnessFilters } from '@angular/cdk/testing';\n\n/** Harness filters for ComTabHarness. */\nexport interface ComTabHarnessFilters extends BaseHarnessFilters {\n /** Filter by the tab's label text. */\n label?: string | RegExp;\n /** Filter by whether the tab is selected. */\n selected?: boolean;\n /** Filter by whether the tab is disabled. */\n disabled?: boolean;\n}\n\n/** Harness filters for ComTabGroupHarness. */\nexport type ComTabGroupHarnessFilters = BaseHarnessFilters;\n\n/**\n * Harness for interacting with an individual tab button in tests.\n */\nexport class ComTabHarness extends ComponentHarness {\n static hostSelector = 'button[role=\"tab\"]';\n\n private readonly closeButton = this.locatorForOptional('span[aria-hidden=\"true\"]');\n\n /**\n * Gets a HarnessPredicate for matching tab buttons.\n * @param options Filter options.\n */\n static with(options: ComTabHarnessFilters = {}): HarnessPredicate<ComTabHarness> {\n return new HarnessPredicate(ComTabHarness, options)\n .addOption('label', options.label, async (harness, label) => {\n const text = await harness.getLabel();\n return HarnessPredicate.stringMatches(text, label);\n })\n .addOption('selected', options.selected, async (harness, selected) => {\n return (await harness.isSelected()) === selected;\n })\n .addOption('disabled', options.disabled, async (harness, disabled) => {\n return (await harness.isDisabled()) === disabled;\n });\n }\n\n /** Gets the tab's label text. */\n async getLabel(): Promise<string> {\n const host = await this.host();\n return host.text();\n }\n\n /** Whether the tab is currently selected. */\n async isSelected(): Promise<boolean> {\n const host = await this.host();\n return (await host.getAttribute('aria-selected')) === 'true';\n }\n\n /** Whether the tab is disabled. */\n async isDisabled(): Promise<boolean> {\n const host = await this.host();\n return host.getProperty<boolean>('disabled');\n }\n\n /** Clicks the tab to select it. */\n async select(): Promise<void> {\n const host = await this.host();\n return host.click();\n }\n\n /** Gets the aria-controls attribute linking to the panel. */\n async getAriaControls(): Promise<string | null> {\n const host = await this.host();\n return host.getAttribute('aria-controls');\n }\n\n /** Whether the tab is closable. */\n async isClosable(): Promise<boolean> {\n const closeBtn = await this.closeButton();\n return closeBtn !== null;\n }\n\n /** Clicks the close button on the tab. Throws if not closable. */\n async close(): Promise<void> {\n const closeBtn = await this.closeButton();\n if (!closeBtn) {\n throw new Error('Tab is not closable');\n }\n return closeBtn.click();\n }\n\n /** Focuses the tab button. */\n async focus(): Promise<void> {\n const host = await this.host();\n return host.focus();\n }\n\n /** Blurs the tab button. */\n async blur(): Promise<void> {\n const host = await this.host();\n return host.blur();\n }\n\n /** Whether the tab button is focused. */\n async isFocused(): Promise<boolean> {\n const host = await this.host();\n return host.isFocused();\n }\n}\n\n/**\n * Harness for interacting with a ComTabGroup in tests.\n */\nexport class ComTabGroupHarness extends ComponentHarness {\n static hostSelector = 'com-tab-group';\n\n /**\n * Gets a HarnessPredicate for matching tab groups.\n * @param options Filter options.\n */\n static with(options: ComTabGroupHarnessFilters = {}): HarnessPredicate<ComTabGroupHarness> {\n return new HarnessPredicate(ComTabGroupHarness, options);\n }\n\n /** Gets all tab buttons, optionally filtered. */\n async getTabs(filters: ComTabHarnessFilters = {}): Promise<ComTabHarness[]> {\n return this.locatorForAll(ComTabHarness.with(filters))();\n }\n\n /** Gets the currently selected tab. Throws if none is selected. */\n async getSelectedTab(): Promise<ComTabHarness> {\n const tabs = await this.getTabs({ selected: true });\n if (tabs.length === 0) {\n throw new Error('No selected tab found');\n }\n return tabs[0]!;\n }\n\n /** Selects a tab matching the given filter. */\n async selectTab(filter: ComTabHarnessFilters): Promise<void> {\n const tabs = await this.getTabs(filter);\n if (tabs.length === 0) {\n throw new Error(`Could not find tab matching filter: ${JSON.stringify(filter)}`);\n }\n return tabs[0]!.select();\n }\n\n /** Gets all tab label texts. */\n async getTabLabels(): Promise<string[]> {\n const tabs = await this.getTabs();\n return parallel(() => tabs.map((t) => t.getLabel()));\n }\n}\n","// Testing utilities for the tabs component\n\nexport {\n ComTabHarness,\n ComTabGroupHarness,\n} from './tabs.harness';\n\nexport type {\n ComTabHarnessFilters,\n ComTabGroupHarnessFilters,\n} from './tabs.harness';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAoBA;;AAEG;AACG,MAAO,aAAc,SAAQ,gBAAgB,CAAA;AACjD,IAAA,OAAO,YAAY,GAAG,oBAAoB;AAEzB,IAAA,WAAW,GAAG,IAAI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AI,gBAAgB,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAC1D;;AAGA,IAAA,MAAM,OAAO,CAAC,OAAA,GAAgC,EAAE,EAAA;AAC9C,QAAA,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE;IAC1D;;AAGA,IAAA,MAAM,cAAc,GAAA;AAClB,QAAA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACnD,QAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AACrB,YAAA,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC;QAC1C;AACA,QAAA,OAAO,IAAI,CAAC,CAAC,CAAE;IACjB;;IAGA,MAAM,SAAS,CAAC,MAA4B,EAAA;QAC1C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AACvC,QAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AACrB,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,oCAAA,EAAuC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA,CAAE,CAAC;QAClF;AACA,QAAA,OAAO,IAAI,CAAC,CAAC,CAAE,CAAC,MAAM,EAAE;IAC1B;;AAGA,IAAA,MAAM,YAAY,GAAA;AAChB,QAAA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE;QACjC,OAAO,QAAQ,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtD;;;ACvJF;;ACAA;;AAEG;;;;"}
@@ -0,0 +1,117 @@
1
+ import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
2
+
3
+ /**
4
+ * Harness for interacting with a ComTimePicker in tests.
5
+ */
6
+ class ComTimePickerHarness extends ComponentHarness {
7
+ static hostSelector = 'com-time-picker';
8
+ hourInput = this.locatorFor('input[aria-label="Hours"]');
9
+ minuteInput = this.locatorFor('input[aria-label="Minutes"]');
10
+ secondInput = this.locatorForOptional('input[aria-label="Seconds"]');
11
+ periodToggle = this.locatorForOptional('button');
12
+ /**
13
+ * Gets a HarnessPredicate for matching time pickers.
14
+ * @param options Filter options.
15
+ */
16
+ static with(options = {}) {
17
+ return new HarnessPredicate(ComTimePickerHarness, options)
18
+ .addOption('disabled', options.disabled, async (harness, disabled) => {
19
+ return (await harness.isDisabled()) === disabled;
20
+ });
21
+ }
22
+ /** Gets the current hours value from the hours spinbutton. */
23
+ async getHours() {
24
+ const el = await this.hourInput();
25
+ const value = await el.getAttribute('aria-valuenow');
26
+ return Number(value);
27
+ }
28
+ /** Gets the current minutes value from the minutes spinbutton. */
29
+ async getMinutes() {
30
+ const el = await this.minuteInput();
31
+ const value = await el.getAttribute('aria-valuenow');
32
+ return Number(value);
33
+ }
34
+ /** Gets the current seconds value, or null if seconds field is not shown. */
35
+ async getSeconds() {
36
+ const el = await this.secondInput();
37
+ if (!el)
38
+ return null;
39
+ const value = await el.getAttribute('aria-valuenow');
40
+ return value !== null ? Number(value) : null;
41
+ }
42
+ /** Gets the current period (AM/PM), or null if not in 12-hour format. */
43
+ async getPeriod() {
44
+ const el = await this.periodToggle();
45
+ if (!el)
46
+ return null;
47
+ const text = (await el.text()).trim();
48
+ return text;
49
+ }
50
+ /** Sets the hours value by clearing and typing into the hours input. */
51
+ async setHours(value) {
52
+ const el = await this.hourInput();
53
+ await el.clear();
54
+ await el.sendKeys(String(value));
55
+ }
56
+ /** Sets the minutes value by clearing and typing into the minutes input. */
57
+ async setMinutes(value) {
58
+ const el = await this.minuteInput();
59
+ await el.clear();
60
+ await el.sendKeys(String(value));
61
+ }
62
+ /** Sets the seconds value. Throws if the seconds field is not shown. */
63
+ async setSeconds(value) {
64
+ const el = await this.secondInput();
65
+ if (!el) {
66
+ throw Error('Cannot set seconds — the time picker does not have a seconds field. Set [showSeconds]="true" first.');
67
+ }
68
+ await el.clear();
69
+ await el.sendKeys(String(value));
70
+ }
71
+ /** Toggles the AM/PM period. Throws if not in 12-hour format. */
72
+ async togglePeriod() {
73
+ const el = await this.periodToggle();
74
+ if (!el) {
75
+ throw Error('Cannot toggle period — the time picker is not in 12-hour format. Set [use12HourFormat]="true" first.');
76
+ }
77
+ await el.click();
78
+ }
79
+ /** Whether the time picker is disabled. */
80
+ async isDisabled() {
81
+ const el = await this.hourInput();
82
+ return el.getProperty('disabled');
83
+ }
84
+ /** Whether the seconds field is visible. */
85
+ async hasSeconds() {
86
+ const el = await this.secondInput();
87
+ return el !== null;
88
+ }
89
+ /** Whether the time picker is in 12-hour format (has a period toggle). */
90
+ async has12HourFormat() {
91
+ const el = await this.periodToggle();
92
+ return el !== null;
93
+ }
94
+ /** Focuses the hours input element. */
95
+ async focus() {
96
+ const el = await this.hourInput();
97
+ return el.focus();
98
+ }
99
+ /** Blurs the hours input element. */
100
+ async blur() {
101
+ const el = await this.hourInput();
102
+ return el.blur();
103
+ }
104
+ /** Whether the time picker host element is focused. */
105
+ async isFocused() {
106
+ return (await this.host()).isFocused();
107
+ }
108
+ }
109
+
110
+ // Testing utilities for the timepicker component
111
+
112
+ /**
113
+ * Generated bundle index. Do not edit.
114
+ */
115
+
116
+ export { ComTimePickerHarness };
117
+ //# sourceMappingURL=ngx-com-components-timepicker-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-com-components-timepicker-testing.mjs","sources":["../../../projects/com/components/timepicker/testing/timepicker.harness.ts","../../../projects/com/components/timepicker/testing/index.ts","../../../projects/com/components/timepicker/testing/ngx-com-components-timepicker-testing.ts"],"sourcesContent":["import {\n ComponentHarness,\n HarnessPredicate,\n} from '@angular/cdk/testing';\nimport type { BaseHarnessFilters } from '@angular/cdk/testing';\n\n/** Harness filters for ComTimePickerHarness. */\nexport interface ComTimePickerHarnessFilters extends BaseHarnessFilters {\n /** Filter by whether the time picker is disabled. */\n disabled?: boolean;\n}\n\n/**\n * Harness for interacting with a ComTimePicker in tests.\n */\nexport class ComTimePickerHarness extends ComponentHarness {\n static hostSelector = 'com-time-picker';\n\n private readonly hourInput = this.locatorFor('input[aria-label=\"Hours\"]');\n private readonly minuteInput = this.locatorFor('input[aria-label=\"Minutes\"]');\n private readonly secondInput = this.locatorForOptional('input[aria-label=\"Seconds\"]');\n private readonly periodToggle = this.locatorForOptional('button');\n\n /**\n * Gets a HarnessPredicate for matching time pickers.\n * @param options Filter options.\n */\n static with(options: ComTimePickerHarnessFilters = {}): HarnessPredicate<ComTimePickerHarness> {\n return new HarnessPredicate(ComTimePickerHarness, options)\n .addOption('disabled', options.disabled, async (harness, disabled) => {\n return (await harness.isDisabled()) === disabled;\n });\n }\n\n /** Gets the current hours value from the hours spinbutton. */\n async getHours(): Promise<number> {\n const el = await this.hourInput();\n const value = await el.getAttribute('aria-valuenow');\n return Number(value);\n }\n\n /** Gets the current minutes value from the minutes spinbutton. */\n async getMinutes(): Promise<number> {\n const el = await this.minuteInput();\n const value = await el.getAttribute('aria-valuenow');\n return Number(value);\n }\n\n /** Gets the current seconds value, or null if seconds field is not shown. */\n async getSeconds(): Promise<number | null> {\n const el = await this.secondInput();\n if (!el) return null;\n const value = await el.getAttribute('aria-valuenow');\n return value !== null ? Number(value) : null;\n }\n\n /** Gets the current period (AM/PM), or null if not in 12-hour format. */\n async getPeriod(): Promise<'AM' | 'PM' | null> {\n const el = await this.periodToggle();\n if (!el) return null;\n const text = (await el.text()).trim();\n return text as 'AM' | 'PM';\n }\n\n /** Sets the hours value by clearing and typing into the hours input. */\n async setHours(value: number): Promise<void> {\n const el = await this.hourInput();\n await el.clear();\n await el.sendKeys(String(value));\n }\n\n /** Sets the minutes value by clearing and typing into the minutes input. */\n async setMinutes(value: number): Promise<void> {\n const el = await this.minuteInput();\n await el.clear();\n await el.sendKeys(String(value));\n }\n\n /** Sets the seconds value. Throws if the seconds field is not shown. */\n async setSeconds(value: number): Promise<void> {\n const el = await this.secondInput();\n if (!el) {\n throw Error('Cannot set seconds — the time picker does not have a seconds field. Set [showSeconds]=\"true\" first.');\n }\n await el.clear();\n await el.sendKeys(String(value));\n }\n\n /** Toggles the AM/PM period. Throws if not in 12-hour format. */\n async togglePeriod(): Promise<void> {\n const el = await this.periodToggle();\n if (!el) {\n throw Error('Cannot toggle period — the time picker is not in 12-hour format. Set [use12HourFormat]=\"true\" first.');\n }\n await el.click();\n }\n\n /** Whether the time picker is disabled. */\n async isDisabled(): Promise<boolean> {\n const el = await this.hourInput();\n return el.getProperty<boolean>('disabled');\n }\n\n /** Whether the seconds field is visible. */\n async hasSeconds(): Promise<boolean> {\n const el = await this.secondInput();\n return el !== null;\n }\n\n /** Whether the time picker is in 12-hour format (has a period toggle). */\n async has12HourFormat(): Promise<boolean> {\n const el = await this.periodToggle();\n return el !== null;\n }\n\n /** Focuses the hours input element. */\n async focus(): Promise<void> {\n const el = await this.hourInput();\n return el.focus();\n }\n\n /** Blurs the hours input element. */\n async blur(): Promise<void> {\n const el = await this.hourInput();\n return el.blur();\n }\n\n /** Whether the time picker host element is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n}\n","// Testing utilities for the timepicker component\n\nexport { ComTimePickerHarness } from './timepicker.harness';\n\nexport type { ComTimePickerHarnessFilters } from './timepicker.harness';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAYA;;AAEG;AACG,MAAO,oBAAqB,SAAQ,gBAAgB,CAAA;AACxD,IAAA,OAAO,YAAY,GAAG,iBAAiB;AAEtB,IAAA,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,2BAA2B,CAAC;AACxD,IAAA,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,6BAA6B,CAAC;AAC5D,IAAA,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,6BAA6B,CAAC;AACpE,IAAA,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC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