ngx-com 0.1.16 → 0.1.18

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 (82) 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-checkbox.mjs +2 -2
  10. package/fesm2022/ngx-com-components-checkbox.mjs.map +1 -1
  11. package/fesm2022/ngx-com-components-code-block-testing.mjs +88 -0
  12. package/fesm2022/ngx-com-components-code-block-testing.mjs.map +1 -0
  13. package/fesm2022/ngx-com-components-collapsible-testing.mjs +104 -0
  14. package/fesm2022/ngx-com-components-collapsible-testing.mjs.map +1 -0
  15. package/fesm2022/ngx-com-components-confirm-testing.mjs +150 -0
  16. package/fesm2022/ngx-com-components-confirm-testing.mjs.map +1 -0
  17. package/fesm2022/ngx-com-components-datepicker-testing.mjs +137 -0
  18. package/fesm2022/ngx-com-components-datepicker-testing.mjs.map +1 -0
  19. package/fesm2022/ngx-com-components-dialog-testing.mjs +109 -0
  20. package/fesm2022/ngx-com-components-dialog-testing.mjs.map +1 -0
  21. package/fesm2022/ngx-com-components-dialog.mjs +18 -18
  22. package/fesm2022/ngx-com-components-dialog.mjs.map +1 -1
  23. package/fesm2022/ngx-com-components-dropdown.mjs +39 -0
  24. package/fesm2022/ngx-com-components-dropdown.mjs.map +1 -1
  25. package/fesm2022/ngx-com-components-form-field-testing.mjs +140 -0
  26. package/fesm2022/ngx-com-components-form-field-testing.mjs.map +1 -0
  27. package/fesm2022/ngx-com-components-form-field.mjs +5 -1
  28. package/fesm2022/ngx-com-components-form-field.mjs.map +1 -1
  29. package/fesm2022/ngx-com-components-menu-testing.mjs +298 -0
  30. package/fesm2022/ngx-com-components-menu-testing.mjs.map +1 -0
  31. package/fesm2022/ngx-com-components-paginator-testing.mjs +128 -0
  32. package/fesm2022/ngx-com-components-paginator-testing.mjs.map +1 -0
  33. package/fesm2022/ngx-com-components-popover-testing.mjs +115 -0
  34. package/fesm2022/ngx-com-components-popover-testing.mjs.map +1 -0
  35. package/fesm2022/ngx-com-components-radio-testing.mjs +157 -0
  36. package/fesm2022/ngx-com-components-radio-testing.mjs.map +1 -0
  37. package/fesm2022/ngx-com-components-radio.mjs +2 -2
  38. package/fesm2022/ngx-com-components-radio.mjs.map +1 -1
  39. package/fesm2022/ngx-com-components-segmented-control-testing.mjs +122 -0
  40. package/fesm2022/ngx-com-components-segmented-control-testing.mjs.map +1 -0
  41. package/fesm2022/ngx-com-components-sort-testing.mjs +108 -0
  42. package/fesm2022/ngx-com-components-sort-testing.mjs.map +1 -0
  43. package/fesm2022/ngx-com-components-switch-testing.mjs +103 -0
  44. package/fesm2022/ngx-com-components-switch-testing.mjs.map +1 -0
  45. package/fesm2022/ngx-com-components-switch.mjs +2 -2
  46. package/fesm2022/ngx-com-components-switch.mjs.map +1 -1
  47. package/fesm2022/ngx-com-components-table-testing.mjs +198 -0
  48. package/fesm2022/ngx-com-components-table-testing.mjs.map +1 -0
  49. package/fesm2022/ngx-com-components-tabs-testing.mjs +126 -0
  50. package/fesm2022/ngx-com-components-tabs-testing.mjs.map +1 -0
  51. package/fesm2022/ngx-com-components-timepicker-testing.mjs +117 -0
  52. package/fesm2022/ngx-com-components-timepicker-testing.mjs.map +1 -0
  53. package/fesm2022/ngx-com-components-toast-testing.mjs +172 -0
  54. package/fesm2022/ngx-com-components-toast-testing.mjs.map +1 -0
  55. package/fesm2022/ngx-com-components-toast.mjs +4 -4
  56. package/fesm2022/ngx-com-components-toast.mjs.map +1 -1
  57. package/fesm2022/ngx-com-components-tooltip-testing.mjs +117 -0
  58. package/fesm2022/ngx-com-components-tooltip-testing.mjs.map +1 -0
  59. package/package.json +89 -1
  60. package/types/ngx-com-components-alert-testing.d.ts +41 -0
  61. package/types/ngx-com-components-calendar-testing.d.ts +80 -0
  62. package/types/ngx-com-components-carousel-testing.d.ts +51 -0
  63. package/types/ngx-com-components-checkbox-testing.d.ts +56 -0
  64. package/types/ngx-com-components-code-block-testing.d.ts +45 -0
  65. package/types/ngx-com-components-collapsible-testing.d.ts +53 -0
  66. package/types/ngx-com-components-confirm-testing.d.ts +78 -0
  67. package/types/ngx-com-components-datepicker-testing.d.ts +61 -0
  68. package/types/ngx-com-components-dialog-testing.d.ts +57 -0
  69. package/types/ngx-com-components-dropdown.d.ts +12 -0
  70. package/types/ngx-com-components-form-field-testing.d.ts +61 -0
  71. package/types/ngx-com-components-menu-testing.d.ts +167 -0
  72. package/types/ngx-com-components-paginator-testing.d.ts +58 -0
  73. package/types/ngx-com-components-popover-testing.d.ts +63 -0
  74. package/types/ngx-com-components-radio-testing.d.ts +86 -0
  75. package/types/ngx-com-components-segmented-control-testing.d.ts +66 -0
  76. package/types/ngx-com-components-sort-testing.d.ts +62 -0
  77. package/types/ngx-com-components-switch-testing.d.ts +52 -0
  78. package/types/ngx-com-components-table-testing.d.ts +124 -0
  79. package/types/ngx-com-components-tabs-testing.d.ts +67 -0
  80. package/types/ngx-com-components-timepicker-testing.d.ts +53 -0
  81. package/types/ngx-com-components-toast-testing.d.ts +93 -0
  82. package/types/ngx-com-components-tooltip-testing.d.ts +57 -0
@@ -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,CAAC,kBAAkB,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C,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,QAAQ,CAAC;A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C,OAAO,EAAE,KAAK,IAAI;IACpB;;AAGA,IAAA,MAAM,eAAe,GAAA;AACnB,QAAA,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE;QACpC,OAAO,EAAE,KAAK,IAAI;IACpB;;AAGA,IAAA,MAAM,KAAK,GAAA;AACT,QAAA,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE;AACjC,QAAA,OAAO,EAAE,CAAC,KAAK,EAAE;IACnB;;AAGA,IAAA,MAAM,IAAI,GAAA;AACR,QAAA,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE;AACjC,QAAA,OAAO,EAAE,CAAC,IAAI,EAAE;IAClB;;AAGA,IAAA,MAAM,SAAS,GAAA;QACb,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE;IACxC;;;AClIF;;ACAA;;AAEG;;;;"}
@@ -0,0 +1,172 @@
1
+ import { ComponentHarness, HarnessPredicate, parallel } from '@angular/cdk/testing';
2
+
3
+ /**
4
+ * Harness for interacting with an individual toast notification in tests.
5
+ *
6
+ * Because toasts are rendered inside a CDK overlay, use
7
+ * `TestbedHarnessEnvironment.documentRootLoader(fixture)` or
8
+ * `documentRootLocatorFactory()` to locate them.
9
+ */
10
+ class ComToastHarness extends ComponentHarness {
11
+ static hostSelector = 'com-toast';
12
+ innerDiv = this.locatorFor('div[role]');
13
+ titleEl = this.locatorForOptional('[data-part="title"]');
14
+ messageEl = this.locatorForOptional('[data-part="message"]');
15
+ closeButton = this.locatorForOptional('button[aria-label="Dismiss notification"]');
16
+ actionButton = this.locatorForOptional('.flex-1 button');
17
+ /**
18
+ * Gets a HarnessPredicate for matching toasts.
19
+ * @param options Filter options.
20
+ */
21
+ static with(options = {}) {
22
+ return new HarnessPredicate(ComToastHarness, options)
23
+ .addOption('message', options.message, async (harness, message) => {
24
+ const text = await harness.getMessageText();
25
+ return HarnessPredicate.stringMatches(text, message);
26
+ })
27
+ .addOption('title', options.title, async (harness, title) => {
28
+ const text = await harness.getTitleText();
29
+ return HarnessPredicate.stringMatches(text, title);
30
+ });
31
+ }
32
+ /** Gets the ARIA role of the toast (`"alert"` or `"status"`). */
33
+ async getRole() {
34
+ const div = await this.innerDiv();
35
+ return div.getAttribute('role');
36
+ }
37
+ /** Gets the `aria-live` value of the toast (`"assertive"` or `"polite"`). */
38
+ async getAriaLive() {
39
+ const div = await this.innerDiv();
40
+ return div.getAttribute('aria-live');
41
+ }
42
+ /** Gets the `data-state` attribute (`"open"` or `"closed"`). */
43
+ async getState() {
44
+ const div = await this.innerDiv();
45
+ return div.getAttribute('data-state');
46
+ }
47
+ /**
48
+ * Gets the toast's title text, or `null` if no title is present.
49
+ */
50
+ async getTitleText() {
51
+ const el = await this.titleEl();
52
+ if (!el) {
53
+ return null;
54
+ }
55
+ return el.text();
56
+ }
57
+ /** Gets the toast's message text. */
58
+ async getMessageText() {
59
+ const el = await this.messageEl();
60
+ if (!el) {
61
+ const host = await this.host();
62
+ return host.text();
63
+ }
64
+ return el.text();
65
+ }
66
+ /** Whether the toast has an action button. */
67
+ async hasAction() {
68
+ const btn = await this.actionButton();
69
+ return btn !== null;
70
+ }
71
+ /** Gets the action button's text, or `null` if no action exists. */
72
+ async getActionText() {
73
+ const btn = await this.actionButton();
74
+ if (!btn) {
75
+ return null;
76
+ }
77
+ return btn.text();
78
+ }
79
+ /**
80
+ * Clicks the action button.
81
+ * @throws If no action button is present.
82
+ */
83
+ async clickAction() {
84
+ const btn = await this.actionButton();
85
+ if (!btn) {
86
+ throw new Error('Cannot click action: toast does not have an action button.');
87
+ }
88
+ return btn.click();
89
+ }
90
+ /** Whether the toast has a close (dismiss) button. */
91
+ async isDismissible() {
92
+ const btn = await this.closeButton();
93
+ return btn !== null;
94
+ }
95
+ /**
96
+ * Clicks the close button to dismiss the toast.
97
+ * @throws If no close button is present.
98
+ */
99
+ async dismiss() {
100
+ const btn = await this.closeButton();
101
+ if (!btn) {
102
+ throw new Error('Cannot dismiss: toast does not have a close button. '
103
+ + 'Check that showClose is enabled.');
104
+ }
105
+ return btn.click();
106
+ }
107
+ /** Whether the toast is disabled. */
108
+ async isDisabled() {
109
+ const host = await this.host();
110
+ return (await host.getAttribute('aria-disabled')) === 'true';
111
+ }
112
+ /** Whether the toast host is focused. */
113
+ async isFocused() {
114
+ const host = await this.host();
115
+ return host.isFocused();
116
+ }
117
+ /** Focuses the toast host element. */
118
+ async focus() {
119
+ const host = await this.host();
120
+ return host.focus();
121
+ }
122
+ /** Blurs the toast host element. */
123
+ async blur() {
124
+ const host = await this.host();
125
+ return host.blur();
126
+ }
127
+ }
128
+ /**
129
+ * Harness for interacting with the toast container in tests.
130
+ *
131
+ * The container is rendered in a CDK overlay. Use
132
+ * `TestbedHarnessEnvironment.documentRootLoader(fixture)` to locate it.
133
+ */
134
+ class ComToastContainerHarness extends ComponentHarness {
135
+ static hostSelector = 'com-toast-container';
136
+ regionDiv = this.locatorFor('[role="region"]');
137
+ /**
138
+ * Gets a HarnessPredicate for matching toast containers.
139
+ * @param options Filter options.
140
+ */
141
+ static with(options = {}) {
142
+ return new HarnessPredicate(ComToastContainerHarness, options);
143
+ }
144
+ /** Gets the container's `aria-label` attribute. */
145
+ async getAriaLabel() {
146
+ const region = await this.regionDiv();
147
+ return region.getAttribute('aria-label');
148
+ }
149
+ /** Gets all toast harnesses inside the container, optionally filtered. */
150
+ async getToasts(filters = {}) {
151
+ return this.locatorForAll(ComToastHarness.with(filters))();
152
+ }
153
+ /** Gets the number of toasts currently in the container. */
154
+ async getToastCount() {
155
+ const toasts = await this.getToasts();
156
+ return toasts.length;
157
+ }
158
+ /** Gets the message text of all toasts. */
159
+ async getToastMessages() {
160
+ const toasts = await this.getToasts();
161
+ return parallel(() => toasts.map((t) => t.getMessageText()));
162
+ }
163
+ }
164
+
165
+ // Testing utilities for the toast component
166
+
167
+ /**
168
+ * Generated bundle index. Do not edit.
169
+ */
170
+
171
+ export { ComToastContainerHarness, ComToastHarness };
172
+ //# sourceMappingURL=ngx-com-components-toast-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-com-components-toast-testing.mjs","sources":["../../../projects/com/components/toast/testing/toast.harness.ts","../../../projects/com/components/toast/testing/index.ts","../../../projects/com/components/toast/testing/ngx-com-components-toast-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 ComToastHarness. */\nexport interface ComToastHarnessFilters extends BaseHarnessFilters {\n /** Filter by the toast's message text. */\n message?: string | RegExp;\n /** Filter by the toast's title text. */\n title?: string | RegExp;\n}\n\n/** Harness filters for ComToastContainerHarness. */\nexport type ComToastContainerHarnessFilters = BaseHarnessFilters;\n\n/**\n * Harness for interacting with an individual toast notification in tests.\n *\n * Because toasts are rendered inside a CDK overlay, use\n * `TestbedHarnessEnvironment.documentRootLoader(fixture)` or\n * `documentRootLocatorFactory()` to locate them.\n */\nexport class ComToastHarness extends ComponentHarness {\n static hostSelector = 'com-toast';\n\n private readonly innerDiv = this.locatorFor('div[role]');\n private readonly titleEl = this.locatorForOptional('[data-part=\"title\"]');\n private readonly messageEl = this.locatorForOptional(\n '[data-part=\"message\"]',\n );\n private readonly closeButton = this.locatorForOptional(\n 'button[aria-label=\"Dismiss notification\"]',\n );\n private readonly actionButton = this.locatorForOptional('.flex-1 button');\n\n /**\n * Gets a HarnessPredicate for matching toasts.\n * @param options Filter options.\n */\n static with(\n options: ComToastHarnessFilters = {},\n ): HarnessPredicate<ComToastHarness> {\n return new HarnessPredicate(ComToastHarness, options)\n .addOption('message', options.message, async (harness, message) => {\n const text = await harness.getMessageText();\n return HarnessPredicate.stringMatches(text, message);\n })\n .addOption('title', options.title, async (harness, title) => {\n const text = await harness.getTitleText();\n return HarnessPredicate.stringMatches(text, title);\n });\n }\n\n /** Gets the ARIA role of the toast (`\"alert\"` or `\"status\"`). */\n async getRole(): Promise<string | null> {\n const div = await this.innerDiv();\n return div.getAttribute('role');\n }\n\n /** Gets the `aria-live` value of the toast (`\"assertive\"` or `\"polite\"`). */\n async getAriaLive(): Promise<string | null> {\n const div = await this.innerDiv();\n return div.getAttribute('aria-live');\n }\n\n /** Gets the `data-state` attribute (`\"open\"` or `\"closed\"`). */\n async getState(): Promise<string | null> {\n const div = await this.innerDiv();\n return div.getAttribute('data-state');\n }\n\n /**\n * Gets the toast's title text, or `null` if no title is present.\n */\n async getTitleText(): Promise<string | null> {\n const el = await this.titleEl();\n if (!el) {\n return null;\n }\n return el.text();\n }\n\n /** Gets the toast's message text. */\n async getMessageText(): Promise<string> {\n const el = await this.messageEl();\n if (!el) {\n const host = await this.host();\n return host.text();\n }\n return el.text();\n }\n\n /** Whether the toast has an action button. */\n async hasAction(): Promise<boolean> {\n const btn = await this.actionButton();\n return btn !== null;\n }\n\n /** Gets the action button's text, or `null` if no action exists. */\n async getActionText(): Promise<string | null> {\n const btn = await this.actionButton();\n if (!btn) {\n return null;\n }\n return btn.text();\n }\n\n /**\n * Clicks the action button.\n * @throws If no action button is present.\n */\n async clickAction(): Promise<void> {\n const btn = await this.actionButton();\n if (!btn) {\n throw new Error(\n 'Cannot click action: toast does not have an action button.',\n );\n }\n return btn.click();\n }\n\n /** Whether the toast has a close (dismiss) button. */\n async isDismissible(): Promise<boolean> {\n const btn = await this.closeButton();\n return btn !== null;\n }\n\n /**\n * Clicks the close button to dismiss the toast.\n * @throws If no close button is present.\n */\n async dismiss(): Promise<void> {\n const btn = await this.closeButton();\n if (!btn) {\n throw new Error(\n 'Cannot dismiss: toast does not have a close button. '\n + 'Check that showClose is enabled.',\n );\n }\n return btn.click();\n }\n\n /** Whether the toast is disabled. */\n async isDisabled(): Promise<boolean> {\n const host = await this.host();\n return (await host.getAttribute('aria-disabled')) === 'true';\n }\n\n /** Whether the toast host is focused. */\n async isFocused(): Promise<boolean> {\n const host = await this.host();\n return host.isFocused();\n }\n\n /** Focuses the toast host element. */\n async focus(): Promise<void> {\n const host = await this.host();\n return host.focus();\n }\n\n /** Blurs the toast host element. */\n async blur(): Promise<void> {\n const host = await this.host();\n return host.blur();\n }\n}\n\n/**\n * Harness for interacting with the toast container in tests.\n *\n * The container is rendered in a CDK overlay. Use\n * `TestbedHarnessEnvironment.documentRootLoader(fixture)` to locate it.\n */\nexport class ComToastContainerHarness extends ComponentHarness {\n static hostSelector = 'com-toast-container';\n\n private readonly regionDiv = this.locatorFor('[role=\"region\"]');\n\n /**\n * Gets a HarnessPredicate for matching toast containers.\n * @param options Filter options.\n */\n static with(\n options: ComToastContainerHarnessFilters = {},\n ): HarnessPredicate<ComToastContainerHarness> {\n return new HarnessPredicate(ComToastContainerHarness, options);\n }\n\n /** Gets the container's `aria-label` attribute. */\n async getAriaLabel(): Promise<string | null> {\n const region = await this.regionDiv();\n return region.getAttribute('aria-label');\n }\n\n /** Gets all toast harnesses inside the container, optionally filtered. */\n async getToasts(\n filters: ComToastHarnessFilters = {},\n ): Promise<ComToastHarness[]> {\n return this.locatorForAll(ComToastHarness.with(filters))();\n }\n\n /** Gets the number of toasts currently in the container. */\n async getToastCount(): Promise<number> {\n const toasts = await this.getToasts();\n return toasts.length;\n }\n\n /** Gets the message text of all toasts. */\n async getToastMessages(): Promise<string[]> {\n const toasts = await this.getToasts();\n return parallel(() => toasts.map((t) => t.getMessageText()));\n }\n}\n","// Testing utilities for the toast component\n\nexport {\n ComToastHarness,\n ComToastContainerHarness,\n} from './toast.harness';\n\nexport type {\n ComToastHarnessFilters,\n ComToastContainerHarnessFilters,\n} from './toast.harness';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAkBA;;;;;;AAMG;AACG,MAAO,eAAgB,SAAQ,gBAAgB,CAAA;AACnD,IAAA,OAAO,YAAY,GAAG,WAAW;AAEhB,IAAA,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;AACvC,IAAA,OAAO,GAAG,IAA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AO,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC;IAC1C;;AAGA,IAAA,MAAM,SAAS,CACb,OAAA,GAAkC,EAAE,EAAA;AAEpC,QAAA,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE;IAC5D;;AAGA,IAAA,MAAM,aAAa,GAAA;AACjB,QAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE;QACrC,OAAO,MAAM,CAAC,MAAM;IACtB;;AAGA,IAAA,MAAM,gBAAgB,GAAA;AACpB,QAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE;QACrC,OAAO,QAAQ,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC;IAC9D;;;ACtNF;;ACAA;;AAEG;;;;"}
@@ -249,9 +249,9 @@ class ComToastComponent {
249
249
  />
250
250
  <div class="flex-1 min-w-0">
251
251
  @if (state().data.title) {
252
- <p class="text-sm font-semibold">{{ state().data.title }}</p>
252
+ <p data-part="title" class="text-sm font-semibold">{{ state().data.title }}</p>
253
253
  }
254
- <p class="text-sm" [class.mt-1]="state().data.title">
254
+ <p data-part="message" class="text-sm" [class.mt-1]="state().data.title">
255
255
  {{ state().data.message }}
256
256
  </p>
257
257
  @if (state().data.action) {
@@ -312,9 +312,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
312
312
  />
313
313
  <div class="flex-1 min-w-0">
314
314
  @if (state().data.title) {
315
- <p class="text-sm font-semibold">{{ state().data.title }}</p>
315
+ <p data-part="title" class="text-sm font-semibold">{{ state().data.title }}</p>
316
316
  }
317
- <p class="text-sm" [class.mt-1]="state().data.title">
317
+ <p data-part="message" class="text-sm" [class.mt-1]="state().data.title">
318
318
  {{ state().data.message }}
319
319
  </p>
320
320
  @if (state().data.action) {