@ngneers/controls-playwright 0.0.1-pre1
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/README.md +20 -0
- package/awesome-publish.config.ts +6 -0
- package/dist/components/accordion.d.ts +21 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +42 -0
- package/dist/components/avatar.d.ts +9 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +16 -0
- package/dist/components/breadcrumb.d.ts +20 -0
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb.js +15 -0
- package/dist/components/button-group.d.ts +10 -0
- package/dist/components/button-group.d.ts.map +1 -0
- package/dist/components/button-group.js +16 -0
- package/dist/components/button.d.ts +6 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +6 -0
- package/dist/components/calendar.d.ts +101 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +56 -0
- package/dist/components/chip.d.ts +15 -0
- package/dist/components/chip.d.ts.map +1 -0
- package/dist/components/chip.js +38 -0
- package/dist/components/edit-inplace.d.ts +18 -0
- package/dist/components/edit-inplace.d.ts.map +1 -0
- package/dist/components/edit-inplace.js +29 -0
- package/dist/components/filter.d.ts +186 -0
- package/dist/components/filter.d.ts.map +1 -0
- package/dist/components/filter.js +55 -0
- package/dist/components/hint.d.ts +10 -0
- package/dist/components/hint.d.ts.map +1 -0
- package/dist/components/hint.js +22 -0
- package/dist/components/index.d.ts +38 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +37 -0
- package/dist/components/inplace.d.ts +12 -0
- package/dist/components/inplace.d.ts.map +1 -0
- package/dist/components/inplace.js +29 -0
- package/dist/components/input-field.d.ts +12 -0
- package/dist/components/input-field.d.ts.map +1 -0
- package/dist/components/input-field.js +11 -0
- package/dist/components/input.d.ts +12 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +25 -0
- package/dist/components/item-view.d.ts +18 -0
- package/dist/components/item-view.d.ts.map +1 -0
- package/dist/components/item-view.js +39 -0
- package/dist/components/list-box.d.ts +20 -0
- package/dist/components/list-box.d.ts.map +1 -0
- package/dist/components/list-box.js +24 -0
- package/dist/components/mask-input.d.ts +62 -0
- package/dist/components/mask-input.d.ts.map +1 -0
- package/dist/components/mask-input.js +109 -0
- package/dist/components/menu.d.ts +16 -0
- package/dist/components/menu.d.ts.map +1 -0
- package/dist/components/menu.js +26 -0
- package/dist/components/message.d.ts +10 -0
- package/dist/components/message.d.ts.map +1 -0
- package/dist/components/message.js +22 -0
- package/dist/components/popover.d.ts +12 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +33 -0
- package/dist/components/progress.d.ts +17 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +46 -0
- package/dist/components/radio.d.ts +16 -0
- package/dist/components/radio.d.ts.map +1 -0
- package/dist/components/radio.js +35 -0
- package/dist/components/scroller.d.ts +20 -0
- package/dist/components/scroller.d.ts.map +1 -0
- package/dist/components/scroller.js +58 -0
- package/dist/components/select-button.d.ts +30 -0
- package/dist/components/select-button.d.ts.map +1 -0
- package/dist/components/select-button.js +46 -0
- package/dist/components/select.d.ts +46 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +74 -0
- package/dist/components/slider.d.ts +26 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +73 -0
- package/dist/components/snackbar.d.ts +27 -0
- package/dist/components/snackbar.d.ts.map +1 -0
- package/dist/components/snackbar.js +70 -0
- package/dist/components/spinner.d.ts +11 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +22 -0
- package/dist/components/state.d.ts +31 -0
- package/dist/components/state.d.ts.map +1 -0
- package/dist/components/state.js +31 -0
- package/dist/components/switch.d.ts +12 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +39 -0
- package/dist/components/tabs.d.ts +22 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +42 -0
- package/dist/components/tag.d.ts +10 -0
- package/dist/components/tag.d.ts.map +1 -0
- package/dist/components/tag.js +22 -0
- package/dist/components/toast.d.ts +27 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +68 -0
- package/dist/components/toggle-button.d.ts +10 -0
- package/dist/components/toggle-button.d.ts.map +1 -0
- package/dist/components/toggle-button.js +29 -0
- package/dist/components/tooltip.d.ts +12 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +32 -0
- package/dist/components/tree.d.ts +47 -0
- package/dist/components/tree.d.ts.map +1 -0
- package/dist/components/tree.js +85 -0
- package/dist/components/upload.d.ts +27 -0
- package/dist/components/upload.d.ts.map +1 -0
- package/dist/components/upload.js +47 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/classes.d.ts +119 -0
- package/dist/utils/classes.d.ts.map +1 -0
- package/dist/utils/classes.js +31 -0
- package/dist/utils/theme.d.ts +3 -0
- package/dist/utils/theme.d.ts.map +1 -0
- package/dist/utils/theme.js +41 -0
- package/package.json +38 -0
- package/src/components/accordion.ts +50 -0
- package/src/components/avatar.ts +17 -0
- package/src/components/breadcrumb.ts +17 -0
- package/src/components/button-group.ts +18 -0
- package/src/components/button.ts +5 -0
- package/src/components/calendar.ts +67 -0
- package/src/components/chip.ts +43 -0
- package/src/components/edit-inplace.ts +34 -0
- package/src/components/filter.ts +70 -0
- package/src/components/hint.ts +25 -0
- package/src/components/index.ts +37 -0
- package/src/components/inplace.ts +33 -0
- package/src/components/input-field.ts +16 -0
- package/src/components/input.ts +32 -0
- package/src/components/item-view.ts +48 -0
- package/src/components/list-box.ts +25 -0
- package/src/components/mask-input.ts +119 -0
- package/src/components/menu.ts +29 -0
- package/src/components/message.ts +25 -0
- package/src/components/popover.ts +39 -0
- package/src/components/progress.ts +53 -0
- package/src/components/radio.ts +42 -0
- package/src/components/scroller.ts +68 -0
- package/src/components/select-button.ts +57 -0
- package/src/components/select.ts +81 -0
- package/src/components/slider.ts +84 -0
- package/src/components/snackbar.ts +84 -0
- package/src/components/spinner.ts +27 -0
- package/src/components/state.ts +37 -0
- package/src/components/switch.ts +43 -0
- package/src/components/tabs.ts +50 -0
- package/src/components/tag.ts +25 -0
- package/src/components/toast.ts +82 -0
- package/src/components/toggle-button.ts +33 -0
- package/src/components/tooltip.ts +38 -0
- package/src/components/tree.ts +98 -0
- package/src/components/upload.ts +63 -0
- package/src/index.ts +1 -0
- package/src/utils/classes.ts +32 -0
- package/src/utils/theme.ts +44 -0
- package/tsconfig.lib.json +20 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Locator } from '@playwright/test';
|
|
2
|
+
import { NgnInputHarness } from './input';
|
|
3
|
+
import { NgnListBoxHarness } from './list-box';
|
|
4
|
+
import { NgnInputFieldHarness } from './input-field';
|
|
5
|
+
import { NgnItemViewHarness } from './item-view';
|
|
6
|
+
export declare class NgnSelectHarness {
|
|
7
|
+
locator: Locator;
|
|
8
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"select", ["root", "combobox", "input", "icon", "input-editable", "popover-content", "filter-icon", "list-box-empty"], readonly [{
|
|
9
|
+
readonly class: "popover";
|
|
10
|
+
readonly template: import("@ngneers/controls-themes").ControlTemplate<"popover", ["root", "content", "content-closing"], readonly []>;
|
|
11
|
+
}, {
|
|
12
|
+
readonly class: "list-box";
|
|
13
|
+
readonly template: import("@ngneers/controls-themes").ControlTemplate<"list-box", ["root", "empty", "invalid", "item", "group", "default-item", "default-group", "item-selected", "item-highlighted", "item-disabled"], readonly [{
|
|
14
|
+
readonly class: "checkbox";
|
|
15
|
+
readonly template: import("@ngneers/controls-themes").ControlTemplate<"checkbox", ["root", "input", "box", "box-checked", "box-indeterminate", "box-icon", "box-icon-visible", "invalid"], readonly []>;
|
|
16
|
+
}, {
|
|
17
|
+
readonly class: "scroller";
|
|
18
|
+
readonly template: import("@ngneers/controls-themes").ControlTemplate<"scroller", ["root", "virtual", "item", "item-sticky"], readonly []>;
|
|
19
|
+
}]>;
|
|
20
|
+
}, {
|
|
21
|
+
readonly class: "filter";
|
|
22
|
+
readonly template: import("@ngneers/controls-themes").ControlTemplate<"input-field", ["root", "host", "disabled", "readonly", "invalid", "label", "clear-button", `labelKind-${string}`], readonly [{
|
|
23
|
+
readonly class: "input";
|
|
24
|
+
readonly template: import("@ngneers/controls-themes").ControlTemplate<"input", ["root", "invalid", "empty"], readonly []>;
|
|
25
|
+
readonly projected: true;
|
|
26
|
+
}]>;
|
|
27
|
+
}]>>;
|
|
28
|
+
readonly filter: NgnInputFieldHarness<{
|
|
29
|
+
input: NgnInputHarness;
|
|
30
|
+
}>;
|
|
31
|
+
readonly filterIcon: Locator;
|
|
32
|
+
readonly icon: Locator;
|
|
33
|
+
readonly input: Locator;
|
|
34
|
+
readonly inputEditable: NgnInputHarness;
|
|
35
|
+
readonly listBox: NgnListBoxHarness;
|
|
36
|
+
readonly popoverContent: Locator;
|
|
37
|
+
readonly multipleItemView: NgnItemViewHarness;
|
|
38
|
+
constructor(locator: Locator);
|
|
39
|
+
expectOpened(opened?: boolean): Promise<void>;
|
|
40
|
+
open(): Promise<void>;
|
|
41
|
+
close(): Promise<void>;
|
|
42
|
+
expectSelectedItemText(text: string, editable?: boolean): Promise<void>;
|
|
43
|
+
clickItemByText(text: string, expectClosed?: boolean): Promise<void>;
|
|
44
|
+
clickItemByIndex(index: number, expectClosed?: boolean): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,qBAAa,gBAAgB;IAWR,OAAO,EAAE,OAAO;IAVnC,SAAgB,OAAO;;;;;;;;;;;;;;;;;;;SAAuC;IAC9D,SAAgB,MAAM,EAAE,oBAAoB,CAAC;QAAE,KAAK,EAAE,eAAe,CAAA;KAAE,CAAC,CAAC;IACzE,SAAgB,UAAU,EAAE,OAAO,CAAC;IACpC,SAAgB,IAAI,EAAE,OAAO,CAAC;IAC9B,SAAgB,KAAK,EAAE,OAAO,CAAC;IAC/B,SAAgB,aAAa,EAAE,eAAe,CAAC;IAC/C,SAAgB,OAAO,EAAE,iBAAiB,CAAC;IAC3C,SAAgB,cAAc,EAAE,OAAO,CAAC;IACxC,SAAgB,gBAAgB,EAAE,kBAAkB,CAAC;gBAElC,OAAO,EAAE,OAAO;IAetB,YAAY,CAAC,MAAM,UAAO;IAc1B,IAAI;IAKJ,KAAK;IAKL,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,UAAQ;IAQrD,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,UAAO;IAOjD,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,UAAO;CAMjE"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { expect } from '@playwright/test';
|
|
2
|
+
import { themeClasses } from '../utils/theme';
|
|
3
|
+
import { selectControlTemplate } from '@ngneers/controls-themes/templates/select';
|
|
4
|
+
import { NgnInputHarness } from './input';
|
|
5
|
+
import { NGN_CLASSES } from '../utils/classes';
|
|
6
|
+
import { NgnListBoxHarness } from './list-box';
|
|
7
|
+
import { NgnInputFieldHarness } from './input-field';
|
|
8
|
+
import { NgnItemViewHarness } from './item-view';
|
|
9
|
+
export class NgnSelectHarness {
|
|
10
|
+
locator;
|
|
11
|
+
classes = themeClasses(selectControlTemplate);
|
|
12
|
+
filter;
|
|
13
|
+
filterIcon;
|
|
14
|
+
icon;
|
|
15
|
+
input;
|
|
16
|
+
inputEditable;
|
|
17
|
+
listBox;
|
|
18
|
+
popoverContent;
|
|
19
|
+
multipleItemView;
|
|
20
|
+
constructor(locator) {
|
|
21
|
+
this.locator = locator;
|
|
22
|
+
this.filter = new NgnInputFieldHarness(locator.locator(this.classes['filter']['root']), l => ({
|
|
23
|
+
input: new NgnInputHarness(l.locator(NGN_CLASSES.input['root'])),
|
|
24
|
+
}));
|
|
25
|
+
this.filterIcon = locator.locator(this.classes['filter-icon']);
|
|
26
|
+
this.icon = locator.locator(this.classes['icon']);
|
|
27
|
+
this.input = locator.locator(this.classes['input']);
|
|
28
|
+
this.inputEditable = new NgnInputHarness(locator.locator(`${this.classes['input-editable']} ${NGN_CLASSES.input['root']}`));
|
|
29
|
+
this.listBox = new NgnListBoxHarness(locator.locator(this.classes['list-box']['root']));
|
|
30
|
+
this.popoverContent = locator.locator(this.classes['popover-content']);
|
|
31
|
+
this.multipleItemView = new NgnItemViewHarness(locator.locator('ngn-item-view'));
|
|
32
|
+
}
|
|
33
|
+
async expectOpened(opened = true) {
|
|
34
|
+
// Gate on the trigger's `aria-expanded` (bound to `popover.open()`), not just
|
|
35
|
+
// content visibility. `open()` is only set once the native popover has
|
|
36
|
+
// actually toggled in the top layer, whereas the content becomes CSS-visible
|
|
37
|
+
// a frame earlier — before the popover is a dismissible top-layer element.
|
|
38
|
+
// Waiting on visibility alone lets a follow-up keypress (e.g. Escape) race
|
|
39
|
+
// the open transition under load and get lost, leaving the popover stuck
|
|
40
|
+
// open. The `aria-expanded`/`aria-haspopup` attributes live on the inner
|
|
41
|
+
// combobox/input trigger, not the outer `input` wrapper.
|
|
42
|
+
const trigger = this.locator.locator('[aria-haspopup="listbox"]');
|
|
43
|
+
await expect(trigger).toHaveAttribute('aria-expanded', String(opened));
|
|
44
|
+
await expect(this.popoverContent).toBeVisible({ visible: opened });
|
|
45
|
+
}
|
|
46
|
+
async open() {
|
|
47
|
+
await this.icon.click();
|
|
48
|
+
await this.expectOpened();
|
|
49
|
+
}
|
|
50
|
+
async close() {
|
|
51
|
+
await this.icon.click();
|
|
52
|
+
await this.expectOpened(false);
|
|
53
|
+
}
|
|
54
|
+
async expectSelectedItemText(text, editable = false) {
|
|
55
|
+
if (editable) {
|
|
56
|
+
await this.inputEditable.expectValue(text);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
await expect(this.input).toHaveText(text, { useInnerText: true });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async clickItemByText(text, expectClosed = true) {
|
|
63
|
+
await this.listBox.scroller.clickItemByText(text);
|
|
64
|
+
if (expectClosed) {
|
|
65
|
+
await this.expectOpened(false);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async clickItemByIndex(index, expectClosed = true) {
|
|
69
|
+
await this.listBox.scroller.clickItemByIndex(index);
|
|
70
|
+
if (expectClosed) {
|
|
71
|
+
await this.expectOpened(false);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Locator } from '@playwright/test';
|
|
2
|
+
export declare class NgnSliderHarness {
|
|
3
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"slider", ["root", "horizontal", "vertical", "track", "thumb", "fill", "invalid"], readonly []>>;
|
|
4
|
+
readonly locator: Locator;
|
|
5
|
+
readonly track: Locator;
|
|
6
|
+
readonly thumb: Locator;
|
|
7
|
+
readonly fill: Locator;
|
|
8
|
+
constructor(locator: Locator);
|
|
9
|
+
expectValue(value: number): Promise<void>;
|
|
10
|
+
expectMin(min: number): Promise<void>;
|
|
11
|
+
expectMax(max: number): Promise<void>;
|
|
12
|
+
expectOrientation(orientation: 'horizontal' | 'vertical'): Promise<void>;
|
|
13
|
+
expectReadonly(readonly: boolean): Promise<void>;
|
|
14
|
+
expectDisabled(disabled: boolean): Promise<void>;
|
|
15
|
+
clickTrack(position?: {
|
|
16
|
+
x?: number;
|
|
17
|
+
y?: number;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
dragThumb(delta: {
|
|
20
|
+
x?: number;
|
|
21
|
+
y?: number;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
pressKey(key: string): Promise<void>;
|
|
24
|
+
focus(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=slider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../src/components/slider.ts"],"names":[],"mappings":"AAEA,OAAa,EAAU,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE9D,qBAAa,gBAAgB;IAC3B,SAAgB,OAAO,sMAAuC;IAE9D,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,KAAK,EAAE,OAAO,CAAC;IAC/B,SAAgB,KAAK,EAAE,OAAO,CAAC;IAC/B,SAAgB,IAAI,EAAE,OAAO,CAAC;gBAElB,OAAO,EAAE,OAAO;IAOf,WAAW,CAAC,KAAK,EAAE,MAAM;IAIzB,SAAS,CAAC,GAAG,EAAE,MAAM;IAIrB,SAAS,CAAC,GAAG,EAAE,MAAM;IAIrB,iBAAiB,CAAC,WAAW,EAAE,YAAY,GAAG,UAAU;IAIxD,cAAc,CAAC,QAAQ,EAAE,OAAO;IAShC,cAAc,CAAC,QAAQ,EAAE,OAAO;IAShC,UAAU,CAAC,QAAQ,GAAE;QAAE,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,CAAA;KAAO;IAUpD,SAAS,CAAC,KAAK,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAa3C,QAAQ,CAAC,GAAG,EAAE,MAAM;IAIpB,KAAK;CAGnB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { sliderControlTemplate } from '@ngneers/controls-themes/templates/slider';
|
|
2
|
+
import { themeClasses } from '../utils/theme';
|
|
3
|
+
import test, { expect } from '@playwright/test';
|
|
4
|
+
export class NgnSliderHarness {
|
|
5
|
+
classes = themeClasses(sliderControlTemplate);
|
|
6
|
+
locator;
|
|
7
|
+
track;
|
|
8
|
+
thumb;
|
|
9
|
+
fill;
|
|
10
|
+
constructor(locator) {
|
|
11
|
+
this.locator = locator;
|
|
12
|
+
this.track = locator.locator(this.classes.track);
|
|
13
|
+
this.thumb = locator.locator(this.classes.thumb);
|
|
14
|
+
this.fill = locator.locator(this.classes.fill);
|
|
15
|
+
}
|
|
16
|
+
async expectValue(value) {
|
|
17
|
+
await expect(this.locator).toHaveAttribute('aria-valuenow', value.toString());
|
|
18
|
+
}
|
|
19
|
+
async expectMin(min) {
|
|
20
|
+
await expect(this.locator).toHaveAttribute('aria-valuemin', min.toString());
|
|
21
|
+
}
|
|
22
|
+
async expectMax(max) {
|
|
23
|
+
await expect(this.locator).toHaveAttribute('aria-valuemax', max.toString());
|
|
24
|
+
}
|
|
25
|
+
async expectOrientation(orientation) {
|
|
26
|
+
await expect(this.locator).toHaveAttribute('aria-orientation', orientation);
|
|
27
|
+
}
|
|
28
|
+
async expectReadonly(readonly) {
|
|
29
|
+
if (readonly) {
|
|
30
|
+
await expect(this.locator).toHaveAttribute('aria-readonly', 'true');
|
|
31
|
+
await expect(this.locator).toHaveAttribute('tabindex', '0');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
await expect(this.locator).not.toHaveAttribute('aria-readonly');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async expectDisabled(disabled) {
|
|
38
|
+
if (disabled) {
|
|
39
|
+
await expect(this.locator).toHaveAttribute('disabled');
|
|
40
|
+
await expect(this.locator).toHaveAttribute('tabindex', '-1');
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
await expect(this.locator).not.toHaveAttribute('disabled');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async clickTrack(position = {}) {
|
|
47
|
+
const box = await this.track.boundingBox();
|
|
48
|
+
if (!box) {
|
|
49
|
+
throw new Error('Track not found');
|
|
50
|
+
}
|
|
51
|
+
const x = position.x !== undefined ? box.x + position.x : box.x + box.width / 2;
|
|
52
|
+
const y = position.y !== undefined ? box.y + position.y : box.y + box.height / 2;
|
|
53
|
+
await this.track.click({ position: { x: x - box.x, y: y - box.y } });
|
|
54
|
+
}
|
|
55
|
+
async dragThumb(delta) {
|
|
56
|
+
await this.thumb.hover();
|
|
57
|
+
await this.locator.page().mouse.down();
|
|
58
|
+
const box = await this.thumb.boundingBox();
|
|
59
|
+
if (!box) {
|
|
60
|
+
throw new Error('Thumb not found');
|
|
61
|
+
}
|
|
62
|
+
await this.locator
|
|
63
|
+
.page()
|
|
64
|
+
.mouse.move(box.x + box.width / 2 + (delta.x || 0), box.y + box.height / 2 + (delta.y || 0));
|
|
65
|
+
await this.locator.page().mouse.up();
|
|
66
|
+
}
|
|
67
|
+
async pressKey(key) {
|
|
68
|
+
await this.locator.press(key);
|
|
69
|
+
}
|
|
70
|
+
async focus() {
|
|
71
|
+
await this.locator.focus();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Locator, type Page } from '@playwright/test';
|
|
2
|
+
export declare class NgnSnackbarHarness {
|
|
3
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"snackbar", ["root", "host", "body", "anim-enter", "anim-leave", "defaultHeader", "defaultHeaderText", "defaultContent", "actions", "progressBar", "closeButton", "sr-only", `color-${string}`], readonly []>>;
|
|
4
|
+
readonly locator: Locator;
|
|
5
|
+
readonly header: Locator;
|
|
6
|
+
readonly content: Locator;
|
|
7
|
+
readonly icon: Locator;
|
|
8
|
+
readonly closeButton: Locator;
|
|
9
|
+
constructor(locator: Locator);
|
|
10
|
+
expectVisible(): Promise<void>;
|
|
11
|
+
expectHidden(): Promise<void>;
|
|
12
|
+
expectHeader(text: string): Promise<void>;
|
|
13
|
+
expectContent(text: string): Promise<void>;
|
|
14
|
+
expectIcon(hasIcon: boolean): Promise<void>;
|
|
15
|
+
expectClosable(closable: boolean): Promise<void>;
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare class NgnSnackbarHostHarness {
|
|
19
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"snackbar", ["root", "host", "body", "anim-enter", "anim-leave", "defaultHeader", "defaultHeaderText", "defaultContent", "actions", "progressBar", "closeButton", "sr-only", `color-${string}`], readonly []>>;
|
|
20
|
+
readonly locator: Locator;
|
|
21
|
+
constructor(page: Page);
|
|
22
|
+
getSnackbar(index?: number): NgnSnackbarHarness;
|
|
23
|
+
getAllSnackbars(): Locator;
|
|
24
|
+
expectSnackbarCount(count: number): Promise<void>;
|
|
25
|
+
expectVisible(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=snackbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snackbar.d.ts","sourceRoot":"","sources":["../../src/components/snackbar.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEnE,qBAAa,kBAAkB;IAC7B,SAAgB,OAAO,oTAAyC;IAEhE,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,MAAM,EAAE,OAAO,CAAC;IAChC,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,IAAI,EAAE,OAAO,CAAC;IAC9B,SAAgB,WAAW,EAAE,OAAO,CAAC;gBAEzB,OAAO,EAAE,OAAO;IAUf,aAAa;IAIb,YAAY;IAIZ,YAAY,CAAC,IAAI,EAAE,MAAM;IAIzB,aAAa,CAAC,IAAI,EAAE,MAAM;IAI1B,UAAU,CAAC,OAAO,EAAE,OAAO;IAQ3B,cAAc,CAAC,QAAQ,EAAE,OAAO;IAQhC,KAAK;CAGnB;AAED,qBAAa,sBAAsB;IACjC,SAAgB,OAAO,oTAAyC;IAChE,SAAgB,OAAO,EAAE,OAAO,CAAC;gBAErB,IAAI,EAAE,IAAI;IAIf,WAAW,CAAC,KAAK,GAAE,MAAU,GAAG,kBAAkB;IAIlD,eAAe,IAAI,OAAO;IAIpB,mBAAmB,CAAC,KAAK,EAAE,MAAM;IAIjC,aAAa;CAG3B"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { snackbarControlTemplate } from '@ngneers/controls-themes/templates/snackbar';
|
|
2
|
+
import { themeClasses } from '../utils/theme';
|
|
3
|
+
import { expect } from '@playwright/test';
|
|
4
|
+
export class NgnSnackbarHarness {
|
|
5
|
+
classes = themeClasses(snackbarControlTemplate);
|
|
6
|
+
locator;
|
|
7
|
+
header;
|
|
8
|
+
content;
|
|
9
|
+
icon;
|
|
10
|
+
closeButton;
|
|
11
|
+
constructor(locator) {
|
|
12
|
+
this.locator = locator;
|
|
13
|
+
this.header = locator.locator(this.classes.defaultHeader);
|
|
14
|
+
this.content = locator.locator(this.classes.defaultContent);
|
|
15
|
+
this.icon = this.header.locator('ngn-icon').first();
|
|
16
|
+
// The close button is a direct child of the snackbar root (sibling of the body), not inside
|
|
17
|
+
// the header. It is the only <button> in the snackbar, so match it directly.
|
|
18
|
+
this.closeButton = locator.locator('button');
|
|
19
|
+
}
|
|
20
|
+
async expectVisible() {
|
|
21
|
+
await expect(this.locator).toBeVisible();
|
|
22
|
+
}
|
|
23
|
+
async expectHidden() {
|
|
24
|
+
await expect(this.locator).not.toBeVisible();
|
|
25
|
+
}
|
|
26
|
+
async expectHeader(text) {
|
|
27
|
+
await expect(this.header).toContainText(text);
|
|
28
|
+
}
|
|
29
|
+
async expectContent(text) {
|
|
30
|
+
await expect(this.content).toContainText(text);
|
|
31
|
+
}
|
|
32
|
+
async expectIcon(hasIcon) {
|
|
33
|
+
if (hasIcon) {
|
|
34
|
+
await expect(this.icon).toBeVisible();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
await expect(this.icon).not.toBeVisible();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async expectClosable(closable) {
|
|
41
|
+
if (closable) {
|
|
42
|
+
await expect(this.closeButton).toBeVisible();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
await expect(this.closeButton).not.toBeVisible();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async close() {
|
|
49
|
+
await this.closeButton.click();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export class NgnSnackbarHostHarness {
|
|
53
|
+
classes = themeClasses(snackbarControlTemplate);
|
|
54
|
+
locator;
|
|
55
|
+
constructor(page) {
|
|
56
|
+
this.locator = page.locator('ngn-snackbar-host');
|
|
57
|
+
}
|
|
58
|
+
getSnackbar(index = 0) {
|
|
59
|
+
return new NgnSnackbarHarness(this.locator.locator('ngn-snackbar').nth(index));
|
|
60
|
+
}
|
|
61
|
+
getAllSnackbars() {
|
|
62
|
+
return this.locator.locator('ngn-snackbar');
|
|
63
|
+
}
|
|
64
|
+
async expectSnackbarCount(count) {
|
|
65
|
+
await expect(this.getAllSnackbars()).toHaveCount(count);
|
|
66
|
+
}
|
|
67
|
+
async expectVisible() {
|
|
68
|
+
await expect(this.locator).toBeVisible();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Locator } from '@playwright/test';
|
|
2
|
+
export declare class NgnSpinnerHarness {
|
|
3
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"spinner", ["root", "circle", "svg", `color-${string}`, "centered"], readonly []>>;
|
|
4
|
+
readonly locator: Locator;
|
|
5
|
+
readonly svg: Locator;
|
|
6
|
+
readonly circle: Locator;
|
|
7
|
+
constructor(locator: Locator);
|
|
8
|
+
expectVisible(): Promise<void>;
|
|
9
|
+
expectRole(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/components/spinner.ts"],"names":[],"mappings":"AAEA,OAAa,EAAU,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE9D,qBAAa,iBAAiB;IAC5B,SAAgB,OAAO,wLAAwC;IAE/D,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,GAAG,EAAE,OAAO,CAAC;IAC7B,SAAgB,MAAM,EAAE,OAAO,CAAC;gBAEpB,OAAO,EAAE,OAAO;IAMf,aAAa;IAMb,UAAU;CAGxB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { spinnerControlTemplate } from '@ngneers/controls-themes/templates/spinner';
|
|
2
|
+
import { themeClasses } from '../utils/theme';
|
|
3
|
+
import test, { expect } from '@playwright/test';
|
|
4
|
+
export class NgnSpinnerHarness {
|
|
5
|
+
classes = themeClasses(spinnerControlTemplate);
|
|
6
|
+
locator;
|
|
7
|
+
svg;
|
|
8
|
+
circle;
|
|
9
|
+
constructor(locator) {
|
|
10
|
+
this.locator = locator;
|
|
11
|
+
this.svg = locator.locator(this.classes.svg);
|
|
12
|
+
this.circle = locator.locator(this.classes.circle);
|
|
13
|
+
}
|
|
14
|
+
async expectVisible() {
|
|
15
|
+
await expect(this.locator).toBeVisible();
|
|
16
|
+
await expect(this.svg).toBeVisible();
|
|
17
|
+
await expect(this.circle).toBeVisible();
|
|
18
|
+
}
|
|
19
|
+
async expectRole() {
|
|
20
|
+
await expect(this.locator).toHaveAttribute('role', 'status');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Locator } from '@playwright/test';
|
|
2
|
+
import { NgnSpinnerHarness } from './spinner';
|
|
3
|
+
export declare class NgnStateHarness {
|
|
4
|
+
readonly locator: Locator;
|
|
5
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"state", ["root", "visible", "replace-content", "indicator", "sr-only", `kind-${string}`], readonly [{
|
|
6
|
+
readonly class: "icon";
|
|
7
|
+
readonly template: import("@ngneers/controls-themes").ControlTemplate<"icon", ["root", "default"], readonly []>;
|
|
8
|
+
}, {
|
|
9
|
+
readonly class: "spinner";
|
|
10
|
+
readonly template: import("@ngneers/controls-themes").ControlTemplate<"spinner", ["root", "circle", "svg", `color-${string}`, "centered"], readonly []>;
|
|
11
|
+
}, {
|
|
12
|
+
readonly class: "button";
|
|
13
|
+
readonly template: import("@ngneers/controls-themes").ControlTemplate<"button", ["root", "inline", "loading", `kind-${string}`, `color-${string}`], readonly []>;
|
|
14
|
+
readonly projected: true;
|
|
15
|
+
}, {
|
|
16
|
+
readonly class: "input-field";
|
|
17
|
+
readonly template: import("@ngneers/controls-themes").ControlTemplate<"input-field", ["root", "host", "disabled", "readonly", "invalid", "label", "clear-button", `labelKind-${string}`], readonly [{
|
|
18
|
+
readonly class: "input";
|
|
19
|
+
readonly template: import("@ngneers/controls-themes").ControlTemplate<"input", ["root", "invalid", "empty"], readonly []>;
|
|
20
|
+
readonly projected: true;
|
|
21
|
+
}]>;
|
|
22
|
+
readonly projected: true;
|
|
23
|
+
}]>>;
|
|
24
|
+
readonly indicator: Locator;
|
|
25
|
+
readonly icon: Locator;
|
|
26
|
+
readonly spinner: NgnSpinnerHarness;
|
|
27
|
+
constructor(locator: Locator);
|
|
28
|
+
expectLoading(): Promise<void>;
|
|
29
|
+
expectIcon(kind: string): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/components/state.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,qBAAa,eAAe;aAOE,OAAO,EAAE,OAAO;IAN5C,SAAgB,OAAO;;;;;;;;;;;;;;;;;;SAAsC;IAE7D,SAAgB,SAAS,EAAE,OAAO,CAAC;IACnC,SAAgB,IAAI,EAAE,OAAO,CAAC;IAC9B,SAAgB,OAAO,EAAE,iBAAiB,CAAC;gBAEf,OAAO,EAAE,OAAO;IAM/B,aAAa;IAMb,UAAU,CAAC,IAAI,EAAE,MAAM;CAQrC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { stateControlTemplate } from '@ngneers/controls-themes/templates/state';
|
|
2
|
+
import { expect } from '@playwright/test';
|
|
3
|
+
import { themeClasses } from '../utils/theme';
|
|
4
|
+
import { NgnSpinnerHarness } from './spinner';
|
|
5
|
+
export class NgnStateHarness {
|
|
6
|
+
locator;
|
|
7
|
+
classes = themeClasses(stateControlTemplate);
|
|
8
|
+
indicator;
|
|
9
|
+
icon;
|
|
10
|
+
spinner;
|
|
11
|
+
constructor(locator) {
|
|
12
|
+
this.locator = locator;
|
|
13
|
+
this.indicator = locator.locator(this.classes.indicator);
|
|
14
|
+
this.icon = locator.locator('ngn-icon');
|
|
15
|
+
this.spinner = new NgnSpinnerHarness(locator.locator('ngn-spinner'));
|
|
16
|
+
}
|
|
17
|
+
async expectLoading() {
|
|
18
|
+
await expect(this.locator).toBeVisible();
|
|
19
|
+
await this.spinner.expectVisible();
|
|
20
|
+
await expect(this.icon).toHaveCount(0);
|
|
21
|
+
}
|
|
22
|
+
async expectIcon(kind) {
|
|
23
|
+
await expect(this.locator).toBeVisible();
|
|
24
|
+
await expect(this.locator).toHaveClass(new RegExp(`(^|\\s)ngn-state-kind-${escapeRegExp(kind)}(\\s|$)`));
|
|
25
|
+
await expect(this.icon).toBeVisible();
|
|
26
|
+
await expect(this.spinner.locator).toHaveCount(0);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function escapeRegExp(value) {
|
|
30
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Locator } from '@playwright/test';
|
|
2
|
+
export declare class NgnSwitchHarness {
|
|
3
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"switch", ["root", "input", "track", "track-checked", "thumb", "invalid"], readonly []>>;
|
|
4
|
+
readonly locator: Locator;
|
|
5
|
+
readonly input: Locator;
|
|
6
|
+
constructor(locator: Locator);
|
|
7
|
+
toggle(force?: boolean): Promise<void>;
|
|
8
|
+
expectValue(value: boolean): Promise<void>;
|
|
9
|
+
expectDisabled(disabled: boolean): Promise<void>;
|
|
10
|
+
expectReadonly(readonly: boolean): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/components/switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,kBAAkB,CAAC;AAIxD,qBAAa,gBAAgB;IAC3B,SAAgB,OAAO,8LAAuC;IAE9D,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,KAAK,EAAE,OAAO,CAAC;gBAEnB,OAAO,EAAE,OAAO;IAKf,MAAM,CAAC,KAAK,UAAQ;IAIpB,WAAW,CAAC,KAAK,EAAE,OAAO;IAQ1B,cAAc,CAAC,QAAQ,EAAE,OAAO;IAQhC,cAAc,CAAC,QAAQ,EAAE,OAAO;CAO9C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { expect } from '@playwright/test';
|
|
2
|
+
import { themeClasses } from '../utils/theme';
|
|
3
|
+
import { switchControlTemplate } from '@ngneers/controls-themes/templates/switch';
|
|
4
|
+
export class NgnSwitchHarness {
|
|
5
|
+
classes = themeClasses(switchControlTemplate);
|
|
6
|
+
locator;
|
|
7
|
+
input;
|
|
8
|
+
constructor(locator) {
|
|
9
|
+
this.locator = locator;
|
|
10
|
+
this.input = locator.locator(this.classes.input);
|
|
11
|
+
}
|
|
12
|
+
async toggle(force = false) {
|
|
13
|
+
await this.input.click({ force });
|
|
14
|
+
}
|
|
15
|
+
async expectValue(value) {
|
|
16
|
+
if (value) {
|
|
17
|
+
await expect(this.input).toBeChecked();
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
await expect(this.input).not.toBeChecked();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async expectDisabled(disabled) {
|
|
24
|
+
if (disabled) {
|
|
25
|
+
await expect(this.input).toBeDisabled();
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
await expect(this.input).not.toBeDisabled();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async expectReadonly(readonly) {
|
|
32
|
+
if (readonly) {
|
|
33
|
+
await expect(this.input).toHaveAttribute('aria-readonly');
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
await expect(this.input).not.toHaveAttribute('aria-readonly');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Locator } from '@playwright/test';
|
|
2
|
+
export declare class NgnTabsHarness {
|
|
3
|
+
locator: Locator;
|
|
4
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"tabs", ["root", "headers-container", "headers", "header", "header-active", "header-active-indicator", "scroll-left", "scroll-right", "content"], readonly []>>;
|
|
5
|
+
readonly headers: Locator;
|
|
6
|
+
readonly contents: Locator;
|
|
7
|
+
constructor(locator: Locator);
|
|
8
|
+
getTabByIndex(index: number): NgnTabHarness;
|
|
9
|
+
expectTabCount(count: number): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare class NgnTabHarness {
|
|
12
|
+
tabs: NgnTabsHarness;
|
|
13
|
+
index: number;
|
|
14
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"tabs", ["root", "headers-container", "headers", "header", "header-active", "header-active-indicator", "scroll-left", "scroll-right", "content"], readonly []>>;
|
|
15
|
+
readonly header: Locator;
|
|
16
|
+
readonly content: Locator;
|
|
17
|
+
constructor(tabs: NgnTabsHarness, index: number);
|
|
18
|
+
expectHeaderText(expected: string): Promise<void>;
|
|
19
|
+
expectActive(active?: boolean): Promise<void>;
|
|
20
|
+
select(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/components/tabs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,kBAAkB,CAAC;AAIxD,qBAAa,cAAc;IAMN,OAAO,EAAE,OAAO;IALnC,SAAgB,OAAO,qQAAqC;IAE5D,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,QAAQ,EAAE,OAAO,CAAC;gBAEf,OAAO,EAAE,OAAO;IAK5B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IAI3C,cAAc,CAAC,KAAK,EAAE,MAAM;CAGpC;AAED,qBAAa,aAAa;IAOf,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,MAAM;IAPtB,SAAgB,OAAO,qQAAqC;IAE5D,SAAgB,MAAM,EAAE,OAAO,CAAC;IAChC,SAAgB,OAAO,EAAE,OAAO,CAAC;gBAGxB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,MAAM;IAMf,gBAAgB,CAAC,QAAQ,EAAE,MAAM;IAIjC,YAAY,CAAC,MAAM,UAAO;IAIpB,MAAM;CAGpB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { expect } from '@playwright/test';
|
|
2
|
+
import { themeClasses } from '../utils/theme';
|
|
3
|
+
import { tabsControlTemplate } from '@ngneers/controls-themes/templates/tabs';
|
|
4
|
+
export class NgnTabsHarness {
|
|
5
|
+
locator;
|
|
6
|
+
classes = themeClasses(tabsControlTemplate);
|
|
7
|
+
headers;
|
|
8
|
+
contents;
|
|
9
|
+
constructor(locator) {
|
|
10
|
+
this.locator = locator;
|
|
11
|
+
this.headers = this.locator.locator(this.classes['header']);
|
|
12
|
+
this.contents = this.locator.locator(this.classes['content']);
|
|
13
|
+
}
|
|
14
|
+
getTabByIndex(index) {
|
|
15
|
+
return new NgnTabHarness(this, index);
|
|
16
|
+
}
|
|
17
|
+
expectTabCount(count) {
|
|
18
|
+
return expect(this.headers).toHaveCount(count);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export class NgnTabHarness {
|
|
22
|
+
tabs;
|
|
23
|
+
index;
|
|
24
|
+
classes = themeClasses(tabsControlTemplate);
|
|
25
|
+
header;
|
|
26
|
+
content;
|
|
27
|
+
constructor(tabs, index) {
|
|
28
|
+
this.tabs = tabs;
|
|
29
|
+
this.index = index;
|
|
30
|
+
this.header = this.tabs.headers.nth(index);
|
|
31
|
+
this.content = this.tabs.contents.nth(index);
|
|
32
|
+
}
|
|
33
|
+
expectHeaderText(expected) {
|
|
34
|
+
return expect(this.header).toHaveText(expected);
|
|
35
|
+
}
|
|
36
|
+
expectActive(active = true) {
|
|
37
|
+
return expect(this.header).toHaveAttribute('aria-selected', String(active));
|
|
38
|
+
}
|
|
39
|
+
async select() {
|
|
40
|
+
await this.header.click();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Locator } from '@playwright/test';
|
|
2
|
+
export declare class NgnTagHarness {
|
|
3
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"tag", ["root", "content", "icon", `kind-${string}`, `color-${string}`], readonly []>>;
|
|
4
|
+
readonly locator: Locator;
|
|
5
|
+
readonly content: Locator;
|
|
6
|
+
readonly icon: Locator;
|
|
7
|
+
constructor(locator: Locator);
|
|
8
|
+
expectIcon(hasIcon: boolean): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../src/components/tag.ts"],"names":[],"mappings":"AAEA,OAAa,EAAU,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE9D,qBAAa,aAAa;IACxB,SAAgB,OAAO,4LAAoC;IAE3D,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,IAAI,EAAE,OAAO,CAAC;gBAElB,OAAO,EAAE,OAAO;IAMf,UAAU,CAAC,OAAO,EAAE,OAAO;CAOzC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { tagControlTemplate } from '@ngneers/controls-themes/templates/tag';
|
|
2
|
+
import { themeClasses } from '../utils/theme';
|
|
3
|
+
import test, { expect } from '@playwright/test';
|
|
4
|
+
export class NgnTagHarness {
|
|
5
|
+
classes = themeClasses(tagControlTemplate);
|
|
6
|
+
locator;
|
|
7
|
+
content;
|
|
8
|
+
icon;
|
|
9
|
+
constructor(locator) {
|
|
10
|
+
this.locator = locator;
|
|
11
|
+
this.content = locator.locator(this.classes.content);
|
|
12
|
+
this.icon = locator.locator(this.classes.icon);
|
|
13
|
+
}
|
|
14
|
+
async expectIcon(hasIcon) {
|
|
15
|
+
if (hasIcon) {
|
|
16
|
+
await expect(this.icon).toBeVisible();
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
await expect(this.icon).not.toBeVisible();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Locator, type Page } from '@playwright/test';
|
|
2
|
+
export declare class NgnToastHarness {
|
|
3
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"toast", ["root", "host", "anim-enter", "anim-leave", "defaultHeader", "defaultHeaderText", "defaultContent", `color-${string}`], readonly []>>;
|
|
4
|
+
readonly locator: Locator;
|
|
5
|
+
readonly header: Locator;
|
|
6
|
+
readonly content: Locator;
|
|
7
|
+
readonly icon: Locator;
|
|
8
|
+
readonly closeButton: Locator;
|
|
9
|
+
constructor(locator: Locator);
|
|
10
|
+
expectVisible(): Promise<void>;
|
|
11
|
+
expectHidden(): Promise<void>;
|
|
12
|
+
expectHeader(text: string): Promise<void>;
|
|
13
|
+
expectContent(text: string): Promise<void>;
|
|
14
|
+
expectIcon(hasIcon: boolean): Promise<void>;
|
|
15
|
+
expectClosable(closable: boolean): Promise<void>;
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare class NgnToastHostHarness {
|
|
19
|
+
readonly classes: import("@ngneers/controls-themes").ThemeClasses<import("@ngneers/controls-themes").ControlTemplate<"toast", ["root", "host", "anim-enter", "anim-leave", "defaultHeader", "defaultHeaderText", "defaultContent", `color-${string}`], readonly []>>;
|
|
20
|
+
readonly locator: Locator;
|
|
21
|
+
constructor(page: Page);
|
|
22
|
+
getToast(index?: number): NgnToastHarness;
|
|
23
|
+
getAllToasts(): Locator;
|
|
24
|
+
expectToastCount(count: number): Promise<void>;
|
|
25
|
+
expectVisible(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../src/components/toast.ts"],"names":[],"mappings":"AAEA,OAAa,EAAU,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEzE,qBAAa,eAAe;IAC1B,SAAgB,OAAO,qPAAsC;IAE7D,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,MAAM,EAAE,OAAO,CAAC;IAChC,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,IAAI,EAAE,OAAO,CAAC;IAC9B,SAAgB,WAAW,EAAE,OAAO,CAAC;gBAEzB,OAAO,EAAE,OAAO;IAQf,aAAa;IAIb,YAAY;IAIZ,YAAY,CAAC,IAAI,EAAE,MAAM;IAIzB,aAAa,CAAC,IAAI,EAAE,MAAM;IAI1B,UAAU,CAAC,OAAO,EAAE,OAAO;IAQ3B,cAAc,CAAC,QAAQ,EAAE,OAAO;IAQhC,KAAK;CAGnB;AAED,qBAAa,mBAAmB;IAC9B,SAAgB,OAAO,qPAAsC;IAC7D,SAAgB,OAAO,EAAE,OAAO,CAAC;gBAErB,IAAI,EAAE,IAAI;IAIf,QAAQ,CAAC,KAAK,GAAE,MAAU,GAAG,eAAe;IAI5C,YAAY,IAAI,OAAO;IAIjB,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAI9B,aAAa;CAG3B"}
|