@skyux/lists 12.0.0-alpha.8 → 12.0.0-beta.0
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.
- package/fesm2022/skyux-lists-testing.mjs +447 -21
- package/fesm2022/skyux-lists-testing.mjs.map +1 -1
- package/fesm2022/skyux-lists.mjs +104 -104
- package/fesm2022/skyux-lists.mjs.map +1 -1
- package/package.json +32 -35
- package/testing/modules/filter/filter-button-harness-filters.d.ts +6 -0
- package/testing/modules/filter/filter-button-harness.d.ts +50 -0
- package/testing/modules/filter/filter-inline-harness-filters.d.ts +6 -0
- package/testing/modules/filter/filter-inline-harness.d.ts +27 -0
- package/testing/modules/filter/filter-inline-item-harness-filters.d.ts +6 -0
- package/testing/modules/filter/filter-inline-item-harness.d.ts +17 -0
- package/testing/modules/filter/filter-summary-harness-filters.d.ts +6 -0
- package/testing/modules/filter/filter-summary-harness.d.ts +27 -0
- package/testing/modules/filter/filter-summary-item-harness-filters.d.ts +6 -0
- package/testing/modules/filter/filter-summary-item-harness.d.ts +30 -0
- package/testing/modules/infinite-scroll/infinite-scroll-harness-filters.d.ts +0 -1
- package/testing/modules/infinite-scroll/infinite-scroll-harness.d.ts +0 -1
- package/testing/modules/paging/page-control-harness-filters.d.ts +11 -0
- package/testing/modules/paging/page-control-harness.d.ts +22 -0
- package/testing/modules/paging/paging-content-harness.d.ts +10 -0
- package/testing/modules/paging/paging-harness-filters.d.ts +6 -0
- package/testing/modules/paging/paging-harness.d.ts +40 -0
- package/testing/modules/sort/sort-harness-filters.d.ts +6 -0
- package/testing/modules/sort/sort-harness.d.ts +40 -0
- package/testing/modules/sort/sort-item-harness-filters.d.ts +10 -0
- package/testing/modules/sort/sort-item-harness.d.ts +31 -0
- package/testing/public-api.d.ts +17 -0
- package/documentation.json +0 -11314
|
@@ -2,12 +2,13 @@ import { SkyAppTestUtility } from '@skyux-sdk/testing';
|
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { NgModule } from '@angular/core';
|
|
4
4
|
import { SkyFilterModule, SkyPagingModule, SkySortModule, SkyInfiniteScrollModule } from '@skyux/lists';
|
|
5
|
+
import { SkyComponentHarness, SkyQueryableComponentHarness } from '@skyux/core/testing';
|
|
6
|
+
import { SkyTokenHarness, SkyChevronHarness } from '@skyux/indicators/testing';
|
|
5
7
|
import { By } from '@angular/platform-browser';
|
|
6
|
-
import {
|
|
7
|
-
import { HarnessPredicate } from '@angular/cdk/testing';
|
|
8
|
+
import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
|
8
9
|
import { SkyCheckboxHarness } from '@skyux/forms/testing';
|
|
9
|
-
import { SkyChevronHarness } from '@skyux/indicators/testing';
|
|
10
10
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
11
|
+
import { SkyDropdownItemHarness, SkyDropdownHarness } from '@skyux/popovers/testing';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Provides information for and interaction with a SKY UX filter button component.
|
|
@@ -96,17 +97,212 @@ class SkyFilterFixtureSummary {
|
|
|
96
97
|
* @internal
|
|
97
98
|
*/
|
|
98
99
|
class SkyFilterTestingModule {
|
|
99
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
100
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
|
101
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
|
100
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkyFilterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
101
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: SkyFilterTestingModule, exports: [SkyFilterModule] }); }
|
|
102
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkyFilterTestingModule, imports: [SkyFilterModule] }); }
|
|
102
103
|
}
|
|
103
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkyFilterTestingModule, decorators: [{
|
|
104
105
|
type: NgModule,
|
|
105
106
|
args: [{
|
|
106
107
|
exports: [SkyFilterModule],
|
|
107
108
|
}]
|
|
108
109
|
}] });
|
|
109
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Harness for interacting with a filter button component in tests.
|
|
113
|
+
*/
|
|
114
|
+
class SkyFilterButtonHarness extends SkyComponentHarness {
|
|
115
|
+
/**
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
static { this.hostSelector = 'sky-filter-button'; }
|
|
119
|
+
#getFilterButton = this.locatorFor('button.sky-filter-btn');
|
|
120
|
+
/**
|
|
121
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
122
|
+
* `SkyFilterButtonHarness` that meets certain criteria.
|
|
123
|
+
*/
|
|
124
|
+
static with(filters) {
|
|
125
|
+
return this.getDataSkyIdPredicate(filters);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Clicks the filter button.
|
|
129
|
+
*/
|
|
130
|
+
async clickFilterButton() {
|
|
131
|
+
return await (await this.#getFilterButton()).click();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Gets the filter button's aria-controls attribute.
|
|
135
|
+
*/
|
|
136
|
+
async getAriaControls() {
|
|
137
|
+
return await (await this.#getFilterButton()).getAttribute('aria-controls');
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Gets the filter button's aria-expanded attribute.
|
|
141
|
+
*/
|
|
142
|
+
async getAriaExpanded() {
|
|
143
|
+
const expanded = await (await this.#getFilterButton()).getAttribute('aria-expanded');
|
|
144
|
+
return !!expanded && expanded === 'true';
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Gets the filter button's aria-label.
|
|
148
|
+
*/
|
|
149
|
+
async getAriaLabel() {
|
|
150
|
+
return await (await this.#getFilterButton()).getAttribute('aria-label');
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Gets the filter button's id.
|
|
154
|
+
*/
|
|
155
|
+
async getButtonId() {
|
|
156
|
+
return await (await this.#getFilterButton()).getAttribute('id');
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Gets the text that appears on the filter button.
|
|
160
|
+
*/
|
|
161
|
+
async getButtonText() {
|
|
162
|
+
const text = await (await this.locatorForOptional('.sky-filter-btn-text')())?.text();
|
|
163
|
+
return text ?? '';
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Whether the filter button is active.
|
|
167
|
+
*/
|
|
168
|
+
async isActive() {
|
|
169
|
+
return await (await this.#getFilterButton()).hasClass('sky-filter-btn-active');
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Whether the filter button is disabled.
|
|
173
|
+
*/
|
|
174
|
+
async isDisabled() {
|
|
175
|
+
const disabled = await (await this.#getFilterButton()).getAttribute('disabled');
|
|
176
|
+
return disabled !== null;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Harness to interact with a filter inline item component in tests.
|
|
182
|
+
*/
|
|
183
|
+
class SkyFilterInlineItemHarness extends SkyQueryableComponentHarness {
|
|
184
|
+
/**
|
|
185
|
+
* @internal
|
|
186
|
+
*/
|
|
187
|
+
static { this.hostSelector = 'sky-filter-inline-item'; }
|
|
188
|
+
/**
|
|
189
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
190
|
+
* `SkyFilterInlineItemHarness` that meets certain criteria.
|
|
191
|
+
*/
|
|
192
|
+
static with(filters) {
|
|
193
|
+
return SkyFilterInlineItemHarness.getDataSkyIdPredicate(filters);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Harness to interact with a filter inline component in tests.
|
|
199
|
+
*/
|
|
200
|
+
class SkyFilterInlineHarness extends SkyComponentHarness {
|
|
201
|
+
/**
|
|
202
|
+
* @internal
|
|
203
|
+
*/
|
|
204
|
+
static { this.hostSelector = 'sky-filter-inline'; }
|
|
205
|
+
/**
|
|
206
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
207
|
+
* `SkyFilterInlineHarness` that meets certain criteria.
|
|
208
|
+
*/
|
|
209
|
+
static with(filters) {
|
|
210
|
+
return SkyFilterInlineHarness.getDataSkyIdPredicate(filters);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Gets a harness for a specific toolbar item that meets certain criteria.
|
|
214
|
+
*/
|
|
215
|
+
async getItem(filter) {
|
|
216
|
+
return await this.locatorFor(SkyFilterInlineItemHarness.with(filter))();
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Gets an array of all toolbar items.
|
|
220
|
+
*/
|
|
221
|
+
async getItems(filters) {
|
|
222
|
+
const items = await this.locatorForAll(SkyFilterInlineItemHarness.with(filters || {}))();
|
|
223
|
+
if (items.length === 0) {
|
|
224
|
+
if (filters) {
|
|
225
|
+
throw new Error(`Unable to find any filter inline items with filter(s): ${JSON.stringify(filters)}`);
|
|
226
|
+
}
|
|
227
|
+
throw new Error('Unable to find any filter inline items.');
|
|
228
|
+
}
|
|
229
|
+
return items;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Harness to interact with a filter summary item component in tests.
|
|
235
|
+
*/
|
|
236
|
+
class SkyFilterSummaryItemHarness extends SkyComponentHarness {
|
|
237
|
+
/**
|
|
238
|
+
* @internal
|
|
239
|
+
*/
|
|
240
|
+
static { this.hostSelector = 'sky-filter-summary-item'; }
|
|
241
|
+
#getSummaryItem = this.locatorFor('.sky-filter-summary-item');
|
|
242
|
+
#getToken = this.locatorFor(SkyTokenHarness);
|
|
243
|
+
/**
|
|
244
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
245
|
+
* `SkyFilterSummaryItemHarness` that meets certain criteria.
|
|
246
|
+
*/
|
|
247
|
+
static with(filters) {
|
|
248
|
+
return SkyFilterSummaryItemHarness.getDataSkyIdPredicate(filters);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Clicks the filter summary item.
|
|
252
|
+
*/
|
|
253
|
+
async clickItem() {
|
|
254
|
+
await (await this.#getSummaryItem()).click();
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Dismisses the filter summary item.
|
|
258
|
+
*/
|
|
259
|
+
async dismiss() {
|
|
260
|
+
await (await this.#getToken()).dismiss();
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Whether the filter summary item is dismissible.
|
|
264
|
+
*/
|
|
265
|
+
async isDismissible() {
|
|
266
|
+
return await (await this.#getToken()).isDismissible();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Harness to interact with a filter summary component in tests.
|
|
272
|
+
*/
|
|
273
|
+
class SkyFilterSummaryHarness extends SkyComponentHarness {
|
|
274
|
+
/**
|
|
275
|
+
* @internal
|
|
276
|
+
*/
|
|
277
|
+
static { this.hostSelector = 'sky-filter-summary'; }
|
|
278
|
+
/**
|
|
279
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
280
|
+
* `SkyFilterSummaryHarness` that meets certain criteria.
|
|
281
|
+
*/
|
|
282
|
+
static with(filters) {
|
|
283
|
+
return SkyFilterSummaryHarness.getDataSkyIdPredicate(filters);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Gets a harness for a specific toolbar item that meets certain criteria.
|
|
287
|
+
*/
|
|
288
|
+
async getItem(filter) {
|
|
289
|
+
return await this.locatorFor(SkyFilterSummaryItemHarness.with(filter))();
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Gets an array of all toolbar items.
|
|
293
|
+
*/
|
|
294
|
+
async getItems(filters) {
|
|
295
|
+
const items = await this.locatorForAll(SkyFilterSummaryItemHarness.with(filters || {}))();
|
|
296
|
+
if (items.length === 0) {
|
|
297
|
+
if (filters) {
|
|
298
|
+
throw new Error(`Unable to find any filter summary items with filter(s): ${JSON.stringify(filters)}`);
|
|
299
|
+
}
|
|
300
|
+
throw new Error('Unable to find any filter summary items.');
|
|
301
|
+
}
|
|
302
|
+
return items;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
110
306
|
/**
|
|
111
307
|
* Provides information for and interaction with a SKY UX paging component.
|
|
112
308
|
* By using the fixture API, a test insulates itself against updates to the internals
|
|
@@ -204,17 +400,139 @@ class SkyPagingFixture {
|
|
|
204
400
|
* @internal
|
|
205
401
|
*/
|
|
206
402
|
class SkyPagingTestingModule {
|
|
207
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
208
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
|
209
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
|
403
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkyPagingTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
404
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: SkyPagingTestingModule, exports: [SkyPagingModule] }); }
|
|
405
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkyPagingTestingModule, imports: [SkyPagingModule] }); }
|
|
210
406
|
}
|
|
211
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkyPagingTestingModule, decorators: [{
|
|
212
408
|
type: NgModule,
|
|
213
409
|
args: [{
|
|
214
410
|
exports: [SkyPagingModule],
|
|
215
411
|
}]
|
|
216
412
|
}] });
|
|
217
413
|
|
|
414
|
+
/**
|
|
415
|
+
* Harness to interact with a paging content component in tests.
|
|
416
|
+
*/
|
|
417
|
+
class SkyPagingContentHarness extends SkyQueryableComponentHarness {
|
|
418
|
+
/**
|
|
419
|
+
* @internal
|
|
420
|
+
*/
|
|
421
|
+
static { this.hostSelector = 'sky-paging-content'; }
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Harness to interact with a page control element in tests.
|
|
426
|
+
* @internal
|
|
427
|
+
*/
|
|
428
|
+
class SkyPageControlHarness extends ComponentHarness {
|
|
429
|
+
/**
|
|
430
|
+
* @internal
|
|
431
|
+
*/
|
|
432
|
+
static { this.hostSelector = 'li.sky-list-paging-link'; }
|
|
433
|
+
#getButton = this.locatorFor('button.sky-paging-btn');
|
|
434
|
+
static with(filters) {
|
|
435
|
+
return new HarnessPredicate(SkyPageControlHarness, filters).addOption('pageNumber', filters.pageNumber, (harness, pageNumber) => harness
|
|
436
|
+
.getText()
|
|
437
|
+
.then((actualPageNumber) => parseInt(actualPageNumber) === pageNumber));
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Clicks the page button.
|
|
441
|
+
*/
|
|
442
|
+
async clickButton() {
|
|
443
|
+
await (await this.#getButton()).click();
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Gets the page button text.
|
|
447
|
+
*/
|
|
448
|
+
async getText() {
|
|
449
|
+
const button = await this.#getButton();
|
|
450
|
+
return await button.text();
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Harness for interacting with a paging component in tests.
|
|
456
|
+
*/
|
|
457
|
+
class SkyPagingHarness extends SkyComponentHarness {
|
|
458
|
+
/**
|
|
459
|
+
* @internal
|
|
460
|
+
*/
|
|
461
|
+
static { this.hostSelector = 'sky-paging'; }
|
|
462
|
+
#getNextButton = this.locatorForOptional('li button.sky-paging-btn-next');
|
|
463
|
+
#getPreviousButton = this.locatorForOptional('li button.sky-paging-btn-previous');
|
|
464
|
+
/**
|
|
465
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
466
|
+
* `SkyPagingHarness` that meets certain criteria.
|
|
467
|
+
*/
|
|
468
|
+
static with(filters) {
|
|
469
|
+
return SkyPagingHarness.getDataSkyIdPredicate(filters);
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Clicks the next button.
|
|
473
|
+
*/
|
|
474
|
+
async clickNextButton() {
|
|
475
|
+
const button = await this.#getNextButton();
|
|
476
|
+
if (button === null) {
|
|
477
|
+
throw new Error('Could not find the next button.');
|
|
478
|
+
}
|
|
479
|
+
if (await this.#buttonIsDisabled(button)) {
|
|
480
|
+
throw new Error('Could not click the next button because it is disabled.');
|
|
481
|
+
}
|
|
482
|
+
await button.click();
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Clicks the page button with the requested number. Throws an error if that button is not present.
|
|
486
|
+
*/
|
|
487
|
+
async clickPageButton(pageNumber) {
|
|
488
|
+
const button = await this.locatorForOptional(SkyPageControlHarness.with({ pageNumber: pageNumber }))();
|
|
489
|
+
if (button === null) {
|
|
490
|
+
throw new Error(`Could not find page button ${pageNumber}.`);
|
|
491
|
+
}
|
|
492
|
+
await button.clickButton();
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Clicks the previous button.
|
|
496
|
+
*/
|
|
497
|
+
async clickPreviousButton() {
|
|
498
|
+
const button = await this.#getPreviousButton();
|
|
499
|
+
if (button === null) {
|
|
500
|
+
throw new Error('Could not find the previous button.');
|
|
501
|
+
}
|
|
502
|
+
if (await this.#buttonIsDisabled(button)) {
|
|
503
|
+
throw new Error('Could not click the previous button because it is disabled.');
|
|
504
|
+
}
|
|
505
|
+
await button.click();
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Gets the current page number.
|
|
509
|
+
*/
|
|
510
|
+
async getCurrentPage() {
|
|
511
|
+
const currentPage = await this.locatorForOptional('button.sky-paging-current')();
|
|
512
|
+
if (currentPage === null) {
|
|
513
|
+
throw new Error('Could not find current page.');
|
|
514
|
+
}
|
|
515
|
+
return parseInt(await currentPage.text());
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Gets the paging content.
|
|
519
|
+
*/
|
|
520
|
+
async getPagingContent() {
|
|
521
|
+
return await this.locatorFor(SkyPagingContentHarness)();
|
|
522
|
+
}
|
|
523
|
+
async getPagingLabel() {
|
|
524
|
+
const pageNav = await this.locatorForOptional('nav.sky-paging')();
|
|
525
|
+
if (pageNav === null) {
|
|
526
|
+
throw new Error('Could not find paging label.');
|
|
527
|
+
}
|
|
528
|
+
return (await pageNav.getAttribute('aria-label'));
|
|
529
|
+
}
|
|
530
|
+
async #buttonIsDisabled(button) {
|
|
531
|
+
const disabled = await button.getAttribute('disabled');
|
|
532
|
+
return disabled !== null;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
218
536
|
/**
|
|
219
537
|
* Harness for interacting with a repeater item component in tests.
|
|
220
538
|
*/
|
|
@@ -534,11 +852,11 @@ class SkySortFixture {
|
|
|
534
852
|
* @internal
|
|
535
853
|
*/
|
|
536
854
|
class SkySortTestingModule {
|
|
537
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
538
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
|
539
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
|
855
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkySortTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
856
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: SkySortTestingModule, imports: [NoopAnimationsModule], exports: [SkySortModule] }); }
|
|
857
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkySortTestingModule, imports: [NoopAnimationsModule, SkySortModule] }); }
|
|
540
858
|
}
|
|
541
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
859
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkySortTestingModule, decorators: [{
|
|
542
860
|
type: NgModule,
|
|
543
861
|
args: [{
|
|
544
862
|
imports: [NoopAnimationsModule],
|
|
@@ -546,6 +864,115 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
546
864
|
}]
|
|
547
865
|
}] });
|
|
548
866
|
|
|
867
|
+
/**
|
|
868
|
+
* Harness for interacting with a sort item component in tests.
|
|
869
|
+
*/
|
|
870
|
+
class SkySortItemHarness extends SkyDropdownItemHarness {
|
|
871
|
+
/**
|
|
872
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
873
|
+
* `SkySortItemHarness` that meets certain criteria.
|
|
874
|
+
*/
|
|
875
|
+
static with(filters) {
|
|
876
|
+
return new HarnessPredicate(this, filters).addOption('text', filters.text, async (harness, text) => {
|
|
877
|
+
const menuItemText = await harness.getText();
|
|
878
|
+
return await HarnessPredicate.stringMatches(menuItemText, text);
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Clicks the sort item.
|
|
883
|
+
*/
|
|
884
|
+
async click() {
|
|
885
|
+
await super.click();
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Gets the sort item role.
|
|
889
|
+
* This can't be set on sort items and should not be exposed.
|
|
890
|
+
* @internal
|
|
891
|
+
*/
|
|
892
|
+
async getAriaRole() {
|
|
893
|
+
return await super.getAriaRole();
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Gets the sort item text.
|
|
897
|
+
*/
|
|
898
|
+
async getText() {
|
|
899
|
+
return await super.getText();
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Whether the sort item is active.
|
|
903
|
+
*/
|
|
904
|
+
async isActive() {
|
|
905
|
+
return await (await this.locatorFor('.sky-sort-item')()).hasClass('sky-sort-item-selected');
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Harness for interacting with a sort component in tests.
|
|
911
|
+
*/
|
|
912
|
+
class SkySortHarness extends SkyComponentHarness {
|
|
913
|
+
/**
|
|
914
|
+
* @internal
|
|
915
|
+
*/
|
|
916
|
+
static { this.hostSelector = 'sky-sort'; }
|
|
917
|
+
#getDropdown = this.locatorFor(SkyDropdownHarness);
|
|
918
|
+
/**
|
|
919
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
920
|
+
* `SkySortHarness` that meets certain criteria.
|
|
921
|
+
*/
|
|
922
|
+
static with(filters) {
|
|
923
|
+
return SkySortHarness.getDataSkyIdPredicate(filters);
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Clicks the sort component.
|
|
927
|
+
*/
|
|
928
|
+
async click() {
|
|
929
|
+
await (await this.#getDropdown()).clickDropdownButton();
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Gets the aria-label value.
|
|
933
|
+
*/
|
|
934
|
+
async getAriaLabel() {
|
|
935
|
+
return await (await this.#getDropdown()).getAriaLabel();
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Gets the text that appears on the sort button.
|
|
939
|
+
*/
|
|
940
|
+
async getButtonText() {
|
|
941
|
+
const text = await (await this.locatorForOptional('.sky-sort-btn-text')())?.text();
|
|
942
|
+
return text ?? '';
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Gets a harness for a specific sort item that meets certain criteria.
|
|
946
|
+
*/
|
|
947
|
+
async getItem(filters) {
|
|
948
|
+
const menuHarness = await this.#getMenuHarness();
|
|
949
|
+
return await menuHarness.queryHarness(SkySortItemHarness.with(filters));
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Gets an array of all sort items.
|
|
953
|
+
*/
|
|
954
|
+
async getItems(filters) {
|
|
955
|
+
const menuHarness = await this.#getMenuHarness();
|
|
956
|
+
const items = await (filters
|
|
957
|
+
? menuHarness.queryHarnesses(SkySortItemHarness.with(filters))
|
|
958
|
+
: menuHarness.queryHarnesses(SkySortItemHarness));
|
|
959
|
+
if (filters && !items.length) {
|
|
960
|
+
throw new Error(`Unable to find any sort items with filter(s): ${JSON.stringify(filters)}`);
|
|
961
|
+
}
|
|
962
|
+
return items;
|
|
963
|
+
}
|
|
964
|
+
async #getMenuHarness() {
|
|
965
|
+
try {
|
|
966
|
+
// eslint-disable-next-line no-var
|
|
967
|
+
var menuHarness = await (await this.#getDropdown()).getDropdownMenu();
|
|
968
|
+
}
|
|
969
|
+
catch {
|
|
970
|
+
throw new Error('Unable to locate any sort items because the sort menu is not open.');
|
|
971
|
+
}
|
|
972
|
+
return menuHarness;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
|
|
549
976
|
/**
|
|
550
977
|
* Provides information for and interaction with a SKY UX infinite scroll component.
|
|
551
978
|
* By using the fixture API, a test insulates itself against updates to the internals
|
|
@@ -580,11 +1007,11 @@ class SkyInfiniteScrollFixture {
|
|
|
580
1007
|
* @internal
|
|
581
1008
|
*/
|
|
582
1009
|
class SkyInfiniteScrollTestingModule {
|
|
583
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
584
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
|
585
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
|
1010
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkyInfiniteScrollTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1011
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: SkyInfiniteScrollTestingModule, exports: [SkyInfiniteScrollModule] }); }
|
|
1012
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkyInfiniteScrollTestingModule, imports: [SkyInfiniteScrollModule] }); }
|
|
586
1013
|
}
|
|
587
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1014
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SkyInfiniteScrollTestingModule, decorators: [{
|
|
588
1015
|
type: NgModule,
|
|
589
1016
|
args: [{
|
|
590
1017
|
exports: [SkyInfiniteScrollModule],
|
|
@@ -593,7 +1020,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
593
1020
|
|
|
594
1021
|
/**
|
|
595
1022
|
* Harness for interacting with an infinite scroll component in tests.
|
|
596
|
-
* @internal
|
|
597
1023
|
*/
|
|
598
1024
|
class SkyInfiniteScrollHarness extends SkyComponentHarness {
|
|
599
1025
|
/**
|
|
@@ -643,5 +1069,5 @@ class SkyInfiniteScrollHarness extends SkyComponentHarness {
|
|
|
643
1069
|
* Generated bundle index. Do not edit.
|
|
644
1070
|
*/
|
|
645
1071
|
|
|
646
|
-
export { SkyFilterFixtureButton, SkyFilterFixtureSummary, SkyFilterTestingModule, SkyInfiniteScrollFixture, SkyInfiniteScrollHarness, SkyInfiniteScrollTestingModule, SkyPagingFixture, SkyPagingTestingModule, SkyRepeaterHarness, SkyRepeaterItemHarness, SkySortFixture, SkySortTestingModule };
|
|
1072
|
+
export { SkyFilterButtonHarness, SkyFilterFixtureButton, SkyFilterFixtureSummary, SkyFilterInlineHarness, SkyFilterInlineItemHarness, SkyFilterSummaryHarness, SkyFilterSummaryItemHarness, SkyFilterTestingModule, SkyInfiniteScrollFixture, SkyInfiniteScrollHarness, SkyInfiniteScrollTestingModule, SkyPagingContentHarness, SkyPagingFixture, SkyPagingHarness, SkyPagingTestingModule, SkyRepeaterHarness, SkyRepeaterItemHarness, SkySortFixture, SkySortHarness, SkySortItemHarness, SkySortTestingModule };
|
|
647
1073
|
//# sourceMappingURL=skyux-lists-testing.mjs.map
|