@theseam/ui-common 0.4.13 → 0.4.14
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/buttons/public-api.d.ts +1 -0
- package/buttons/testing/anchor-badge-button.harness.d.ts +16 -0
- package/buttons/testing/anchor-button.harness.d.ts +16 -0
- package/buttons/testing/badge-button.harness.d.ts +15 -0
- package/buttons/testing/base-badge-button.harness.d.ts +15 -0
- package/buttons/testing/base-button.harness.d.ts +19 -0
- package/buttons/testing/button.harness.d.ts +15 -0
- package/buttons/testing/index.d.ts +5 -0
- package/buttons/testing/toggle-button.harness.d.ts +21 -0
- package/checkbox/checkbox.component.d.ts +1 -1
- package/checkbox/checkbox.module.d.ts +2 -3
- package/datatable/datatable.module.d.ts +1 -1
- package/esm2020/buttons/button/button.component.mjs +2 -1
- package/esm2020/buttons/public-api.mjs +2 -1
- package/esm2020/buttons/testing/anchor-badge-button.harness.mjs +18 -0
- package/esm2020/buttons/testing/anchor-button.harness.mjs +18 -0
- package/esm2020/buttons/testing/badge-button.harness.mjs +14 -0
- package/esm2020/buttons/testing/base-badge-button.harness.mjs +29 -0
- package/esm2020/buttons/testing/base-button.harness.mjs +41 -0
- package/esm2020/buttons/testing/button.harness.mjs +16 -0
- package/esm2020/buttons/testing/index.mjs +6 -0
- package/esm2020/buttons/testing/toggle-button.harness.mjs +25 -0
- package/esm2020/checkbox/checkbox.component.mjs +8 -3
- package/esm2020/checkbox/checkbox.module.mjs +5 -12
- package/esm2020/datatable/datatable.module.mjs +5 -5
- package/esm2020/form-field/form-field.component.mjs +4 -4
- package/esm2020/framework/schema-form/index.mjs +2 -1
- package/esm2020/framework/schema-form/schema-form-framework.component.mjs +6 -3
- package/esm2020/framework/schema-form/schema-form-framework.mjs +62 -7
- package/esm2020/framework/schema-form/schema-form-widget.mjs +2 -0
- package/esm2020/framework/schema-form/schema-form.module.mjs +1 -8
- package/esm2020/framework/schema-form-controls/schema-form-checkbox/schema-form-checkbox.component.mjs +21 -11
- package/esm2020/framework/schema-form-controls/schema-form-divider/schema-form-divider.component.mjs +20 -0
- package/esm2020/framework/schema-form-controls/schema-form-input/schema-form-input.component.mjs +17 -8
- package/esm2020/framework/schema-form-controls/schema-form-number/schema-form-number.component.mjs +14 -5
- package/esm2020/framework/schema-form-controls/schema-form-select/schema-form-select.component.mjs +19 -9
- package/esm2020/framework/schema-form-controls/schema-form-submit/schema-form-submit.component.mjs +21 -13
- package/esm2020/framework/schema-form-controls/schema-form-submit-split/schema-form-submit-split.component.mjs +30 -18
- package/esm2020/framework/schema-form-controls/schema-form-tel/schema-form-tel.component.mjs +48 -0
- package/esm2020/framework/schema-form-controls/schema-form-tiled-select/schema-form-tiled-select.component.mjs +57 -0
- package/esm2020/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.mjs +3 -3
- package/esm2020/menu/public-api.mjs +5 -1
- package/esm2020/menu/testing/menu-footer.harness.mjs +28 -0
- package/esm2020/menu/testing/menu-header.harness.mjs +23 -0
- package/esm2020/menu/testing/menu-item.harness.mjs +59 -0
- package/esm2020/menu/testing/menu.harness.mjs +163 -0
- package/esm2020/menu/testing/utils.mjs +13 -0
- package/esm2020/services/preferences/preferences-accessor.mjs +1 -1
- package/esm2020/services/preferences/preferences-manager.service.mjs +1 -1
- package/esm2020/services/preferences/preferences-record.mjs +1 -1
- package/esm2020/services/preferences/preferences.models.mjs +1 -1
- package/esm2020/story-helpers/args-to-tpl.mjs +83 -0
- package/esm2020/story-helpers/public-api.mjs +2 -2
- package/esm2020/story-helpers/story-preferences-accessor.service.mjs +1 -1
- package/esm2020/tel-input/public-api.mjs +2 -1
- package/esm2020/tel-input/tel-input/tel-input.component.mjs +22 -10
- package/esm2020/tel-input/tel-input.directive.mjs +12 -13
- package/esm2020/tel-input/tel-input.module.mjs +10 -9
- package/esm2020/tel-input/testing/tel-input.harness.mjs +49 -0
- package/esm2020/testing/harnesses/ng-select-dropdown.harness.mjs +39 -0
- package/esm2020/testing/harnesses/ng-select-option.harness.mjs +26 -0
- package/esm2020/testing/harnesses/ng-select.harness.mjs +104 -0
- package/esm2020/testing/public-api.mjs +4 -1
- package/esm2020/tiled-select/components/tiled-select/tiled-select.component.mjs +1 -1
- package/esm2020/utils/geo-json/coerce-feature-collection.mjs +1 -1
- package/esm2020/utils/geo-json/is-feature-collection.validator.mjs +1 -1
- package/esm2020/utils/geo-json/is-only-geometry-types.mjs +1 -1
- package/esm2020/utils/geo-json/merge-polygons.mjs +1 -1
- package/esm2020/utils/geo-json/no-inner-rings.validator.mjs +1 -1
- package/esm2020/utils/geo-json/split-multi-polygons.mjs +1 -1
- package/esm2020/widget/preferences/widget-preferences.models.mjs +1 -1
- package/esm2020/widget/preferences/widget-preferences.service.mjs +1 -1
- package/esm2020/widget/preferences/widget-preferences.token.mjs +1 -1
- package/esm2020/widget/widget.models.mjs +1 -1
- package/fesm2015/theseam-ui-common-buttons.mjs +181 -3
- package/fesm2015/theseam-ui-common-buttons.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-checkbox.mjs +12 -14
- package/fesm2015/theseam-ui-common-checkbox.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-datatable.mjs +4 -4
- package/fesm2015/theseam-ui-common-datatable.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-form-field.mjs +3 -3
- package/fesm2015/theseam-ui-common-form-field.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-framework.mjs +248 -164
- package/fesm2015/theseam-ui-common-framework.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-google-maps.mjs +2 -2
- package/fesm2015/theseam-ui-common-google-maps.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-menu.mjs +329 -3
- package/fesm2015/theseam-ui-common-menu.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-services.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-story-helpers.mjs +86 -1
- package/fesm2015/theseam-ui-common-story-helpers.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-tel-input.mjs +105 -29
- package/fesm2015/theseam-ui-common-tel-input.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-testing.mjs +197 -1
- package/fesm2015/theseam-ui-common-testing.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-tiled-select.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-utils.mjs.map +1 -1
- package/fesm2015/theseam-ui-common-widget.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-buttons.mjs +154 -2
- package/fesm2020/theseam-ui-common-buttons.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-checkbox.mjs +12 -14
- package/fesm2020/theseam-ui-common-checkbox.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-datatable.mjs +4 -4
- package/fesm2020/theseam-ui-common-datatable.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-form-field.mjs +3 -3
- package/fesm2020/theseam-ui-common-form-field.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-framework.mjs +236 -162
- package/fesm2020/theseam-ui-common-framework.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-google-maps.mjs +2 -2
- package/fesm2020/theseam-ui-common-google-maps.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-menu.mjs +275 -2
- package/fesm2020/theseam-ui-common-menu.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-services.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-story-helpers.mjs +84 -1
- package/fesm2020/theseam-ui-common-story-helpers.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-tel-input.mjs +89 -29
- package/fesm2020/theseam-ui-common-tel-input.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-testing.mjs +165 -1
- package/fesm2020/theseam-ui-common-testing.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-tiled-select.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-utils.mjs.map +1 -1
- package/fesm2020/theseam-ui-common-widget.mjs.map +1 -1
- package/framework/schema-form/index.d.ts +1 -0
- package/framework/schema-form/schema-form-framework.d.ts +12 -1
- package/framework/schema-form/schema-form-widget.d.ts +61 -0
- package/framework/schema-form/schema-form.module.d.ts +1 -2
- package/framework/schema-form-controls/schema-form-checkbox/schema-form-checkbox.component.d.ts +12 -11
- package/framework/schema-form-controls/schema-form-divider/schema-form-divider.component.d.ts +12 -0
- package/framework/schema-form-controls/schema-form-input/schema-form-input.component.d.ts +10 -9
- package/framework/schema-form-controls/schema-form-number/schema-form-number.component.d.ts +8 -7
- package/framework/schema-form-controls/schema-form-select/schema-form-select.component.d.ts +10 -9
- package/framework/schema-form-controls/schema-form-submit/schema-form-submit.component.d.ts +10 -9
- package/framework/schema-form-controls/schema-form-submit-split/schema-form-submit-split.component.d.ts +10 -9
- package/framework/schema-form-controls/schema-form-tel/schema-form-tel.component.d.ts +23 -0
- package/framework/schema-form-controls/schema-form-tiled-select/schema-form-tiled-select.component.d.ts +32 -0
- package/menu/menu-footer-action/menu-footer-action.component.d.ts +1 -1
- package/menu/public-api.d.ts +4 -0
- package/menu/testing/menu-footer.harness.d.ts +22 -0
- package/menu/testing/menu-header.harness.d.ts +18 -0
- package/menu/testing/menu-item.harness.d.ts +37 -0
- package/menu/testing/menu.harness.d.ts +74 -0
- package/menu/testing/utils.d.ts +5 -0
- package/package.json +1 -1
- package/story-helpers/args-to-tpl.d.ts +25 -0
- package/story-helpers/public-api.d.ts +1 -0
- package/tel-input/public-api.d.ts +1 -0
- package/tel-input/tel-input/tel-input.component.d.ts +2 -2
- package/tel-input/tel-input.directive.d.ts +1 -1
- package/tel-input/tel-input.module.d.ts +7 -7
- package/tel-input/testing/tel-input.harness.d.ts +19 -0
- package/testing/harnesses/ng-select-dropdown.harness.d.ts +23 -0
- package/testing/harnesses/ng-select-option.harness.d.ts +18 -0
- package/testing/harnesses/ng-select.harness.d.ts +50 -0
- package/testing/public-api.d.ts +3 -0
- package/tiled-select/components/tiled-select/tiled-select.component.d.ts +10 -10
- package/esm2020/framework/schema-form-controls/schema-form-controls.module.mjs +0 -79
- package/framework/schema-form-controls/schema-form-controls.module.d.ts +0 -20
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { ContentContainerComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';
|
|
2
|
+
import { waitOnConditionAsync } from '@theseam/ui-common/utils';
|
|
3
|
+
import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
1
4
|
import { animation, style, group, animate, query, useAnimation, trigger, transition } from '@angular/animations';
|
|
2
5
|
import * as i0 from '@angular/core';
|
|
3
6
|
import { Component, ChangeDetectionStrategy, InjectionToken, Inject, Optional, Input, HostListener, forwardRef, EventEmitter, TemplateRef, ViewChild, Output, inject, ChangeDetectorRef, Directive, Self, HostBinding, NgModule } from '@angular/core';
|
|
@@ -14,12 +17,282 @@ import { __decorate } from 'tslib';
|
|
|
14
17
|
import { UP_ARROW, DOWN_ARROW, END, hasModifierKey, HOME, RIGHT_ARROW, LEFT_ARROW, ESCAPE, ENTER, SPACE } from '@angular/cdk/keycodes';
|
|
15
18
|
import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
|
|
16
19
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
17
|
-
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
18
20
|
import { map, switchMap, startWith, distinctUntilChanged, takeUntil } from 'rxjs/operators';
|
|
19
21
|
import * as i1$1 from '@angular/cdk/overlay';
|
|
20
22
|
import { OverlayModule } from '@angular/cdk/overlay';
|
|
21
23
|
import * as i4 from '@angular/cdk/bidi';
|
|
22
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Workaround to wait on the animation to finish in browser, until a generic
|
|
27
|
+
* broswer-based solution is added, for Storybook interactions.
|
|
28
|
+
*/
|
|
29
|
+
async function animatingWait() {
|
|
30
|
+
const selectAnimating = () => document.querySelectorAll('.seam-menu-container .ng-animating');
|
|
31
|
+
if (selectAnimating().length === 0) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
await waitOnConditionAsync(() => selectAnimating().length === 0, 1000);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
class TheSeamMenuFooterHarness extends ContentContainerComponentHarness {
|
|
38
|
+
/**
|
|
39
|
+
* Gets a `HarnessPredicate` that can be used to search for a menu item with specific attributes.
|
|
40
|
+
* @param options Options for filtering which menu item instances are considered a match.
|
|
41
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
42
|
+
*/
|
|
43
|
+
static with(options = {}) {
|
|
44
|
+
return new HarnessPredicate(this, options)
|
|
45
|
+
.addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
|
|
46
|
+
}
|
|
47
|
+
/** Gets the text of the menu item. */
|
|
48
|
+
async getText() {
|
|
49
|
+
return (await this.host()).text();
|
|
50
|
+
}
|
|
51
|
+
/** Clicks the menu item. */
|
|
52
|
+
async click() {
|
|
53
|
+
return (await this.host()).click().then(() => animatingWait());
|
|
54
|
+
}
|
|
55
|
+
/** Hovers the menu item. */
|
|
56
|
+
async hover() {
|
|
57
|
+
return (await this.host()).hover().then(() => animatingWait());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** The selector for the host element of a `MenuFooterComponent` instance. */
|
|
61
|
+
TheSeamMenuFooterHarness.hostSelector = 'seam-menu-footer';
|
|
62
|
+
|
|
63
|
+
class TheSeamMenuHeaderHarness extends ContentContainerComponentHarness {
|
|
64
|
+
/**
|
|
65
|
+
* Gets a `HarnessPredicate` that can be used to search for a menu item with specific attributes.
|
|
66
|
+
* @param options Options for filtering which menu item instances are considered a match.
|
|
67
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
68
|
+
*/
|
|
69
|
+
static with(options = {}) {
|
|
70
|
+
return new HarnessPredicate(this, options);
|
|
71
|
+
}
|
|
72
|
+
/** Clicks the menu item. */
|
|
73
|
+
async click() {
|
|
74
|
+
return (await this.host()).click().then(() => animatingWait());
|
|
75
|
+
}
|
|
76
|
+
/** Hovers the menu item. */
|
|
77
|
+
async hover() {
|
|
78
|
+
return (await this.host()).hover().then(() => animatingWait());
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** The selector for the host element of a `MenuHeaderComponent` instance. */
|
|
82
|
+
TheSeamMenuHeaderHarness.hostSelector = 'seam-menu-header';
|
|
83
|
+
|
|
84
|
+
class TheSeamMenuHarness extends ContentContainerComponentHarness {
|
|
85
|
+
constructor() {
|
|
86
|
+
super(...arguments);
|
|
87
|
+
this._documentRootLocator = this.documentRootLocatorFactory();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Gets a `HarnessPredicate` that can be used to search for a menu with specific attributes.
|
|
91
|
+
* @param options Options for filtering which menu instances are considered a match.
|
|
92
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
93
|
+
*/
|
|
94
|
+
static with(options = {}) {
|
|
95
|
+
return new HarnessPredicate(this, options).addOption('triggerText', options.triggerText, (harness, text) => HarnessPredicate.stringMatches(harness.getTriggerText(), text));
|
|
96
|
+
}
|
|
97
|
+
/** Whether the menu is disabled. */
|
|
98
|
+
async isDisabled() {
|
|
99
|
+
const disabled = (await this.host()).getAttribute('disabled');
|
|
100
|
+
return coerceBooleanProperty(await disabled);
|
|
101
|
+
}
|
|
102
|
+
/** Whether the menu is open. */
|
|
103
|
+
async isOpen() {
|
|
104
|
+
return !!(await this._getMenuPanel());
|
|
105
|
+
}
|
|
106
|
+
/** Gets the text of the menu's trigger element. */
|
|
107
|
+
async getTriggerText() {
|
|
108
|
+
return (await this.host()).text();
|
|
109
|
+
}
|
|
110
|
+
/** Focuses the menu. */
|
|
111
|
+
async focus() {
|
|
112
|
+
return (await this.host()).focus().then(() => animatingWait());
|
|
113
|
+
}
|
|
114
|
+
/** Blurs the menu. */
|
|
115
|
+
async blur() {
|
|
116
|
+
return (await this.host()).blur().then(() => animatingWait());
|
|
117
|
+
}
|
|
118
|
+
/** Whether the menu is focused. */
|
|
119
|
+
async isFocused() {
|
|
120
|
+
return (await this.host()).isFocused();
|
|
121
|
+
}
|
|
122
|
+
/** Opens the menu. */
|
|
123
|
+
async open() {
|
|
124
|
+
if (!(await this.isOpen())) {
|
|
125
|
+
return (await this.host()).click().then(() => animatingWait());
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** Closes the menu. */
|
|
129
|
+
async close() {
|
|
130
|
+
const panel = await this._getMenuPanel();
|
|
131
|
+
if (panel) {
|
|
132
|
+
return panel.sendKeys(TestKey.ESCAPE).then(() => animatingWait());
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Gets a list of `TheSeamMenuItemHarness` representing the items in the menu.
|
|
137
|
+
* @param filters Optionally filters which menu items are included.
|
|
138
|
+
*/
|
|
139
|
+
async getItems(filters) {
|
|
140
|
+
const panelId = await this._getPanelId();
|
|
141
|
+
if (panelId) {
|
|
142
|
+
return this._documentRootLocator.locatorForAll(TheSeamMenuItemHarness.with({
|
|
143
|
+
...(filters || {}),
|
|
144
|
+
ancestor: `#${panelId}`,
|
|
145
|
+
}))();
|
|
146
|
+
}
|
|
147
|
+
return [];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Clicks an item in the menu, and optionally continues clicking items in subsequent sub-menus.
|
|
151
|
+
* @param itemFilter A filter used to represent which item in the menu should be clicked. The
|
|
152
|
+
* first matching menu item will be clicked.
|
|
153
|
+
* @param subItemFilters A list of filters representing the items to click in any subsequent
|
|
154
|
+
* sub-menus. The first item in the sub-menu matching the corresponding filter in
|
|
155
|
+
* `subItemFilters` will be clicked.
|
|
156
|
+
*/
|
|
157
|
+
async clickItem(itemFilter, ...subItemFilters) {
|
|
158
|
+
await this.open();
|
|
159
|
+
const items = await this.getItems(itemFilter);
|
|
160
|
+
if (!items.length) {
|
|
161
|
+
throw Error(`Could not find item matching ${JSON.stringify(itemFilter)}`);
|
|
162
|
+
}
|
|
163
|
+
if (!subItemFilters.length) {
|
|
164
|
+
return items[0].click();
|
|
165
|
+
}
|
|
166
|
+
const menu = await items[0].getSubmenu();
|
|
167
|
+
if (!menu) {
|
|
168
|
+
throw Error(`Item matching ${JSON.stringify(itemFilter)} does not have a submenu`);
|
|
169
|
+
}
|
|
170
|
+
return menu.clickItem(...subItemFilters);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Hovers an item in the menu, and optionally continues hovering items in subsequent sub-menus.
|
|
174
|
+
* @param itemFilter A filter used to represent which item in the menu should be hovered. The
|
|
175
|
+
* first matching menu item will be hovered.
|
|
176
|
+
* @param subItemFilters A list of filters representing the items to hover in any subsequent
|
|
177
|
+
* sub-menus. The first item in the sub-menu matching the corresponding filter in
|
|
178
|
+
* `subItemFilters` will be hovered.
|
|
179
|
+
*/
|
|
180
|
+
async hoverItem(itemFilter, ...subItemFilters) {
|
|
181
|
+
await this.open();
|
|
182
|
+
const items = await this.getItems(itemFilter);
|
|
183
|
+
if (!items.length) {
|
|
184
|
+
throw Error(`Could not find item matching ${JSON.stringify(itemFilter)}`);
|
|
185
|
+
}
|
|
186
|
+
if (!subItemFilters.length) {
|
|
187
|
+
return items[0].hover();
|
|
188
|
+
}
|
|
189
|
+
const menu = await items[0].getSubmenu();
|
|
190
|
+
if (!menu) {
|
|
191
|
+
throw Error(`Item matching ${JSON.stringify(itemFilter)} does not have a submenu`);
|
|
192
|
+
}
|
|
193
|
+
return menu.hoverItem(...subItemFilters);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Gets a `TheSeamMenuHeaderHarness` representing the header in the menu.
|
|
197
|
+
* @param filters Optionally filters which menu items are included.
|
|
198
|
+
*/
|
|
199
|
+
async getHeader(filters) {
|
|
200
|
+
const panelId = await this._getPanelId();
|
|
201
|
+
if (panelId) {
|
|
202
|
+
return this._documentRootLocator.locatorForOptional(TheSeamMenuHeaderHarness.with({
|
|
203
|
+
...(filters || {}),
|
|
204
|
+
ancestor: `#${panelId}`,
|
|
205
|
+
}))();
|
|
206
|
+
}
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Gets a `TheSeamMenuFooterHarness` representing the footer in the menu.
|
|
211
|
+
* @param filters Optionally filters which menu items are included.
|
|
212
|
+
*/
|
|
213
|
+
async getFooter(filters) {
|
|
214
|
+
const panelId = await this._getPanelId();
|
|
215
|
+
if (panelId) {
|
|
216
|
+
return this._documentRootLocator.locatorForOptional(TheSeamMenuFooterHarness.with({
|
|
217
|
+
...(filters || {}),
|
|
218
|
+
ancestor: `#${panelId}`,
|
|
219
|
+
}))();
|
|
220
|
+
}
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
async getRootHarnessLoader() {
|
|
224
|
+
const panelId = await this._getPanelId();
|
|
225
|
+
return this.documentRootLocatorFactory().harnessLoaderFor(`#${panelId}`);
|
|
226
|
+
}
|
|
227
|
+
/** Gets the menu panel associated with this menu. */
|
|
228
|
+
async _getMenuPanel() {
|
|
229
|
+
const panelId = await this._getPanelId();
|
|
230
|
+
return panelId ? this._documentRootLocator.locatorForOptional(`#${panelId}`)() : null;
|
|
231
|
+
}
|
|
232
|
+
/** Gets the id of the menu panel associated with this menu. */
|
|
233
|
+
async _getPanelId() {
|
|
234
|
+
const panelId = await (await this.host()).getAttribute('aria-controls');
|
|
235
|
+
return panelId || null;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/** The selector for the host element of a `MenuComponent` instance. */
|
|
239
|
+
TheSeamMenuHarness.hostSelector = '.seam-menu-toggle';
|
|
240
|
+
|
|
241
|
+
class TheSeamMenuItemHarness extends ContentContainerComponentHarness {
|
|
242
|
+
/**
|
|
243
|
+
* Gets a `HarnessPredicate` that can be used to search for a menu item with specific attributes.
|
|
244
|
+
* @param options Options for filtering which menu item instances are considered a match.
|
|
245
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
246
|
+
*/
|
|
247
|
+
static with(options = {}) {
|
|
248
|
+
return new HarnessPredicate(this, options)
|
|
249
|
+
.addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))
|
|
250
|
+
.addOption('hasSubmenu', options.hasSubmenu, async (harness, hasSubmenu) => (await harness.hasSubmenu()) === hasSubmenu);
|
|
251
|
+
}
|
|
252
|
+
/** Whether the menu is disabled. */
|
|
253
|
+
async isDisabled() {
|
|
254
|
+
const disabled = (await this.host()).getAttribute('disabled');
|
|
255
|
+
return coerceBooleanProperty(await disabled);
|
|
256
|
+
}
|
|
257
|
+
/** Gets the text of the menu item. */
|
|
258
|
+
async getText() {
|
|
259
|
+
return (await this.host()).text();
|
|
260
|
+
}
|
|
261
|
+
/** Focuses the menu item. */
|
|
262
|
+
async focus() {
|
|
263
|
+
return (await this.host()).focus().then(() => animatingWait());
|
|
264
|
+
}
|
|
265
|
+
/** Blurs the menu item. */
|
|
266
|
+
async blur() {
|
|
267
|
+
return (await this.host()).blur().then(() => animatingWait());
|
|
268
|
+
}
|
|
269
|
+
/** Whether the menu item is focused. */
|
|
270
|
+
async isFocused() {
|
|
271
|
+
return (await this.host()).isFocused();
|
|
272
|
+
}
|
|
273
|
+
/** Clicks the menu item. */
|
|
274
|
+
async click() {
|
|
275
|
+
return (await this.host()).click().then(() => animatingWait());
|
|
276
|
+
}
|
|
277
|
+
/** Hovers the menu item. */
|
|
278
|
+
async hover() {
|
|
279
|
+
return (await this.host()).hover().then(() => animatingWait());
|
|
280
|
+
}
|
|
281
|
+
/** Whether this item has a submenu. */
|
|
282
|
+
async hasSubmenu() {
|
|
283
|
+
return (await this.host()).matchesSelector(TheSeamMenuHarness.hostSelector);
|
|
284
|
+
}
|
|
285
|
+
/** Gets the submenu associated with this menu item, or null if none. */
|
|
286
|
+
async getSubmenu() {
|
|
287
|
+
if (await this.hasSubmenu()) {
|
|
288
|
+
return new TheSeamMenuHarness(this.locatorFactory);
|
|
289
|
+
}
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/** The selector for the host element of a `MenuItemComponent` instance. */
|
|
294
|
+
TheSeamMenuItemHarness.hostSelector = '.seam-menu-item';
|
|
295
|
+
|
|
23
296
|
const menuDropdownPanelSlideIn = animation([
|
|
24
297
|
style({
|
|
25
298
|
opacity: 0,
|
|
@@ -1006,5 +1279,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
1006
1279
|
* Generated bundle index. Do not edit.
|
|
1007
1280
|
*/
|
|
1008
1281
|
|
|
1009
|
-
export { LIB_MENU, MenuComponent, MenuDividerComponent, MenuFooterActionComponent, MenuFooterComponent, MenuHeaderComponent, MenuItemComponent, MenuToggleDirective, THESEAM_MENU_PANEL, TheSeamMenuModule, menuDropdownPanelExpandIn, menuDropdownPanelExpandOut, menuDropdownPanelFadeIn, menuDropdownPanelFadeOut, menuDropdownPanelIn, menuDropdownPanelOut, menuDropdownPanelSlideIn, menuDropdownPanelSlideOut };
|
|
1282
|
+
export { LIB_MENU, MenuComponent, MenuDividerComponent, MenuFooterActionComponent, MenuFooterComponent, MenuHeaderComponent, MenuItemComponent, MenuToggleDirective, THESEAM_MENU_PANEL, TheSeamMenuFooterHarness, TheSeamMenuHarness, TheSeamMenuHeaderHarness, TheSeamMenuItemHarness, TheSeamMenuModule, menuDropdownPanelExpandIn, menuDropdownPanelExpandOut, menuDropdownPanelFadeIn, menuDropdownPanelFadeOut, menuDropdownPanelIn, menuDropdownPanelOut, menuDropdownPanelSlideIn, menuDropdownPanelSlideOut };
|
|
1010
1283
|
//# sourceMappingURL=theseam-ui-common-menu.mjs.map
|