@ethlete/components 1.0.0-next.75 → 1.0.0-next.76
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/CHANGELOG.md +14 -0
- package/fesm2022/ethlete-components-testing.mjs +384 -475
- package/fesm2022/ethlete-components-testing.mjs.map +1 -1
- package/fesm2022/ethlete-components.mjs +105736 -72746
- package/fesm2022/ethlete-components.mjs.map +1 -1
- package/package.json +2 -2
- package/src/lib/forms/form-field/form-field-control-suffix-styles.component.css +10 -1
- package/src/lib/overlay/strategies/sheet-styles.component.css +19 -0
- package/types/ethlete-components-testing.d.ts +225 -238
- package/types/ethlete-components.d.ts +29206 -21279
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethlete/components",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.76",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/ethlete-io/ethdk",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@ethlete/query": "^6.0.0-beta.8",
|
|
39
39
|
"@ethlete/types": "^2.0.0-beta.4",
|
|
40
40
|
"@floating-ui/dom": "^1.6.0",
|
|
41
|
-
"@nx/devkit": "^
|
|
41
|
+
"@nx/devkit": "^24.0.0",
|
|
42
42
|
"date-fns": "^4.0.0",
|
|
43
43
|
"rxjs": "^7.8.0"
|
|
44
44
|
},
|
|
@@ -27,8 +27,14 @@
|
|
|
27
27
|
inset: -4px;
|
|
28
28
|
border-radius: 50%;
|
|
29
29
|
background: transparent;
|
|
30
|
-
transition: background-color 150ms ease;
|
|
31
30
|
pointer-events: none;
|
|
31
|
+
|
|
32
|
+
/* Hover-only: a tap's :active transition ends on this pseudo-element in the frame the button
|
|
33
|
+
starts to leave, and Angular's animate.leave takes that transitionend (its target is the
|
|
34
|
+
button) as the end of the fade-out and removes the button at once. */
|
|
35
|
+
@media (hover: hover) {
|
|
36
|
+
transition: background-color 150ms ease;
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
/* Ends halfway into the gap, so a neighbouring picker trigger's own hit area keeps the other half. */
|
|
@@ -103,6 +109,9 @@
|
|
|
103
109
|
content: '';
|
|
104
110
|
position: absolute;
|
|
105
111
|
inset: -14px;
|
|
112
|
+
inset-inline-end: calc(
|
|
113
|
+
-1 * min(14px, var(--et-form-field-control-padding-inline) + var(--et-form-field-control-border-width))
|
|
114
|
+
);
|
|
106
115
|
}
|
|
107
116
|
|
|
108
117
|
.et-icon {
|
|
@@ -47,6 +47,24 @@
|
|
|
47
47
|
is used deliberately: sheets keep `overflow: hidden` to clip their rounded corners, and an
|
|
48
48
|
element's own box-shadow is not clipped by its own overflow — a child/`::after` would be. */
|
|
49
49
|
box-shadow: 0 50px 0 0 var(--_et-overlay-overshoot-fill);
|
|
50
|
+
|
|
51
|
+
/* `translate` and `scale` compose with the `transform` that the enter, leave and drag
|
|
52
|
+
animations write, so the stack never fights them. */
|
|
53
|
+
transform-origin: top center;
|
|
54
|
+
transition:
|
|
55
|
+
translate 400ms var(--ease-out-5),
|
|
56
|
+
scale 400ms var(--ease-out-5);
|
|
57
|
+
|
|
58
|
+
@supports (transition-timing-function: linear(0, 1)) {
|
|
59
|
+
transition:
|
|
60
|
+
translate 400ms var(--ease-spring-1),
|
|
61
|
+
scale 400ms var(--ease-spring-1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&.et-overlay--stacked {
|
|
65
|
+
translate: 0 -10px;
|
|
66
|
+
scale: 0.92;
|
|
67
|
+
}
|
|
50
68
|
}
|
|
51
69
|
|
|
52
70
|
&.et-overlay--top-sheet {
|
|
@@ -136,6 +154,7 @@
|
|
|
136
154
|
&.et-overlay--top-sheet,
|
|
137
155
|
&.et-overlay--left-sheet,
|
|
138
156
|
&.et-overlay--right-sheet {
|
|
157
|
+
&,
|
|
139
158
|
&.et-animation-enter-active,
|
|
140
159
|
&.et-animation-leave-active {
|
|
141
160
|
transition-duration: 0ms;
|
|
@@ -1,82 +1,78 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/** Matches the element carrying the directive, when the host template nests it. */
|
|
9
|
-
directiveSelector?: string;
|
|
1
|
+
import { Provider, Type } from "@angular/core";
|
|
2
|
+
import { ComponentFixture } from "@angular/core/testing";
|
|
3
|
+
import { OverlayRuntimeCloseSource } from "@ethlete/core";
|
|
4
|
+
import { OverlayConfig, OverlayRef, SelectDirective, TabBarDirective } from "@ethlete/components";
|
|
5
|
+
export type ControlDriverOptions = {
|
|
6
|
+
/** Matches the element carrying the directive, when the host template nests it. */
|
|
7
|
+
directiveSelector?: string;
|
|
10
8
|
};
|
|
11
9
|
/** The host, the directive under test, and queries scoped to the fixture - what every driver needs. */
|
|
12
|
-
declare const createControlDriver: <T, D>(fixture: ComponentFixture<T>, directiveType: Type<D>, { directiveSelector }?: ControlDriverOptions) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
export declare const createControlDriver: <T, D>(fixture: ComponentFixture<T>, directiveType: Type<D>, { directiveSelector }?: ControlDriverOptions) => {
|
|
11
|
+
fixture: ComponentFixture<T>;
|
|
12
|
+
host: T;
|
|
13
|
+
control: D;
|
|
14
|
+
detectChanges: () => void;
|
|
15
|
+
tick: () => void;
|
|
16
|
+
element: () => HTMLElement;
|
|
17
|
+
directive: <X>(type: Type<X>, selector?: string) => X;
|
|
18
|
+
query: <E extends HTMLElement = HTMLElement>(selector: string) => E | null;
|
|
19
|
+
queryAll: <E extends HTMLElement = HTMLElement>(selector: string) => E[];
|
|
20
|
+
text: (selector: string) => string | null;
|
|
21
|
+
click: (element: HTMLElement) => void;
|
|
24
22
|
};
|
|
25
|
-
|
|
26
23
|
/**
|
|
27
24
|
* Types masked date/time text one character at a time, with the caret tracking the insertion -
|
|
28
25
|
* what `InputMaskDirective`'s live reformatting needs, unlike a whole-string {@link typeInField}.
|
|
29
26
|
*/
|
|
30
|
-
declare const typeMasked: (field: HTMLInputElement, text: string) => void;
|
|
27
|
+
export declare const typeMasked: (field: HTMLInputElement, text: string) => void;
|
|
31
28
|
/**
|
|
32
29
|
* Driver for every date-time control that pairs text fields with a picker overlay: date, date
|
|
33
30
|
* range, date-time, time and time range. The picker trigger is matched by its directive, so a test
|
|
34
31
|
* host can put it on any element; the fields are matched by CSS, defaulting to the only `input`.
|
|
35
32
|
*/
|
|
36
|
-
declare const createDatePickerDriver: <T, D extends {
|
|
37
|
-
|
|
33
|
+
export declare const createDatePickerDriver: <T, D extends {
|
|
34
|
+
closePicker: () => void;
|
|
38
35
|
}>(fixture: ComponentFixture<T>, directiveType: Type<D>, options?: ControlDriverOptions) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
36
|
+
dayCell: (label: string) => HTMLButtonElement | null;
|
|
37
|
+
clickDayCell: (label: string) => void;
|
|
38
|
+
field: (selector?: string) => HTMLInputElement;
|
|
39
|
+
fields: () => HTMLInputElement[];
|
|
40
|
+
type: (text: string, selector?: string) => void;
|
|
41
|
+
typeMasked: (text: string, selector?: string) => void;
|
|
42
|
+
typeAndBlur: (text: string, selector?: string) => void;
|
|
43
|
+
focusField: (selector?: string) => void;
|
|
44
|
+
blurField: (selector?: string) => void;
|
|
45
|
+
pressInField: (key: string, selector?: string) => KeyboardEvent;
|
|
46
|
+
settle: () => Promise<void>;
|
|
47
|
+
trigger: <E extends HTMLElement = HTMLElement>() => E;
|
|
48
|
+
pane: () => HTMLElement | null;
|
|
49
|
+
paneEl: <E extends HTMLElement = HTMLElement>(selector: string) => E | null;
|
|
50
|
+
paneEls: <E extends HTMLElement = HTMLElement>(selector: string) => E[];
|
|
51
|
+
open: () => Promise<void>;
|
|
52
|
+
close: () => Promise<void>;
|
|
53
|
+
closeAndRemovePanes: () => void;
|
|
54
|
+
press: (key: string) => KeyboardEvent;
|
|
55
|
+
escape: () => KeyboardEvent;
|
|
56
|
+
pointerDownOutside: () => void;
|
|
57
|
+
clickInPane: (selector: string) => void;
|
|
58
|
+
fixture: ComponentFixture<T>;
|
|
59
|
+
host: T;
|
|
60
|
+
control: D;
|
|
61
|
+
detectChanges: () => void;
|
|
62
|
+
tick: () => void;
|
|
63
|
+
element: () => HTMLElement;
|
|
64
|
+
directive: <X>(type: Type<X>, selector?: string) => X;
|
|
65
|
+
query: <E extends HTMLElement = HTMLElement>(selector: string) => E | null;
|
|
66
|
+
queryAll: <E extends HTMLElement = HTMLElement>(selector: string) => E[];
|
|
67
|
+
text: (selector: string) => string | null;
|
|
68
|
+
click: (element: HTMLElement) => void;
|
|
72
69
|
};
|
|
73
|
-
type DatePickerDriver<T, D extends {
|
|
74
|
-
|
|
70
|
+
export type DatePickerDriver<T, D extends {
|
|
71
|
+
closePicker: () => void;
|
|
75
72
|
}> = ReturnType<typeof createDatePickerDriver<T, D>>;
|
|
76
|
-
|
|
77
|
-
declare const
|
|
78
|
-
declare const
|
|
79
|
-
declare const resetOverlays: () => void;
|
|
73
|
+
export declare const tick: () => void;
|
|
74
|
+
export declare const flushFrames: () => Promise<void>;
|
|
75
|
+
export declare const resetOverlays: () => void;
|
|
80
76
|
/**
|
|
81
77
|
* The newest overlay pane in the document.
|
|
82
78
|
*
|
|
@@ -84,48 +80,47 @@ declare const resetOverlays: () => void;
|
|
|
84
80
|
* so a pane stuck in its leave transition stays reachable. Scope every pane query through here, or
|
|
85
81
|
* a stale pane answers it.
|
|
86
82
|
*/
|
|
87
|
-
declare const latestPane: () => HTMLElement | null;
|
|
88
|
-
declare const hostDirective: <T>(fixture: ComponentFixture<unknown>, type: Type<T>) => T;
|
|
89
|
-
declare const directiveAt: <T>(fixture: ComponentFixture<unknown>, type: Type<T>, selector: string) => T;
|
|
90
|
-
declare const hostElement: (fixture: ComponentFixture<unknown>) => HTMLElement;
|
|
83
|
+
export declare const latestPane: () => HTMLElement | null;
|
|
84
|
+
export declare const hostDirective: <T>(fixture: ComponentFixture<unknown>, type: Type<T>) => T;
|
|
85
|
+
export declare const directiveAt: <T>(fixture: ComponentFixture<unknown>, type: Type<T>, selector: string) => T;
|
|
86
|
+
export declare const hostElement: (fixture: ComponentFixture<unknown>) => HTMLElement;
|
|
91
87
|
/**
|
|
92
88
|
* Queries the fixture's root element, narrowing `nativeElement` (typed `any`) to `HTMLElement`
|
|
93
89
|
* once - a generic call directly through `fixture.nativeElement.querySelectorAll<E>(...)` fails
|
|
94
90
|
* with TS2347 and collapses every downstream member access to `{}`.
|
|
95
91
|
*/
|
|
96
|
-
declare const queryAll: <E extends Element = HTMLElement>(fixture: ComponentFixture<unknown>, selector: string) => E[];
|
|
92
|
+
export declare const queryAll: <E extends Element = HTMLElement>(fixture: ComponentFixture<unknown>, selector: string) => E[];
|
|
97
93
|
/** Single-result counterpart of {@link queryAll}. */
|
|
98
|
-
declare const query: <E extends Element = HTMLElement>(fixture: ComponentFixture<unknown>, selector: string) => E | null;
|
|
99
|
-
declare const pressKey: (target: EventTarget, key: string, init?: KeyboardEventInit) => KeyboardEvent;
|
|
100
|
-
declare const focusEvent: (target: EventTarget, type: "focus" | "blur") => void;
|
|
101
|
-
declare const pointerEnter: (target: EventTarget) => void;
|
|
102
|
-
declare const pointerEvent: (target: EventTarget, type: string, init?: PointerEventInit) => void;
|
|
103
|
-
declare const setInputValue: (input: HTMLInputElement, value: string) => void;
|
|
104
|
-
declare const focusField: (field: HTMLInputElement) => void;
|
|
105
|
-
declare const typeInField: (field: HTMLInputElement, text: string) => void;
|
|
94
|
+
export declare const query: <E extends Element = HTMLElement>(fixture: ComponentFixture<unknown>, selector: string) => E | null;
|
|
95
|
+
export declare const pressKey: (target: EventTarget, key: string, init?: KeyboardEventInit) => KeyboardEvent;
|
|
96
|
+
export declare const focusEvent: (target: EventTarget, type: "focus" | "blur") => void;
|
|
97
|
+
export declare const pointerEnter: (target: EventTarget) => void;
|
|
98
|
+
export declare const pointerEvent: (target: EventTarget, type: string, init?: PointerEventInit) => void;
|
|
99
|
+
export declare const setInputValue: (input: HTMLInputElement, value: string) => void;
|
|
100
|
+
export declare const focusField: (field: HTMLInputElement) => void;
|
|
101
|
+
export declare const typeInField: (field: HTMLInputElement, text: string) => void;
|
|
106
102
|
/**
|
|
107
103
|
* Types `text` one character at a time, each with its own `input` event and the caret left after
|
|
108
104
|
* the inserted character - what a real keyboard produces. Use it instead of {@link typeInField}
|
|
109
105
|
* whenever the control reads or rewrites the element between keystrokes; a whole-string
|
|
110
106
|
* {@link setInputValue} hides every defect that only appears mid-entry.
|
|
111
107
|
*/
|
|
112
|
-
declare const typeChars: (field: HTMLInputElement, text: string) => void;
|
|
113
|
-
declare const blurField: (field: HTMLInputElement) => void;
|
|
114
|
-
declare const pointerDownOutside: () => void;
|
|
115
|
-
type ClipboardPayload = Readonly<Record<string, string>>;
|
|
108
|
+
export declare const typeChars: (field: HTMLInputElement, text: string) => void;
|
|
109
|
+
export declare const blurField: (field: HTMLInputElement) => void;
|
|
110
|
+
export declare const pointerDownOutside: () => void;
|
|
111
|
+
export type ClipboardPayload = Readonly<Record<string, string>>;
|
|
116
112
|
/** jsdom has no `DataTransfer`, so the clipboard payload is faked onto the event. */
|
|
117
|
-
declare const pasteInto: (target: EventTarget, payload: ClipboardPayload | string) => void;
|
|
118
|
-
declare const textOf: (element: Element | null | undefined) => string | null;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
readonly isClosed: () => boolean;
|
|
113
|
+
export declare const pasteInto: (target: EventTarget, payload: ClipboardPayload | string) => void;
|
|
114
|
+
export declare const textOf: (element: Element | null | undefined) => string | null;
|
|
115
|
+
export type TestOverlayRef<TComponent extends object = object, TResult = unknown> = OverlayRef<TComponent, TResult> & {
|
|
116
|
+
/** Every `close()` / `forceClose()` call, in order, including ones a close guard vetoed. */
|
|
117
|
+
readonly closeCalls: readonly {
|
|
118
|
+
result: TResult | undefined;
|
|
119
|
+
source: OverlayRuntimeCloseSource;
|
|
120
|
+
forced: boolean;
|
|
121
|
+
}[];
|
|
122
|
+
/** Whether a close got past the close guards. */
|
|
123
|
+
readonly isClosed: () => boolean;
|
|
129
124
|
};
|
|
130
125
|
/**
|
|
131
126
|
* A standalone `OverlayRef` for unit-testing an overlay component without opening it: `close(result)`
|
|
@@ -138,174 +133,166 @@ type TestOverlayRef<TComponent extends object = object, TResult = unknown> = Ove
|
|
|
138
133
|
* // … press the component's save button …
|
|
139
134
|
* expect(ref.closeCalls.at(-1)?.result).toEqual({ saved: true });
|
|
140
135
|
*/
|
|
141
|
-
declare const createTestOverlayRef: <TResult = unknown, TComponent extends object = object>(config?: OverlayConfig) => TestOverlayRef<TComponent, TResult>;
|
|
136
|
+
export declare const createTestOverlayRef: <TResult = unknown, TComponent extends object = object>(config?: OverlayConfig) => TestOverlayRef<TComponent, TResult>;
|
|
142
137
|
/** Provides `ref` (a fresh {@link createTestOverlayRef} by default) as `OVERLAY_REF`, so `definition.injectRef()` resolves it. */
|
|
143
|
-
declare const provideTestOverlayRef: <TResult = unknown>(ref?: TestOverlayRef<object, TResult>) => Provider[];
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
fieldSelector?: string;
|
|
138
|
+
export declare const provideTestOverlayRef: <TResult = unknown>(ref?: TestOverlayRef<object, TResult>) => Provider[];
|
|
139
|
+
export type FieldControlDriverOptions = ControlDriverOptions & {
|
|
140
|
+
/** Matches the editable field, when it is not the host's only `input`. */
|
|
141
|
+
fieldSelector?: string;
|
|
148
142
|
};
|
|
149
143
|
/**
|
|
150
144
|
* The plumbing every text-field form control driver needs: the host component, the directive, the
|
|
151
145
|
* native field, and the value / focus / key events a user produces on it.
|
|
152
146
|
*/
|
|
153
|
-
declare const createFieldControlDriver: <T, D>(fixture: ComponentFixture<T>, directiveType: Type<D>, { fieldSelector, ...controlOptions }?: FieldControlDriverOptions) => {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
147
|
+
export declare const createFieldControlDriver: <T, D>(fixture: ComponentFixture<T>, directiveType: Type<D>, { fieldSelector, ...controlOptions }?: FieldControlDriverOptions) => {
|
|
148
|
+
field: () => HTMLInputElement;
|
|
149
|
+
fieldValue: () => string;
|
|
150
|
+
placeholder: () => string;
|
|
151
|
+
type: (text: string) => void;
|
|
152
|
+
/** Types one character at a time - what a keyboard produces, unlike `type`'s single event. */
|
|
153
|
+
typeChars: (text: string) => void;
|
|
154
|
+
typeAndBlur: (text: string) => void;
|
|
155
|
+
focus: () => void;
|
|
156
|
+
blur: () => void;
|
|
157
|
+
press: (key: string, init?: KeyboardEventInit) => KeyboardEvent;
|
|
158
|
+
pointer: (target: EventTarget, type: string, init?: PointerEventInit) => void;
|
|
159
|
+
fixture: ComponentFixture<T>;
|
|
160
|
+
host: T;
|
|
161
|
+
control: D;
|
|
162
|
+
detectChanges: () => void;
|
|
163
|
+
tick: () => void;
|
|
164
|
+
element: () => HTMLElement;
|
|
165
|
+
directive: <X>(type: Type<X>, selector?: string) => X;
|
|
166
|
+
query: <E extends HTMLElement = HTMLElement>(selector: string) => E | null;
|
|
167
|
+
queryAll: <E extends HTMLElement = HTMLElement>(selector: string) => E[];
|
|
168
|
+
text: (selector: string) => string | null;
|
|
169
|
+
click: (element: HTMLElement) => void;
|
|
176
170
|
};
|
|
177
|
-
type FieldControlDriver<T, D> = ReturnType<typeof createFieldControlDriver<T, D>>;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
hide: (control: D) => void;
|
|
171
|
+
export type FieldControlDriver<T, D> = ReturnType<typeof createFieldControlDriver<T, D>>;
|
|
172
|
+
export type OverlayControlDriverOptions<D> = ControlDriverOptions & {
|
|
173
|
+
/** The element the user clicks to open the overlay. */
|
|
174
|
+
triggerSelector?: string;
|
|
175
|
+
/** How this control closes its overlay from code. */
|
|
176
|
+
hide: (control: D) => void;
|
|
184
177
|
};
|
|
185
178
|
/**
|
|
186
179
|
* The plumbing every overlay-backed form control driver needs: the host component, the directive,
|
|
187
180
|
* the trigger, the overlay pane, and the open/close dance jsdom needs two frames for.
|
|
188
181
|
*/
|
|
189
|
-
declare const createOverlayControlDriver: <T, D>(fixture: ComponentFixture<T>, directiveType: Type<D>, { triggerSelector, hide, ...controlOptions }: OverlayControlDriverOptions<D>) => {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
182
|
+
export declare const createOverlayControlDriver: <T, D>(fixture: ComponentFixture<T>, directiveType: Type<D>, { triggerSelector, hide, ...controlOptions }: OverlayControlDriverOptions<D>) => {
|
|
183
|
+
settle: () => Promise<void>;
|
|
184
|
+
trigger: <E extends HTMLElement = HTMLElement>() => E;
|
|
185
|
+
pane: () => HTMLElement | null;
|
|
186
|
+
paneEl: <E extends HTMLElement = HTMLElement>(selector: string) => E | null;
|
|
187
|
+
paneEls: <E extends HTMLElement = HTMLElement>(selector: string) => E[];
|
|
188
|
+
open: () => Promise<void>;
|
|
189
|
+
close: () => Promise<void>;
|
|
190
|
+
closeAndRemovePanes: () => void;
|
|
191
|
+
press: (key: string) => KeyboardEvent;
|
|
192
|
+
escape: () => KeyboardEvent;
|
|
193
|
+
pointerDownOutside: () => void;
|
|
194
|
+
clickInPane: (selector: string) => void;
|
|
195
|
+
fixture: ComponentFixture<T>;
|
|
196
|
+
host: T;
|
|
197
|
+
control: D;
|
|
198
|
+
detectChanges: () => void;
|
|
199
|
+
tick: () => void;
|
|
200
|
+
element: () => HTMLElement;
|
|
201
|
+
directive: <X>(type: Type<X>, selector?: string) => X;
|
|
202
|
+
query: <E extends HTMLElement = HTMLElement>(selector: string) => E | null;
|
|
203
|
+
queryAll: <E extends HTMLElement = HTMLElement>(selector: string) => E[];
|
|
204
|
+
text: (selector: string) => string | null;
|
|
205
|
+
click: (element: HTMLElement) => void;
|
|
213
206
|
};
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
click: (element: HTMLElement) => void;
|
|
207
|
+
export declare const createSelectDriver: <T>(fixture: ComponentFixture<T>, controlOptions?: ControlDriverOptions) => {
|
|
208
|
+
select: SelectDirective<unknown>;
|
|
209
|
+
searchInput: () => HTMLInputElement;
|
|
210
|
+
valueEl: () => HTMLElement | null;
|
|
211
|
+
valueText: () => string | null;
|
|
212
|
+
chips: () => HTMLElement[];
|
|
213
|
+
chipLabels: () => (string | null)[];
|
|
214
|
+
chipRemoveButton: (index: number) => HTMLElement | null;
|
|
215
|
+
listbox: () => HTMLElement | null;
|
|
216
|
+
paneText: () => string | null;
|
|
217
|
+
options: () => HTMLElement[];
|
|
218
|
+
visibleOptions: () => HTMLElement[];
|
|
219
|
+
activeOption: () => HTMLElement | null;
|
|
220
|
+
activeLabel: () => string | null;
|
|
221
|
+
optionLabels: () => (string | null)[];
|
|
222
|
+
visibleLabels: () => (string | null)[];
|
|
223
|
+
optionByLabel: (label: string) => HTMLElement | null;
|
|
224
|
+
optionGroups: () => HTMLElement[];
|
|
225
|
+
groupsHidden: () => boolean[];
|
|
226
|
+
groupOptionCounts: () => number[];
|
|
227
|
+
groupLabel: (index: number) => string | null;
|
|
228
|
+
virtualPadding: () => {
|
|
229
|
+
start: number;
|
|
230
|
+
end: number;
|
|
231
|
+
};
|
|
232
|
+
clickOption: (index: number) => void;
|
|
233
|
+
clickOptionByLabel: (label: string) => void;
|
|
234
|
+
removeChip: (index: number) => void;
|
|
235
|
+
hover: (element: HTMLElement) => void;
|
|
236
|
+
type: (text: string) => void;
|
|
237
|
+
pressInSearch: (key: string) => KeyboardEvent;
|
|
238
|
+
paste: (text: string) => void;
|
|
239
|
+
settle: () => Promise<void>;
|
|
240
|
+
trigger: <E extends HTMLElement = HTMLElement>() => E;
|
|
241
|
+
pane: () => HTMLElement | null;
|
|
242
|
+
paneEl: <E extends HTMLElement = HTMLElement>(selector: string) => E | null;
|
|
243
|
+
paneEls: <E extends HTMLElement = HTMLElement>(selector: string) => E[];
|
|
244
|
+
open: () => Promise<void>;
|
|
245
|
+
close: () => Promise<void>;
|
|
246
|
+
closeAndRemovePanes: () => void;
|
|
247
|
+
press: (key: string) => KeyboardEvent;
|
|
248
|
+
escape: () => KeyboardEvent;
|
|
249
|
+
pointerDownOutside: () => void;
|
|
250
|
+
clickInPane: (selector: string) => void;
|
|
251
|
+
fixture: ComponentFixture<T>;
|
|
252
|
+
host: T;
|
|
253
|
+
control: SelectDirective<unknown>;
|
|
254
|
+
detectChanges: () => void;
|
|
255
|
+
tick: () => void;
|
|
256
|
+
element: () => HTMLElement;
|
|
257
|
+
directive: <X>(type: import("@angular/core").Type<X>, selector?: string) => X;
|
|
258
|
+
query: <E extends HTMLElement = HTMLElement>(selector: string) => E | null;
|
|
259
|
+
queryAll: <E extends HTMLElement = HTMLElement>(selector: string) => E[];
|
|
260
|
+
text: (selector: string) => string | null;
|
|
261
|
+
click: (element: HTMLElement) => void;
|
|
270
262
|
};
|
|
271
|
-
type SelectDriver<T> = ReturnType<typeof createSelectDriver<T>>;
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
triggerSelector?: string;
|
|
263
|
+
export type SelectDriver<T> = ReturnType<typeof createSelectDriver<T>>;
|
|
264
|
+
export type TabBarDriverOptions = ControlDriverOptions & {
|
|
265
|
+
/** Matches every trigger inside the bar. Defaults to the role every `TabBarTriggerDirective` host carries. */
|
|
266
|
+
triggerSelector?: string;
|
|
276
267
|
};
|
|
277
268
|
/**
|
|
278
269
|
* Wraps a mounted `[etTabBar]` host with the roving-tabindex vocabulary its keyboard model needs:
|
|
279
270
|
* which trigger is currently the tab stop, and dispatching a key from wherever focus actually is.
|
|
280
271
|
*/
|
|
281
|
-
declare const createTabBarDriver: <T>(fixture: ComponentFixture<T>, options?: TabBarDriverOptions) => {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
272
|
+
export declare const createTabBarDriver: <T>(fixture: ComponentFixture<T>, options?: TabBarDriverOptions) => {
|
|
273
|
+
triggers: () => HTMLButtonElement[];
|
|
274
|
+
trigger: (index: number) => HTMLButtonElement;
|
|
275
|
+
tabbableTrigger: () => HTMLButtonElement | null;
|
|
276
|
+
focusTabbable: () => void;
|
|
277
|
+
press: (key: string, init?: KeyboardEventInit) => KeyboardEvent;
|
|
278
|
+
focusedIndex: () => number;
|
|
279
|
+
selectedIndex: () => number;
|
|
280
|
+
fixture: ComponentFixture<T>;
|
|
281
|
+
host: T;
|
|
282
|
+
control: TabBarDirective;
|
|
283
|
+
detectChanges: () => void;
|
|
284
|
+
tick: () => void;
|
|
285
|
+
element: () => HTMLElement;
|
|
286
|
+
directive: <X>(type: import("@angular/core").Type<X>, selector?: string) => X;
|
|
287
|
+
query: <E extends HTMLElement = HTMLElement>(selector: string) => E | null;
|
|
288
|
+
queryAll: <E extends HTMLElement = HTMLElement>(selector: string) => E[];
|
|
289
|
+
text: (selector: string) => string | null;
|
|
290
|
+
click: (element: HTMLElement) => void;
|
|
300
291
|
};
|
|
301
|
-
|
|
302
292
|
/**
|
|
303
293
|
* Installs the browser APIs jsdom lacks and `@ethlete/components` needs to render: `ResizeObserver`,
|
|
304
294
|
* `IntersectionObserver`, `matchMedia`, `Element.prototype.animate` and `Element.prototype.scroll`. Call it once in a test setup file;
|
|
305
295
|
* an API that already exists is left alone. The fakes never report: observers never fire, no media query
|
|
306
296
|
* matches, and an animation finishes on the next microtask.
|
|
307
297
|
*/
|
|
308
|
-
declare const setupComponentsTestEnvironment: () => void;
|
|
309
|
-
|
|
310
|
-
export { blurField, createControlDriver, createDatePickerDriver, createFieldControlDriver, createOverlayControlDriver, createSelectDriver, createTabBarDriver, createTestOverlayRef, directiveAt, flushFrames, focusEvent, focusField, hostDirective, hostElement, latestPane, pasteInto, pointerDownOutside, pointerEnter, pointerEvent, pressKey, provideTestOverlayRef, query, queryAll, resetOverlays, setInputValue, setupComponentsTestEnvironment, textOf, tick, typeChars, typeInField, typeMasked };
|
|
311
|
-
export type { ClipboardPayload, ControlDriverOptions, DatePickerDriver, FieldControlDriver, FieldControlDriverOptions, OverlayControlDriverOptions, SelectDriver, TabBarDriverOptions, TestOverlayRef };
|
|
298
|
+
export declare const setupComponentsTestEnvironment: () => void;
|