@onecx/angular-testing 4.43.1 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/esm2022/lib/harnesses/button.harness.mjs +31 -0
  2. package/esm2022/lib/harnesses/div.harness.mjs +28 -0
  3. package/esm2022/lib/harnesses/input.harness.mjs +39 -0
  4. package/esm2022/lib/harnesses/list-item.harness.mjs +17 -0
  5. package/esm2022/lib/harnesses/menu-item.harness.mjs +17 -0
  6. package/esm2022/lib/harnesses/p-tableCheckbox.harness.mjs +18 -0
  7. package/esm2022/lib/harnesses/p.harness.mjs +30 -0
  8. package/{esm2020 → esm2022}/lib/harnesses/primeng/p-accordion-tab.harness.mjs +2 -2
  9. package/{esm2020 → esm2022}/lib/harnesses/primeng/p-accordion.harness.mjs +2 -2
  10. package/esm2022/lib/harnesses/primeng/p-breadcrumb.harness.mjs +13 -0
  11. package/esm2022/lib/harnesses/primeng/p-button-directive.harness.mjs +23 -0
  12. package/esm2022/lib/harnesses/primeng/p-button.harness.mjs +27 -0
  13. package/{esm2020 → esm2022}/lib/harnesses/primeng/p-chart.harness.mjs +2 -2
  14. package/esm2022/lib/harnesses/primeng/p-checkbox.harness.mjs +27 -0
  15. package/esm2022/lib/harnesses/primeng/p-dialog.harness.mjs +25 -0
  16. package/esm2022/lib/harnesses/primeng/p-dropdown.harness.mjs +61 -0
  17. package/esm2022/lib/harnesses/primeng/p-menu-item.harness.mjs +25 -0
  18. package/esm2022/lib/harnesses/primeng/p-menu.harness.mjs +30 -0
  19. package/{esm2020 → esm2022}/lib/harnesses/primeng/p-menubar.harness.mjs +2 -2
  20. package/esm2022/lib/harnesses/primeng/p-multiSelect.harness.mjs +69 -0
  21. package/{esm2020 → esm2022}/lib/harnesses/primeng/p-multiSelectListItem.harness.mjs +2 -2
  22. package/{esm2020 → esm2022}/lib/harnesses/primeng/p-paginator.harness.mjs +2 -2
  23. package/esm2022/lib/harnesses/primeng/p-panelmenu-item.harness.mjs +26 -0
  24. package/{esm2020 → esm2022}/lib/harnesses/primeng/p-panelmenu.harness.mjs +2 -2
  25. package/esm2022/lib/harnesses/primeng/p-password.harness.mjs +34 -0
  26. package/esm2022/lib/harnesses/primeng/p-picklist.harness.mjs +64 -0
  27. package/{esm2020 → esm2022}/lib/harnesses/primeng/p-selectButton.harness.mjs +2 -2
  28. package/esm2022/lib/harnesses/span.harness.mjs +17 -0
  29. package/{esm2020 → esm2022}/lib/harnesses/table-header-column.harness.mjs +2 -2
  30. package/esm2022/lib/harnesses/table-row.harness.mjs +19 -0
  31. package/{fesm2020 → fesm2022}/onecx-angular-testing.mjs +44 -35
  32. package/fesm2022/onecx-angular-testing.mjs.map +1 -0
  33. package/package.json +7 -13
  34. package/esm2020/lib/harnesses/button.harness.mjs +0 -31
  35. package/esm2020/lib/harnesses/div.harness.mjs +0 -28
  36. package/esm2020/lib/harnesses/input.harness.mjs +0 -39
  37. package/esm2020/lib/harnesses/list-item.harness.mjs +0 -17
  38. package/esm2020/lib/harnesses/menu-item.harness.mjs +0 -17
  39. package/esm2020/lib/harnesses/p-tableCheckbox.harness.mjs +0 -18
  40. package/esm2020/lib/harnesses/p.harness.mjs +0 -30
  41. package/esm2020/lib/harnesses/primeng/p-breadcrumb.harness.mjs +0 -13
  42. package/esm2020/lib/harnesses/primeng/p-button-directive.harness.mjs +0 -23
  43. package/esm2020/lib/harnesses/primeng/p-button.harness.mjs +0 -27
  44. package/esm2020/lib/harnesses/primeng/p-checkbox.harness.mjs +0 -27
  45. package/esm2020/lib/harnesses/primeng/p-dialog.harness.mjs +0 -25
  46. package/esm2020/lib/harnesses/primeng/p-dropdown.harness.mjs +0 -61
  47. package/esm2020/lib/harnesses/primeng/p-menu-item.harness.mjs +0 -25
  48. package/esm2020/lib/harnesses/primeng/p-menu.harness.mjs +0 -30
  49. package/esm2020/lib/harnesses/primeng/p-multiSelect.harness.mjs +0 -60
  50. package/esm2020/lib/harnesses/primeng/p-panelmenu-item.harness.mjs +0 -26
  51. package/esm2020/lib/harnesses/primeng/p-password.harness.mjs +0 -34
  52. package/esm2020/lib/harnesses/primeng/p-picklist.harness.mjs +0 -64
  53. package/esm2020/lib/harnesses/span.harness.mjs +0 -17
  54. package/esm2020/lib/harnesses/table-row.harness.mjs +0 -19
  55. package/fesm2015/onecx-angular-testing.mjs +0 -938
  56. package/fesm2015/onecx-angular-testing.mjs.map +0 -1
  57. package/fesm2020/onecx-angular-testing.mjs.map +0 -1
  58. /package/{esm2020 → esm2022}/index.mjs +0 -0
  59. /package/{esm2020 → esm2022}/lib/harnesses/menu-item-with-icon.harness.mjs +0 -0
  60. /package/{esm2020 → esm2022}/lib/harnesses/utils/primeicon.utils.mjs +0 -0
  61. /package/{esm2020 → esm2022}/onecx-angular-testing.mjs +0 -0
@@ -1,938 +0,0 @@
1
- import { ComponentHarness, HarnessPredicate, ContentContainerComponentHarness, TestKey } from '@angular/cdk/testing';
2
- export * from '@angular/cdk/testing';
3
- import { __awaiter } from 'tslib';
4
- export * from '@angular/cdk/testing/testbed';
5
-
6
- class PAccordionTabHarness extends ComponentHarness {
7
- constructor() {
8
- super(...arguments);
9
- this.getButton = this.locatorFor('a.p-accordion-header-link');
10
- }
11
- expand() {
12
- return __awaiter(this, void 0, void 0, function* () {
13
- yield (yield this.getButton()).click();
14
- });
15
- }
16
- }
17
- PAccordionTabHarness.hostSelector = 'p-accordiontab';
18
-
19
- class PAccordionHarness extends ComponentHarness {
20
- constructor() {
21
- super(...arguments);
22
- this.getAllAccordionTabs = this.locatorForAll(PAccordionTabHarness);
23
- }
24
- }
25
- PAccordionHarness.hostSelector = 'p-accordion';
26
-
27
- class ListItemHarness extends ComponentHarness {
28
- static with(options) {
29
- return new HarnessPredicate(ListItemHarness, options).addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
30
- }
31
- getText() {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- return yield (yield this.host()).text();
34
- });
35
- }
36
- isSelected() {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- return (yield (yield this.host()).getAttribute('aria-selected')) === 'true' ? true : false;
39
- });
40
- }
41
- selectItem() {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- yield (yield this.host()).click();
44
- });
45
- }
46
- }
47
- ListItemHarness.hostSelector = 'li';
48
-
49
- class PBreadcrumbHarness extends ComponentHarness {
50
- constructor() {
51
- super(...arguments);
52
- this.getBreadcrumbItems = this.locatorForAll(ListItemHarness);
53
- }
54
- getBreadcrumbItem(itemText) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- return yield this.locatorForOptional(ListItemHarness.with({ text: itemText }))();
57
- });
58
- }
59
- }
60
- PBreadcrumbHarness.hostSelector = 'p-breadcrumb';
61
-
62
- class PButtonDirectiveHarness extends ComponentHarness {
63
- static with(options) {
64
- return new HarnessPredicate(PButtonDirectiveHarness, options).addOption('id', options.id, (harness, id) => HarnessPredicate.stringMatches(harness.getId(), id));
65
- }
66
- getId() {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- return yield (yield this.host()).getAttribute('id');
69
- });
70
- }
71
- click() {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- yield (yield this.host()).click();
74
- });
75
- }
76
- getLabel() {
77
- return __awaiter(this, void 0, void 0, function* () {
78
- return yield (yield this.host()).text();
79
- });
80
- }
81
- getIcon() {
82
- return __awaiter(this, void 0, void 0, function* () {
83
- return yield (yield this.host()).getAttribute('ng-reflect-icon');
84
- });
85
- }
86
- getDisabled() {
87
- return __awaiter(this, void 0, void 0, function* () {
88
- return yield (yield this.host()).getProperty('disabled');
89
- });
90
- }
91
- }
92
- PButtonDirectiveHarness.hostSelector = 'button[pButton]';
93
-
94
- class PButtonHarness extends ComponentHarness {
95
- static with(options) {
96
- return new HarnessPredicate(PButtonHarness, options)
97
- .addOption('id', options.id, (harness, id) => HarnessPredicate.stringMatches(harness.getId(), id))
98
- .addOption('name', options.name, (harness, name) => HarnessPredicate.stringMatches(harness.getName(), name))
99
- .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label))
100
- .addOption('icon', options.icon, (harness, icon) => HarnessPredicate.stringMatches(harness.getIcon(), icon));
101
- }
102
- getId() {
103
- return __awaiter(this, void 0, void 0, function* () {
104
- return yield (yield this.host()).getAttribute('id');
105
- });
106
- }
107
- getName() {
108
- return __awaiter(this, void 0, void 0, function* () {
109
- return yield (yield this.host()).getAttribute('name');
110
- });
111
- }
112
- getLabel() {
113
- return __awaiter(this, void 0, void 0, function* () {
114
- return yield (yield this.host()).text();
115
- });
116
- }
117
- getIcon() {
118
- return __awaiter(this, void 0, void 0, function* () {
119
- return yield (yield this.host()).getAttribute('ng-reflect-icon');
120
- });
121
- }
122
- click() {
123
- return __awaiter(this, void 0, void 0, function* () {
124
- yield (yield this.locatorFor('button')()).click();
125
- });
126
- }
127
- }
128
- PButtonHarness.hostSelector = 'p-button';
129
-
130
- class PChartHarness extends ComponentHarness {
131
- getType() {
132
- return __awaiter(this, void 0, void 0, function* () {
133
- return yield (yield this.host()).getAttribute('ng-reflect-type');
134
- });
135
- }
136
- getOptions() {
137
- return __awaiter(this, void 0, void 0, function* () {
138
- return yield (yield this.host()).getAttribute('ng-reflect-options');
139
- });
140
- }
141
- }
142
- PChartHarness.hostSelector = 'p-chart';
143
-
144
- class DivHarness extends ComponentHarness {
145
- static with(options) {
146
- return new HarnessPredicate(DivHarness, options).addOption('class', options.class, (harness, c) => HarnessPredicate.stringMatches(harness.getByClass(c), c));
147
- }
148
- getByClass(c) {
149
- return __awaiter(this, void 0, void 0, function* () {
150
- return (yield (yield this.host()).hasClass(c)) ? c : '';
151
- });
152
- }
153
- checkHasClass(value) {
154
- return __awaiter(this, void 0, void 0, function* () {
155
- return yield (yield this.host()).hasClass(value);
156
- });
157
- }
158
- getText() {
159
- return __awaiter(this, void 0, void 0, function* () {
160
- return yield (yield this.host()).text();
161
- });
162
- }
163
- getClassList() {
164
- return __awaiter(this, void 0, void 0, function* () {
165
- const host = yield this.host();
166
- const attributeString = yield host.getAttribute('class');
167
- if (attributeString) {
168
- return attributeString.trim().split(' ');
169
- }
170
- return [];
171
- });
172
- }
173
- click() {
174
- return __awaiter(this, void 0, void 0, function* () {
175
- yield (yield this.host()).click();
176
- });
177
- }
178
- }
179
- DivHarness.hostSelector = 'div';
180
-
181
- class InputHarness extends ComponentHarness {
182
- static with(options) {
183
- return new HarnessPredicate(InputHarness, options).addOption('id', options.id, (harness, id) => HarnessPredicate.stringMatches(harness.getId(), id));
184
- }
185
- getId() {
186
- return __awaiter(this, void 0, void 0, function* () {
187
- return yield (yield this.host()).getAttribute('id');
188
- });
189
- }
190
- getValue() {
191
- return __awaiter(this, void 0, void 0, function* () {
192
- return yield (yield this.host()).getProperty('value');
193
- });
194
- }
195
- getChecked() {
196
- return __awaiter(this, void 0, void 0, function* () {
197
- return yield (yield this.host()).getProperty('checked');
198
- });
199
- }
200
- setValue(value) {
201
- return __awaiter(this, void 0, void 0, function* () {
202
- if (value instanceof Date) {
203
- yield (yield this.host()).setInputValue(`${value.toLocaleDateString([], {
204
- month: '2-digit',
205
- day: '2-digit',
206
- year: 'numeric',
207
- })} ${value.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`);
208
- }
209
- else {
210
- yield (yield this.host()).clear();
211
- if (value) {
212
- yield (yield this.host()).sendKeys(value);
213
- }
214
- yield (yield this.host()).setInputValue(value);
215
- }
216
- });
217
- }
218
- getTestElement() {
219
- return __awaiter(this, void 0, void 0, function* () {
220
- return yield this.host();
221
- });
222
- }
223
- click() {
224
- return __awaiter(this, void 0, void 0, function* () {
225
- yield (yield this.host()).click();
226
- });
227
- }
228
- }
229
- InputHarness.hostSelector = 'input';
230
-
231
- class PCheckboxHarness extends ComponentHarness {
232
- constructor() {
233
- super(...arguments);
234
- this.getCheckBoxDiv = this.locatorForOptional(DivHarness.with({ class: 'p-checkbox-box' }));
235
- }
236
- static with(options) {
237
- return new HarnessPredicate(PCheckboxHarness, options).addOption('inputid', options.inputid, (harness, inputid) => HarnessPredicate.stringMatches(harness.getId(), inputid));
238
- }
239
- isChecked() {
240
- return __awaiter(this, void 0, void 0, function* () {
241
- return (yield this.locatorFor(InputHarness)()).getChecked();
242
- });
243
- }
244
- getId() {
245
- return __awaiter(this, void 0, void 0, function* () {
246
- return yield (yield this.host()).getAttribute('inputId');
247
- });
248
- }
249
- isHidden() {
250
- return __awaiter(this, void 0, void 0, function* () {
251
- const attr = yield (yield this.host()).getAttribute('hidden');
252
- return Boolean(attr);
253
- });
254
- }
255
- click() {
256
- var _a;
257
- return __awaiter(this, void 0, void 0, function* () {
258
- yield ((_a = (yield this.getCheckBoxDiv())) === null || _a === void 0 ? void 0 : _a.click());
259
- });
260
- }
261
- }
262
- PCheckboxHarness.hostSelector = 'p-checkbox';
263
-
264
- class PDialogHarness extends ContentContainerComponentHarness {
265
- constructor() {
266
- super(...arguments);
267
- this.getHeader = this.locatorForOptional(DivHarness.with({ class: 'p-dialog-header' }));
268
- this.getFooter = this.locatorForOptional(DivHarness.with({ class: 'p-dialog-footer' }));
269
- }
270
- getDialogTitle() {
271
- var _a;
272
- return __awaiter(this, void 0, void 0, function* () {
273
- return yield ((_a = (yield this.getHeader())) === null || _a === void 0 ? void 0 : _a.getText());
274
- });
275
- }
276
- close() {
277
- return __awaiter(this, void 0, void 0, function* () {
278
- if (yield this.isVisible()) {
279
- yield (yield this.host()).sendKeys(TestKey.ESCAPE);
280
- }
281
- else {
282
- console.warn('Unable to close CustomGroupColumnSelectionDialog, because it is not open.');
283
- }
284
- });
285
- }
286
- isVisible() {
287
- return __awaiter(this, void 0, void 0, function* () {
288
- return (yield (yield this.host()).getAttribute('ng-reflect-visible')) === 'true' ? true : false;
289
- });
290
- }
291
- }
292
- PDialogHarness.hostSelector = 'p-dialog';
293
-
294
- class PDropdownHarness extends ContentContainerComponentHarness {
295
- static with(options) {
296
- return new HarnessPredicate(PDropdownHarness, options).addOption('id', options.id, (harness, id) => HarnessPredicate.stringMatches(harness.getId(), id));
297
- }
298
- getId() {
299
- return __awaiter(this, void 0, void 0, function* () {
300
- return yield (yield this.host()).getAttribute('id');
301
- });
302
- }
303
- getDefaultText() {
304
- var _a;
305
- return __awaiter(this, void 0, void 0, function* () {
306
- return (_a = (yield this.locatorForOptional('span.p-placeholder')())) === null || _a === void 0 ? void 0 : _a.text();
307
- });
308
- }
309
- isOpen() {
310
- return __awaiter(this, void 0, void 0, function* () {
311
- return (yield this.locatorFor('div')()).hasClass('p-dropdown-open');
312
- });
313
- }
314
- open() {
315
- return __awaiter(this, void 0, void 0, function* () {
316
- if (!(yield this.isOpen())) {
317
- yield (yield this.locatorFor('div')()).click();
318
- }
319
- else {
320
- console.warn('Unable to open dropdown, because it is already open.');
321
- }
322
- });
323
- }
324
- close() {
325
- return __awaiter(this, void 0, void 0, function* () {
326
- if (yield this.isOpen()) {
327
- yield (yield this.locatorFor('div')()).click();
328
- }
329
- else {
330
- console.warn('Unable to close dropdown, because it is not open.');
331
- }
332
- });
333
- }
334
- getDropdownItems() {
335
- return __awaiter(this, void 0, void 0, function* () {
336
- yield this.open();
337
- const rootLocator = this.documentRootLocatorFactory();
338
- const items = yield rootLocator.harnessLoaderFor('.p-dropdown-items');
339
- return yield items.getAllHarnesses(ListItemHarness);
340
- });
341
- }
342
- getDropdownItem(itemText) {
343
- return __awaiter(this, void 0, void 0, function* () {
344
- return yield this.locatorForOptional(ListItemHarness.with({ text: itemText }))();
345
- });
346
- }
347
- selectedDropdownItem(position) {
348
- return __awaiter(this, void 0, void 0, function* () {
349
- const selectedColumnGroup = yield Promise.all((yield this.getDropdownItems()).filter((listItem) => listItem.isSelected()));
350
- return selectedColumnGroup[position];
351
- });
352
- }
353
- selectedDropdownItemText(position) {
354
- return __awaiter(this, void 0, void 0, function* () {
355
- return (yield this.selectedDropdownItem(position)).getText();
356
- });
357
- }
358
- hasClearOption() {
359
- return __awaiter(this, void 0, void 0, function* () {
360
- return (yield this.locatorFor('div')()).hasClass('p-dropdown-clearable');
361
- });
362
- }
363
- clear() {
364
- return __awaiter(this, void 0, void 0, function* () {
365
- if (yield this.hasClearOption()) {
366
- return yield (yield this.locatorFor('.p-dropdown-clear-icon')()).click();
367
- }
368
- else {
369
- console.warn('Unable to clear dropdown, because it has no clear option');
370
- }
371
- });
372
- }
373
- }
374
- PDropdownHarness.hostSelector = 'p-dropdown';
375
-
376
- class SpanHarness extends ComponentHarness {
377
- static with(options) {
378
- return new HarnessPredicate(SpanHarness, options).addOption('class', options.class, (harness, c) => HarnessPredicate.stringMatches(harness.getByClass(c), c));
379
- }
380
- getByClass(c) {
381
- return __awaiter(this, void 0, void 0, function* () {
382
- return (yield (yield this.host()).hasClass(c)) ? c : '';
383
- });
384
- }
385
- checkHasClass(value) {
386
- return __awaiter(this, void 0, void 0, function* () {
387
- return yield (yield this.host()).hasClass(value);
388
- });
389
- }
390
- getText() {
391
- return __awaiter(this, void 0, void 0, function* () {
392
- return yield (yield this.host()).text();
393
- });
394
- }
395
- }
396
- SpanHarness.hostSelector = 'span';
397
-
398
- class PMenuItemHarness extends ComponentHarness {
399
- constructor() {
400
- super(...arguments);
401
- this.getAnchor = this.locatorFor('a');
402
- this.getChildren = this.locatorForAll(PMenuItemHarness);
403
- this.getIconSpan = this.locatorForOptional(SpanHarness.with({ class: 'p-menuitem-icon' }));
404
- }
405
- getText() {
406
- return __awaiter(this, void 0, void 0, function* () {
407
- return yield (yield this.getAnchor()).text();
408
- });
409
- }
410
- hasIcon(icon) {
411
- var _a, _b;
412
- return __awaiter(this, void 0, void 0, function* () {
413
- const classList = yield ((_b = (yield ((_a = (yield this.getIconSpan())) === null || _a === void 0 ? void 0 : _a.host()))) === null || _b === void 0 ? void 0 : _b.getAttribute('class'));
414
- return classList === null || classList === void 0 ? void 0 : classList.includes(icon);
415
- });
416
- }
417
- click() {
418
- return __awaiter(this, void 0, void 0, function* () {
419
- return yield (yield this.getAnchor()).click();
420
- });
421
- }
422
- getLink() {
423
- return __awaiter(this, void 0, void 0, function* () {
424
- return yield (yield this.getAnchor()).getAttribute('href');
425
- });
426
- }
427
- }
428
- PMenuItemHarness.hostSelector = 'li.p-menuitem';
429
-
430
- class MenuItemHarness extends ComponentHarness {
431
- static with(options) {
432
- return new HarnessPredicate(MenuItemHarness, options).addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
433
- }
434
- getText() {
435
- return __awaiter(this, void 0, void 0, function* () {
436
- return yield (yield this.host()).text();
437
- });
438
- }
439
- selectItem() {
440
- return __awaiter(this, void 0, void 0, function* () {
441
- yield (yield this.host()).click();
442
- });
443
- }
444
- getLink() {
445
- return __awaiter(this, void 0, void 0, function* () {
446
- return yield (yield this.host()).getAttribute('href');
447
- });
448
- }
449
- }
450
- MenuItemHarness.hostSelector = 'li > a';
451
-
452
- class PMenuHarness extends ContentContainerComponentHarness {
453
- getHarnessLoaderForPMenuOverlay() {
454
- return __awaiter(this, void 0, void 0, function* () {
455
- return this.documentRootLocatorFactory().harnessLoaderForOptional('.p-menu-overlay');
456
- });
457
- }
458
- isOpen() {
459
- return __awaiter(this, void 0, void 0, function* () {
460
- return !!(yield this.getHarnessLoaderForPMenuOverlay());
461
- });
462
- }
463
- getAllMenuItems() {
464
- var _a;
465
- return __awaiter(this, void 0, void 0, function* () {
466
- if (yield this.isOpen()) {
467
- return yield ((_a = (yield this.getHarnessLoaderForPMenuOverlay())) === null || _a === void 0 ? void 0 : _a.getAllHarnesses(MenuItemHarness));
468
- }
469
- else {
470
- console.warn('Cannot get menu items because menu is closed.');
471
- }
472
- return [];
473
- });
474
- }
475
- getMenuItem(itemText) {
476
- var _a;
477
- return __awaiter(this, void 0, void 0, function* () {
478
- if (yield this.isOpen()) {
479
- return yield ((_a = (yield this.getHarnessLoaderForPMenuOverlay())) === null || _a === void 0 ? void 0 : _a.getHarnessOrNull(MenuItemHarness.with({ text: itemText })));
480
- }
481
- else {
482
- console.warn('Cannot get menu items because menu is closed.');
483
- }
484
- return undefined;
485
- });
486
- }
487
- }
488
- PMenuHarness.hostSelector = 'p-menu';
489
-
490
- class PMenuBarHarness extends ComponentHarness {
491
- constructor() {
492
- super(...arguments);
493
- this.getAllMenuItems = this.locatorForAll(PMenuItemHarness);
494
- }
495
- }
496
- PMenuBarHarness.hostSelector = 'p-menubar';
497
-
498
- class PMultiSelectListItemHarness extends ComponentHarness {
499
- getTestElement() {
500
- return __awaiter(this, void 0, void 0, function* () {
501
- return yield this.host();
502
- });
503
- }
504
- click() {
505
- return __awaiter(this, void 0, void 0, function* () {
506
- yield (yield this.host()).click();
507
- });
508
- }
509
- getText() {
510
- return __awaiter(this, void 0, void 0, function* () {
511
- return yield (yield this.host()).text();
512
- });
513
- }
514
- }
515
- PMultiSelectListItemHarness.hostSelector = 'li';
516
-
517
- class PMultiSelectHarness extends ComponentHarness {
518
- static with(options) {
519
- return new HarnessPredicate(PMultiSelectHarness, options)
520
- .addOption('id', options.id, (harness, id) => HarnessPredicate.stringMatches(harness.getId(), id))
521
- .addOption('class', options.class, (harness, c) => HarnessPredicate.stringMatches(harness.getByClass(c), c));
522
- }
523
- getId() {
524
- return __awaiter(this, void 0, void 0, function* () {
525
- return yield (yield this.host()).getAttribute('id');
526
- });
527
- }
528
- getByClass(c) {
529
- return __awaiter(this, void 0, void 0, function* () {
530
- return (yield (yield this.host()).hasClass(c)) ? c : '';
531
- });
532
- }
533
- getHarnessLoaderForPMultiSelectPanel() {
534
- return __awaiter(this, void 0, void 0, function* () {
535
- const rootLocator = this.documentRootLocatorFactory();
536
- return rootLocator.harnessLoaderFor('.p-multiselect-panel');
537
- });
538
- }
539
- getAllOptions() {
540
- return __awaiter(this, void 0, void 0, function* () {
541
- if (!(yield this.isOpen())) {
542
- yield this.open();
543
- }
544
- return yield (yield this.getHarnessLoaderForPMultiSelectPanel()).getAllHarnesses(PMultiSelectListItemHarness);
545
- });
546
- }
547
- isOpen() {
548
- return __awaiter(this, void 0, void 0, function* () {
549
- return yield (yield this.locatorFor('div')()).hasClass('p-multiselect-open');
550
- });
551
- }
552
- open() {
553
- return __awaiter(this, void 0, void 0, function* () {
554
- if (!(yield this.isOpen())) {
555
- yield (yield this.locatorFor('div')()).click();
556
- }
557
- else {
558
- console.warn('Unable to open multiSelect, because it is already open.');
559
- }
560
- });
561
- }
562
- close() {
563
- return __awaiter(this, void 0, void 0, function* () {
564
- if (yield this.isOpen()) {
565
- yield (yield this.locatorFor('div')()).click();
566
- }
567
- else {
568
- console.warn('Unable to close multiSelect, because it is not open.');
569
- }
570
- });
571
- }
572
- isHighlighted(PMultiSelectListItem) {
573
- return __awaiter(this, void 0, void 0, function* () {
574
- return yield (yield PMultiSelectListItem.getTestElement()).hasClass('p-highlight');
575
- });
576
- }
577
- getSelectedOptions() {
578
- return __awaiter(this, void 0, void 0, function* () {
579
- const allOptions = yield this.getAllOptions();
580
- const selectedOptions = [];
581
- for (let index = 0; index < allOptions.length; index++) {
582
- const option = allOptions[index];
583
- if (yield this.isHighlighted(option)) {
584
- selectedOptions.push(yield option.getText());
585
- }
586
- }
587
- return selectedOptions;
588
- });
589
- }
590
- }
591
- PMultiSelectHarness.hostSelector = 'p-multiSelect';
592
-
593
- class PanelMenuItemHarness extends ComponentHarness {
594
- constructor() {
595
- super(...arguments);
596
- this.getAnchor = this.locatorFor('a');
597
- this.getChildren = this.locatorForAll(PMenuItemHarness);
598
- this.getIconSpan = this.locatorForOptional(SpanHarness.with({ class: 'p-menuitem-icon' }));
599
- }
600
- getText() {
601
- return __awaiter(this, void 0, void 0, function* () {
602
- return yield (yield this.getAnchor()).text();
603
- });
604
- }
605
- hasIcon(icon) {
606
- var _a, _b;
607
- return __awaiter(this, void 0, void 0, function* () {
608
- const classList = yield ((_b = (yield ((_a = (yield this.getIconSpan())) === null || _a === void 0 ? void 0 : _a.host()))) === null || _b === void 0 ? void 0 : _b.getAttribute('class'));
609
- return classList === null || classList === void 0 ? void 0 : classList.includes(icon);
610
- });
611
- }
612
- click() {
613
- return __awaiter(this, void 0, void 0, function* () {
614
- yield (yield this.getAnchor()).click();
615
- });
616
- }
617
- getLink() {
618
- return __awaiter(this, void 0, void 0, function* () {
619
- return yield (yield this.getAnchor()).getAttribute('href');
620
- });
621
- }
622
- }
623
- PanelMenuItemHarness.hostSelector = 'div.p-panelmenu-panel';
624
-
625
- class PPanelMenuHarness extends ComponentHarness {
626
- constructor() {
627
- super(...arguments);
628
- this.getAllPanels = this.locatorForAll(PanelMenuItemHarness);
629
- }
630
- }
631
- PPanelMenuHarness.hostSelector = 'p-panelmenu';
632
-
633
- class ButtonHarness extends ComponentHarness {
634
- static with(options) {
635
- return new HarnessPredicate(ButtonHarness, options)
636
- .addOption('id', options.id, (harness, id) => HarnessPredicate.stringMatches(harness.getId(), id))
637
- .addOption('icon', options.icon, (harness, icon) => HarnessPredicate.stringMatches(harness.getIcon(), icon))
638
- .addOption('class', options.class, (harness, c) => HarnessPredicate.stringMatches(harness.getByClass(c), c));
639
- }
640
- getId() {
641
- return __awaiter(this, void 0, void 0, function* () {
642
- return yield (yield this.host()).getAttribute('id');
643
- });
644
- }
645
- getIcon() {
646
- return __awaiter(this, void 0, void 0, function* () {
647
- return yield (yield this.host()).getAttribute('icon');
648
- });
649
- }
650
- getByClass(c) {
651
- return __awaiter(this, void 0, void 0, function* () {
652
- return (yield (yield this.host()).hasClass(c)) ? c : '';
653
- });
654
- }
655
- click() {
656
- return __awaiter(this, void 0, void 0, function* () {
657
- if (!(yield this.isDisabled())) {
658
- yield (yield this.host()).click();
659
- }
660
- else {
661
- console.warn('Button cannot be clicked, because it is disabled!');
662
- }
663
- });
664
- }
665
- isDisabled() {
666
- return __awaiter(this, void 0, void 0, function* () {
667
- return yield (yield this.host()).getProperty('disabled');
668
- });
669
- }
670
- }
671
- ButtonHarness.hostSelector = 'button';
672
-
673
- class PPaginatorHarness extends ContentContainerComponentHarness {
674
- constructor() {
675
- super(...arguments);
676
- this.getCurrentPageReport = this.locatorFor(SpanHarness.with({ class: 'p-paginator-current' }));
677
- this.getRowsPerPageOptions = this.locatorFor(PDropdownHarness);
678
- this.getNextPageButton = this.locatorFor(ButtonHarness.with({ class: 'p-paginator-next' }));
679
- }
680
- getCurrentPageReportText() {
681
- return __awaiter(this, void 0, void 0, function* () {
682
- return yield (yield this.getCurrentPageReport()).getText();
683
- });
684
- }
685
- clickNextPage() {
686
- return __awaiter(this, void 0, void 0, function* () {
687
- ;
688
- (yield this.getNextPageButton()).click();
689
- });
690
- }
691
- }
692
- PPaginatorHarness.hostSelector = 'p-paginator';
693
-
694
- class PPasswordHarness extends ComponentHarness {
695
- constructor() {
696
- super(...arguments);
697
- this.getInput = this.locatorFor(InputHarness);
698
- }
699
- static with(options) {
700
- return new HarnessPredicate(PPasswordHarness, options).addOption('id', options.id, (harness, id) => HarnessPredicate.stringMatches(harness.getId(), id));
701
- }
702
- getId() {
703
- return __awaiter(this, void 0, void 0, function* () {
704
- return yield (yield this.host()).getAttribute('id');
705
- });
706
- }
707
- getPromptLabel() {
708
- return __awaiter(this, void 0, void 0, function* () {
709
- return yield (yield this.host()).getAttribute('ng-reflect-prompt-label');
710
- });
711
- }
712
- getWeakLabel() {
713
- return __awaiter(this, void 0, void 0, function* () {
714
- return yield (yield this.host()).getAttribute('ng-reflect-weak-label');
715
- });
716
- }
717
- getMediumLabel() {
718
- return __awaiter(this, void 0, void 0, function* () {
719
- return yield (yield this.host()).getAttribute('ng-reflect-medium-label');
720
- });
721
- }
722
- getStrongLabel() {
723
- return __awaiter(this, void 0, void 0, function* () {
724
- return yield (yield this.host()).getAttribute('ng-reflect-strong-label');
725
- });
726
- }
727
- getValue() {
728
- return __awaiter(this, void 0, void 0, function* () {
729
- return yield (yield this.getInput()).getValue();
730
- });
731
- }
732
- setValue(value) {
733
- return __awaiter(this, void 0, void 0, function* () {
734
- return yield (yield this.getInput()).setValue(value);
735
- });
736
- }
737
- }
738
- PPasswordHarness.hostSelector = 'p-password';
739
-
740
- class PPicklistControlsButtonsHarness extends ContentContainerComponentHarness {
741
- constructor() {
742
- super(...arguments);
743
- this.getButtons = this.locatorForAll(ButtonHarness);
744
- }
745
- static with(options) {
746
- return new HarnessPredicate(PPicklistControlsButtonsHarness, options).addOption('class', options.class, (harness, c) => HarnessPredicate.stringMatches(harness.getByClass(c), c));
747
- }
748
- getByClass(c) {
749
- return __awaiter(this, void 0, void 0, function* () {
750
- return (yield (yield this.host()).hasClass(c)) ? c : '';
751
- });
752
- }
753
- }
754
- PPicklistControlsButtonsHarness.hostSelector = '.p-picklist-buttons';
755
- class PPicklistListWrapperHarness extends ContentContainerComponentHarness {
756
- constructor() {
757
- super(...arguments);
758
- this.getHeader = this.locatorFor(DivHarness.with({ class: 'p-picklist-header' }));
759
- this.getAllListItems = this.locatorForAll(ListItemHarness);
760
- }
761
- static with(options) {
762
- return new HarnessPredicate(PPicklistListWrapperHarness, options).addOption('class', options.class, (harness, c) => HarnessPredicate.stringMatches(harness.getByClass(c), c));
763
- }
764
- getByClass(c) {
765
- return __awaiter(this, void 0, void 0, function* () {
766
- return (yield (yield this.host()).hasClass(c)) ? c : '';
767
- });
768
- }
769
- }
770
- PPicklistListWrapperHarness.hostSelector = '.p-picklist-list-wrapper';
771
- class PPicklistHarness extends ContentContainerComponentHarness {
772
- constructor() {
773
- super(...arguments);
774
- this.getPicklistSourceControls = this.locatorFor(PPicklistControlsButtonsHarness.with({ class: 'p-picklist-source-controls' }));
775
- this.getPicklistTransferControls = this.locatorFor(PPicklistControlsButtonsHarness.with({ class: 'p-picklist-transfer-buttons' }));
776
- this.getPicklistTargetControls = this.locatorFor(PPicklistControlsButtonsHarness.with({ class: 'p-picklist-target-controls' }));
777
- this.getPicklistSource = this.locatorFor(PPicklistListWrapperHarness.with({ class: 'p-picklist-source-wrapper' }));
778
- this.getPicklistTarget = this.locatorFor(PPicklistListWrapperHarness.with({ class: 'p-picklist-target-wrapper' }));
779
- }
780
- getSourceControlsButtons() {
781
- return __awaiter(this, void 0, void 0, function* () {
782
- return yield (yield this.getPicklistSourceControls()).getButtons();
783
- });
784
- }
785
- getTransferControlsButtons() {
786
- return __awaiter(this, void 0, void 0, function* () {
787
- return yield (yield this.getPicklistTransferControls()).getButtons();
788
- });
789
- }
790
- getTargetControlsButtons() {
791
- return __awaiter(this, void 0, void 0, function* () {
792
- return yield (yield this.getPicklistTargetControls()).getButtons();
793
- });
794
- }
795
- getSourceHeader() {
796
- return __awaiter(this, void 0, void 0, function* () {
797
- return yield (yield (yield this.getPicklistSource()).getHeader()).getText();
798
- });
799
- }
800
- getTargetHeader() {
801
- return __awaiter(this, void 0, void 0, function* () {
802
- return yield (yield (yield this.getPicklistTarget()).getHeader()).getText();
803
- });
804
- }
805
- getSourceListItems() {
806
- return __awaiter(this, void 0, void 0, function* () {
807
- return yield (yield this.getPicklistSource()).getAllListItems();
808
- });
809
- }
810
- getTargetListItems() {
811
- return __awaiter(this, void 0, void 0, function* () {
812
- return yield (yield this.getPicklistTarget()).getAllListItems();
813
- });
814
- }
815
- }
816
- PPicklistHarness.hostSelector = 'p-picklist';
817
-
818
- class PSelectButtonHarness extends ContentContainerComponentHarness {
819
- constructor() {
820
- super(...arguments);
821
- this.getAllButtons = this.locatorForAll('div > div');
822
- }
823
- }
824
- PSelectButtonHarness.hostSelector = 'p-selectbutton';
825
-
826
- class MenuItemWithIconHarness extends MenuItemHarness {
827
- hasIcon(icon) {
828
- var _a;
829
- return __awaiter(this, void 0, void 0, function* () {
830
- const classList = yield ((_a = (yield this.locatorForOptional('i')())) === null || _a === void 0 ? void 0 : _a.getAttribute('class'));
831
- return classList === null || classList === void 0 ? void 0 : classList.includes(icon);
832
- });
833
- }
834
- }
835
-
836
- class PTableCheckboxHarness extends ComponentHarness {
837
- static with(options = {}) {
838
- return new HarnessPredicate(this, options).addOption('isSelected', options.isSelected, (harness, selected) => __awaiter(this, void 0, void 0, function* () {
839
- return (yield harness.isChecked()) === selected;
840
- }));
841
- }
842
- isChecked() {
843
- return __awaiter(this, void 0, void 0, function* () {
844
- const allChecked = yield this.locatorForAll('.pi-check')();
845
- return allChecked.length === 1;
846
- });
847
- }
848
- checkBox() {
849
- return __awaiter(this, void 0, void 0, function* () {
850
- const checkBoxElement = yield this.locatorFor('.p-checkbox-box')();
851
- return checkBoxElement.click();
852
- });
853
- }
854
- }
855
- PTableCheckboxHarness.hostSelector = 'p-tableCheckbox';
856
-
857
- class PHarness extends ComponentHarness {
858
- static with(options) {
859
- return new HarnessPredicate(PHarness, options)
860
- .addOption('class', options.class, (harness, c) => HarnessPredicate.stringMatches(harness.getByClass(c), c))
861
- .addOption('id', options.id, (harness, id) => HarnessPredicate.stringMatches(harness.hasId(id), id));
862
- }
863
- getByClass(c) {
864
- return __awaiter(this, void 0, void 0, function* () {
865
- return (yield (yield this.host()).hasClass(c)) ? c : '';
866
- });
867
- }
868
- hasId(id) {
869
- return __awaiter(this, void 0, void 0, function* () {
870
- return (yield (yield this.host()).matchesSelector('#' + id)) ? id : '';
871
- });
872
- }
873
- checkHasClass(value) {
874
- return __awaiter(this, void 0, void 0, function* () {
875
- return yield (yield this.host()).hasClass(value);
876
- });
877
- }
878
- getText() {
879
- return __awaiter(this, void 0, void 0, function* () {
880
- return yield (yield this.host()).text();
881
- });
882
- }
883
- getClassList() {
884
- return __awaiter(this, void 0, void 0, function* () {
885
- const host = yield this.host();
886
- const attributeString = yield host.getAttribute('class');
887
- if (attributeString) {
888
- return attributeString.trim().split(' ');
889
- }
890
- return [];
891
- });
892
- }
893
- }
894
- PHarness.hostSelector = 'p';
895
-
896
- class TableHeaderColumnHarness extends ContentContainerComponentHarness {
897
- constructor() {
898
- super(...arguments);
899
- this.getSortButton = this.locatorFor(ButtonHarness.with({
900
- class: 'sortButton',
901
- }));
902
- this.getFilterMultiSelect = this.locatorFor(PMultiSelectHarness.with({
903
- class: 'filterMultiSelect',
904
- }));
905
- }
906
- getText() {
907
- return __awaiter(this, void 0, void 0, function* () {
908
- return (yield this.host()).text();
909
- });
910
- }
911
- }
912
- TableHeaderColumnHarness.hostSelector = 'th';
913
-
914
- class TableRowHarness extends ContentContainerComponentHarness {
915
- constructor() {
916
- super(...arguments);
917
- this.getAllActionButtons = this.locatorForAll('button');
918
- this.getViewButton = this.locatorForOptional(ButtonHarness.with({ class: 'viewTableRowButton' }));
919
- this.getEditButton = this.locatorForOptional(ButtonHarness.with({ class: 'editTableRowButton' }));
920
- this.getDeleteButton = this.locatorForOptional(ButtonHarness.with({ class: 'deleteTableRowButton' }));
921
- }
922
- getData() {
923
- return __awaiter(this, void 0, void 0, function* () {
924
- const tds = yield this.locatorForAll('td')();
925
- const isActionsTd = yield Promise.all(tds.map((t) => t.hasClass('actions')));
926
- const textTds = tds.filter((_v, index) => !isActionsTd[index]);
927
- return Promise.all(textTds.map((t) => t.text()));
928
- });
929
- }
930
- }
931
- TableRowHarness.hostSelector = 'tbody > tr';
932
-
933
- /**
934
- * Generated bundle index. Do not edit.
935
- */
936
-
937
- export { ButtonHarness, DivHarness, InputHarness, ListItemHarness, MenuItemHarness, MenuItemWithIconHarness, PAccordionHarness, PAccordionTabHarness, PBreadcrumbHarness, PButtonDirectiveHarness, PButtonHarness, PChartHarness, PCheckboxHarness, PDialogHarness, PDropdownHarness, PHarness, PMenuBarHarness, PMenuHarness, PMenuItemHarness, PMultiSelectHarness, PMultiSelectListItemHarness, PPaginatorHarness, PPanelMenuHarness, PPasswordHarness, PPicklistControlsButtonsHarness, PPicklistHarness, PPicklistListWrapperHarness, PSelectButtonHarness, PTableCheckboxHarness, PanelMenuItemHarness, SpanHarness, TableHeaderColumnHarness, TableRowHarness };
938
- //# sourceMappingURL=onecx-angular-testing.mjs.map