@bitforgehq/ui 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3665 -0
- package/LICENSE +21 -0
- package/README.md +175 -0
- package/ai/MANIFEST.index.json +383 -0
- package/ai/MANIFEST.json +7528 -0
- package/ai/REFERENCE.index.json +1461 -0
- package/ai/REFERENCE.json +7213 -0
- package/ai/UI_GUIDE.md +1159 -0
- package/ai/components/action-bar.md +209 -0
- package/ai/components/action-sheet.md +526 -0
- package/ai/components/alert-dialog.md +509 -0
- package/ai/components/alert.md +376 -0
- package/ai/components/avatar.md +146 -0
- package/ai/components/back-button.md +286 -0
- package/ai/components/badge.md +171 -0
- package/ai/components/button.md +431 -0
- package/ai/components/card.md +303 -0
- package/ai/components/checkbox.md +418 -0
- package/ai/components/chip-group.md +205 -0
- package/ai/components/chip.md +300 -0
- package/ai/components/content.md +474 -0
- package/ai/components/desktop-toast.md +420 -0
- package/ai/components/dialog.md +962 -0
- package/ai/components/empty-state.md +146 -0
- package/ai/components/field.md +319 -0
- package/ai/components/header.md +809 -0
- package/ai/components/icon-button.md +221 -0
- package/ai/components/icon.md +176 -0
- package/ai/components/input.md +455 -0
- package/ai/components/list-item.md +326 -0
- package/ai/components/list.md +178 -0
- package/ai/components/menu-button.md +377 -0
- package/ai/components/menu.md +661 -0
- package/ai/components/modal.md +613 -0
- package/ai/components/number-input.md +423 -0
- package/ai/components/page.md +299 -0
- package/ai/components/progress.md +215 -0
- package/ai/components/radio-group.md +432 -0
- package/ai/components/refresher.md +377 -0
- package/ai/components/segmented.md +517 -0
- package/ai/components/select.md +510 -0
- package/ai/components/sheet.md +845 -0
- package/ai/components/spinner.md +171 -0
- package/ai/components/stack-outlet.md +661 -0
- package/ai/components/tab-bar.md +427 -0
- package/ai/components/tab.md +295 -0
- package/ai/components/tabs.md +408 -0
- package/ai/components/textarea.md +371 -0
- package/ai/components/toast.md +522 -0
- package/ai/components/toggle.md +387 -0
- package/ai/reference/bf-action-directive.md +21 -0
- package/ai/reference/bf-action-sheet-action-role.md +27 -0
- package/ai/reference/bf-action-sheet-action.md +28 -0
- package/ai/reference/bf-action-sheet-options.md +28 -0
- package/ai/reference/bf-action-sheet-service.md +33 -0
- package/ai/reference/bf-alert-dialog-button-role.md +27 -0
- package/ai/reference/bf-alert-dialog-button.md +27 -0
- package/ai/reference/bf-alert-dialog-options.md +29 -0
- package/ai/reference/bf-alert-dialog-service.md +34 -0
- package/ai/reference/bf-alert-variant.md +28 -0
- package/ai/reference/bf-autocapitalize.md +30 -0
- package/ai/reference/bf-avatar-size.md +27 -0
- package/ai/reference/bf-avatar-variant.md +28 -0
- package/ai/reference/bf-back-at-root.md +28 -0
- package/ai/reference/bf-back-button-service.md +40 -0
- package/ai/reference/bf-badge-variant.md +29 -0
- package/ai/reference/bf-button-size.md +29 -0
- package/ai/reference/bf-button-type.md +28 -0
- package/ai/reference/bf-button-variant.md +29 -0
- package/ai/reference/bf-card-padding.md +26 -0
- package/ai/reference/bf-card-variant.md +28 -0
- package/ai/reference/bf-chip-group-mode.md +27 -0
- package/ai/reference/bf-chip-variant.md +26 -0
- package/ai/reference/bf-compare-with.md +24 -0
- package/ai/reference/bf-component-overlay-ref.md +33 -0
- package/ai/reference/bf-confirm-button-role.md +26 -0
- package/ai/reference/bf-confirm-button.md +27 -0
- package/ai/reference/bf-confirm-options.md +31 -0
- package/ai/reference/bf-confirm-size.md +26 -0
- package/ai/reference/bf-content-scroll-event.md +21 -0
- package/ai/reference/bf-defaults-options.md +32 -0
- package/ai/reference/bf-defaults.md +28 -0
- package/ai/reference/bf-desktop-toast-config.md +28 -0
- package/ai/reference/bf-desktop-toast-harness.md +33 -0
- package/ai/reference/bf-desktop-toast-options.md +28 -0
- package/ai/reference/bf-desktop-toast-position.md +28 -0
- package/ai/reference/bf-desktop-toast-service.md +42 -0
- package/ai/reference/bf-dialog-config.md +44 -0
- package/ai/reference/bf-dialog-harness.md +52 -0
- package/ai/reference/bf-dialog-ref.md +44 -0
- package/ai/reference/bf-dialog-role.md +26 -0
- package/ai/reference/bf-dialog-service.md +55 -0
- package/ai/reference/bf-dialog-size.md +31 -0
- package/ai/reference/bf-dialog-template-context.md +32 -0
- package/ai/reference/bf-empty-state-heading-level.md +26 -0
- package/ai/reference/bf-enter-key-hint.md +31 -0
- package/ai/reference/bf-field-control-class.md +32 -0
- package/ai/reference/bf-field-control-state.md +28 -0
- package/ai/reference/bf-field-size.md +29 -0
- package/ai/reference/bf-haptics-impact-style.md +27 -0
- package/ai/reference/bf-haptics-notification-type.md +27 -0
- package/ai/reference/bf-haptics-service.md +41 -0
- package/ai/reference/bf-harness-filters.md +29 -0
- package/ai/reference/bf-horizontal-scroll-directive.md +129 -0
- package/ai/reference/bf-icon-button-variant.md +28 -0
- package/ai/reference/bf-icon-size.md +27 -0
- package/ai/reference/bf-input-autocapitalize.md +36 -0
- package/ai/reference/bf-input-enter-key-hint.md +38 -0
- package/ai/reference/bf-input-input-mode.md +38 -0
- package/ai/reference/bf-input-mode.md +32 -0
- package/ai/reference/bf-input-type.md +35 -0
- package/ai/reference/bf-jsdom-shim-options.md +22 -0
- package/ai/reference/bf-keyboard-assist-behavior.md +26 -0
- package/ai/reference/bf-keyboard-assist-directive.md +185 -0
- package/ai/reference/bf-keyboard-phase.md +30 -0
- package/ai/reference/bf-keyboard-service.md +50 -0
- package/ai/reference/bf-labels-overrides.md +26 -0
- package/ai/reference/bf-labels.md +44 -0
- package/ai/reference/bf-menu-button-harness.md +40 -0
- package/ai/reference/bf-menu-button-variant.md +27 -0
- package/ai/reference/bf-menu-divider-directive.md +13 -0
- package/ai/reference/bf-menu-group-directive.md +14 -0
- package/ai/reference/bf-menu-harness.md +55 -0
- package/ai/reference/bf-menu-item-checkbox-directive.md +31 -0
- package/ai/reference/bf-menu-item-directive.md +31 -0
- package/ai/reference/bf-menu-item-harness.md +52 -0
- package/ai/reference/bf-menu-item-radio-directive.md +29 -0
- package/ai/reference/bf-menu-placement.md +29 -0
- package/ai/reference/bf-menu-trigger-directive.md +46 -0
- package/ai/reference/bf-modal-options.md +30 -0
- package/ai/reference/bf-modal-presentation.md +26 -0
- package/ai/reference/bf-modal-service.md +38 -0
- package/ai/reference/bf-nav-controller.md +59 -0
- package/ai/reference/bf-nav-direction.md +23 -0
- package/ai/reference/bf-nav-target.md +21 -0
- package/ai/reference/bf-number-input-mode.md +28 -0
- package/ai/reference/bf-number-input-step.md +25 -0
- package/ai/reference/bf-overlay-auto-focus.md +29 -0
- package/ai/reference/bf-overlay-controller.md +22 -0
- package/ai/reference/bf-overlay-host.md +36 -0
- package/ai/reference/bf-overlay-options.md +53 -0
- package/ai/reference/bf-overlay-position.md +30 -0
- package/ai/reference/bf-overlay-ref.md +53 -0
- package/ai/reference/bf-overlay-role.md +27 -0
- package/ai/reference/bf-overlay-service.md +53 -0
- package/ai/reference/bf-overlay-stack-options.md +24 -0
- package/ai/reference/bf-overlay-stack.md +81 -0
- package/ai/reference/bf-overlay-template-context.md +24 -0
- package/ai/reference/bf-overscroll-stretch-directive.md +163 -0
- package/ai/reference/bf-page-context.md +24 -0
- package/ai/reference/bf-platform-service.md +53 -0
- package/ai/reference/bf-platform.md +28 -0
- package/ai/reference/bf-progress-size.md +26 -0
- package/ai/reference/bf-progress-tone.md +28 -0
- package/ai/reference/bf-radio-group-harness.md +49 -0
- package/ai/reference/bf-radio-group-orientation.md +26 -0
- package/ai/reference/bf-radio-option.md +30 -0
- package/ai/reference/bf-refresher-refresh-event.md +22 -0
- package/ai/reference/bf-segment-option.md +29 -0
- package/ai/reference/bf-segmented-harness.md +48 -0
- package/ai/reference/bf-segmented-size.md +29 -0
- package/ai/reference/bf-select-harness.md +70 -0
- package/ai/reference/bf-select-option.md +29 -0
- package/ai/reference/bf-sheet-auto-focus.md +29 -0
- package/ai/reference/bf-sheet-options.md +32 -0
- package/ai/reference/bf-sheet-ref.md +45 -0
- package/ai/reference/bf-sheet-service.md +34 -0
- package/ai/reference/bf-shell-config-mode.md +28 -0
- package/ai/reference/bf-shell-config.md +38 -0
- package/ai/reference/bf-shell-dynamic-type-limit.md +21 -0
- package/ai/reference/bf-shell-dynamic-type.md +25 -0
- package/ai/reference/bf-shell-mode.md +28 -0
- package/ai/reference/bf-shell-testing-options.md +26 -0
- package/ai/reference/bf-size.md +45 -0
- package/ai/reference/bf-spinner-size.md +27 -0
- package/ai/reference/bf-stack-change.md +22 -0
- package/ai/reference/bf-stack-reuse-strategy.md +32 -0
- package/ai/reference/bf-stack-transition-event.md +26 -0
- package/ai/reference/bf-stack-transition.md +26 -0
- package/ai/reference/bf-stacked-overlay.md +23 -0
- package/ai/reference/bf-system-bars-style.md +38 -0
- package/ai/reference/bf-tab-bar-controller.md +51 -0
- package/ai/reference/bf-tab-bar-host.md +52 -0
- package/ai/reference/bf-tab-context.md +32 -0
- package/ai/reference/bf-tab-links.md +37 -0
- package/ai/reference/bf-testing-options.md +27 -0
- package/ai/reference/bf-text-scale-service.md +35 -0
- package/ai/reference/bf-theme.md +27 -0
- package/ai/reference/bf-toast-action.md +25 -0
- package/ai/reference/bf-toast-controller.md +17 -0
- package/ai/reference/bf-toast-dismiss-reason.md +29 -0
- package/ai/reference/bf-toast-options.md +29 -0
- package/ai/reference/bf-toast-position.md +26 -0
- package/ai/reference/bf-toast-ref.md +41 -0
- package/ai/reference/bf-toast-service.md +39 -0
- package/ai/reference/bf-toggle-label-position.md +26 -0
- package/ai/reference/bf-transition-kind.md +28 -0
- package/ai/reference/bf-validation-message.md +31 -0
- package/ai/reference/bf-validation-messages.md +33 -0
- package/ai/reference/bf-view-event.md +28 -0
- package/ai/reference/bf-view-lifecycle.md +41 -0
- package/ai/reference/bf-view-state.md +28 -0
- package/ai/reference/bf_default_labels.md +21 -0
- package/ai/reference/bf_default_values.md +21 -0
- package/ai/reference/bf_defaults.md +21 -0
- package/ai/reference/bf_desktop_toast_defaults.md +21 -0
- package/ai/reference/bf_dialog_data.md +17 -0
- package/ai/reference/bf_labels.md +21 -0
- package/ai/reference/bf_overlay_data.md +19 -0
- package/ai/reference/bf_overlay_host.md +21 -0
- package/ai/reference/bf_sheet_default_snap_points.md +17 -0
- package/ai/reference/bf_shell_config.md +21 -0
- package/ai/reference/bf_shell_defaults.md +21 -0
- package/ai/reference/bf_tab_bar.md +21 -0
- package/ai/reference/bf_tab_bar_controller.md +21 -0
- package/ai/reference/bf_tab_context.md +21 -0
- package/ai/reference/bf_tab_links.md +21 -0
- package/ai/reference/bf_theme_storage.md +19 -0
- package/ai/reference/create-transition.md +36 -0
- package/ai/reference/duration_fast.md +17 -0
- package/ai/reference/duration_md.md +17 -0
- package/ai/reference/duration_overlay.md +17 -0
- package/ai/reference/duration_push.md +17 -0
- package/ai/reference/fade-down.md +26 -0
- package/ai/reference/fade-in.md +25 -0
- package/ai/reference/fade-out.md +25 -0
- package/ai/reference/fade-up.md +26 -0
- package/ai/reference/inject-shell-mode.md +23 -0
- package/ai/reference/install-bf-jsdom-shims.md +31 -0
- package/ai/reference/ios_duration.md +17 -0
- package/ai/reference/ios_easing.md +17 -0
- package/ai/reference/is-text-entry.md +25 -0
- package/ai/reference/max_complete_ms.md +17 -0
- package/ai/reference/md-transition.md +31 -0
- package/ai/reference/md_duration.md +17 -0
- package/ai/reference/md_easing.md +17 -0
- package/ai/reference/overlay_duration.md +21 -0
- package/ai/reference/overlay_easing.md +19 -0
- package/ai/reference/overlay_reduced_duration.md +17 -0
- package/ai/reference/pop-frames-at.md +25 -0
- package/ai/reference/prefers-reduced-motion.md +25 -0
- package/ai/reference/provide-bf-defaults.md +33 -0
- package/ai/reference/provide-bf-desktop-toast.md +28 -0
- package/ai/reference/provide-bf-labels.md +38 -0
- package/ai/reference/provide-bf-shell-testing.md +34 -0
- package/ai/reference/provide-bf-shell.md +41 -0
- package/ai/reference/provide-bf-testing.md +33 -0
- package/ai/reference/reduced-transition.md +28 -0
- package/ai/reference/reduced_duration.md +17 -0
- package/ai/reference/resolve-shell-mode.md +33 -0
- package/ai/reference/scale-in.md +25 -0
- package/ai/reference/settle-duration.md +25 -0
- package/ai/reference/settle-pop.md +33 -0
- package/ai/reference/settle_easing.md +17 -0
- package/ai/reference/should-complete-pop.md +26 -0
- package/ai/reference/slide-down.md +26 -0
- package/ai/reference/slide-up.md +26 -0
- package/ai/reference/with-bf-shell-routing.md +19 -0
- package/bin/bf-ui.js +81 -0
- package/fesm2022/bitforgehq-ui-icons.mjs +230 -0
- package/fesm2022/bitforgehq-ui-icons.mjs.map +1 -0
- package/fesm2022/bitforgehq-ui-mobile.mjs +5530 -0
- package/fesm2022/bitforgehq-ui-mobile.mjs.map +1 -0
- package/fesm2022/bitforgehq-ui-number-input.mjs +680 -0
- package/fesm2022/bitforgehq-ui-number-input.mjs.map +1 -0
- package/fesm2022/bitforgehq-ui-overlay.mjs +2675 -0
- package/fesm2022/bitforgehq-ui-overlay.mjs.map +1 -0
- package/fesm2022/bitforgehq-ui-testing.mjs +402 -0
- package/fesm2022/bitforgehq-ui-testing.mjs.map +1 -0
- package/fesm2022/bitforgehq-ui.mjs +7765 -0
- package/fesm2022/bitforgehq-ui.mjs.map +1 -0
- package/llms-full.txt +25394 -0
- package/llms.txt +329 -0
- package/package.json +94 -0
- package/theme.css +253 -0
- package/types/bitforgehq-ui-icons.d.ts +50 -0
- package/types/bitforgehq-ui-mobile.d.ts +2914 -0
- package/types/bitforgehq-ui-number-input.d.ts +282 -0
- package/types/bitforgehq-ui-overlay.d.ts +1514 -0
- package/types/bitforgehq-ui-testing.d.ts +495 -0
- package/types/bitforgehq-ui.d.ts +3499 -0
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import { EnvironmentProviders } from "@angular/core";
|
|
2
|
+
import { provideBfDefaults, provideBfLabels } from "@bitforgehq/ui";
|
|
3
|
+
import { BaseHarnessFilters, ComponentHarness, HarnessPredicate, LocatorFactory } from "@angular/cdk/testing";
|
|
4
|
+
/**
|
|
5
|
+
* Options of `installBfJsdomShims()`.
|
|
6
|
+
*
|
|
7
|
+
* @summary Options of the jsdom shims: the matchMedia stub and its reduced-motion answer
|
|
8
|
+
* @since 0.3.0
|
|
9
|
+
*/
|
|
10
|
+
interface BfJsdomShimOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Install a `matchMedia` stub where missing (all queries false).
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
matchMedia?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* With the stub: report `(prefers-reduced-motion: reduce)` as matching, so overlays use their
|
|
18
|
+
* short fade. Has no effect where the environment already has `matchMedia`.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
reducedMotion?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Sets `target[key]` and returns the function that puts back what was there, or `null` when the
|
|
25
|
+
* property cannot be set (then nothing changed). A new property is writable and configurable, so
|
|
26
|
+
* it can be deleted again; a configurable existing one is restored from its descriptor, getters
|
|
27
|
+
* included. An existing non-configurable one (a runner's own `matchMedia` mock, assigned
|
|
28
|
+
* `undefined` to test without it) is assigned through its setter or value and restored the same
|
|
29
|
+
* way; a non-writable one without a setter is left alone. Internal: not exported from the entry.
|
|
30
|
+
*/
|
|
31
|
+
declare function installGlobal(target: object, key: string, value: unknown): (() => void) | null;
|
|
32
|
+
/**
|
|
33
|
+
* Installs, only where missing: `Element.prototype.animate` (an Animation whose `finished`
|
|
34
|
+
* resolves at once), `PointerEvent` (a MouseEvent subclass with pointerId, isPrimary, pointerType,
|
|
35
|
+
* width, height, pressure) and optionally `matchMedia`. Idempotent; returns a function that removes
|
|
36
|
+
* exactly what it installed. Call it once in the test runner's setup file (Vitest `setupFiles`,
|
|
37
|
+
* Jest `setupFilesAfterEnv`).
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // src/test-setup.ts
|
|
41
|
+
* import { installBfJsdomShims } from '@bitforgehq/ui/testing';
|
|
42
|
+
* installBfJsdomShims();
|
|
43
|
+
* @param options Whether to stub `matchMedia`, and whether the stub reports reduced motion.
|
|
44
|
+
* @returns A function that removes the shims this call installed.
|
|
45
|
+
* @summary Installs the browser APIs jsdom lacks and the library needs, only where missing
|
|
46
|
+
* @since 0.3.0
|
|
47
|
+
*/
|
|
48
|
+
export declare function installBfJsdomShims(options?: BfJsdomShimOptions): () => void;
|
|
49
|
+
/**
|
|
50
|
+
* Options of `provideBfTesting()`.
|
|
51
|
+
*
|
|
52
|
+
* @summary Options of the test providers: the size defaults and labels a spec runs with
|
|
53
|
+
* @since 0.3.0
|
|
54
|
+
*/
|
|
55
|
+
interface BfTestingOptions {
|
|
56
|
+
/** Passed to `provideBfDefaults()`, e.g. `{ fieldSize: 'sm' }`; left out, the library defaults apply. */
|
|
57
|
+
defaults?: Parameters<typeof provideBfDefaults>[0];
|
|
58
|
+
/** Passed to `provideBfLabels()`, e.g. German validation messages; left out, the English defaults apply. */
|
|
59
|
+
labels?: Parameters<typeof provideBfLabels>[0];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Test providers for apps using the root and overlay entries: passes `defaults`/`labels` to 3b's
|
|
63
|
+
* providers, and on environment teardown removes what overlays and themes leave on the document —
|
|
64
|
+
* `dark` and `cdk-global-scrollblock` on `<html>`, `inert` on body children, stray
|
|
65
|
+
* `.cdk-overlay-container` children. The cleanup runs when TestBed destroys the test environment,
|
|
66
|
+
* so it needs TestBed's default `teardown: { destroyAfterEach: true }`; with `destroyAfterEach:
|
|
67
|
+
* false` nothing is cleaned between tests. Mobile shell apps use `provideBfShellTesting()` from
|
|
68
|
+
* `@bitforgehq/ui/mobile` instead.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* TestBed.configureTestingModule({
|
|
72
|
+
* providers: [provideBfTesting({ defaults: { fieldSize: 'sm' } })],
|
|
73
|
+
* });
|
|
74
|
+
* @param options The size defaults and labels to provide.
|
|
75
|
+
* @returns The environment providers for `TestBed.configureTestingModule()`.
|
|
76
|
+
* @summary Test providers for the widgets and overlays, with document cleanup after each test
|
|
77
|
+
* @since 0.3.0
|
|
78
|
+
*/
|
|
79
|
+
export declare function provideBfTesting(options?: BfTestingOptions): EnvironmentProviders;
|
|
80
|
+
/**
|
|
81
|
+
* Filters of every `@bitforgehq/ui/testing` harness's `with()`: the CDK's `selector` and
|
|
82
|
+
* `ancestor`, plus the widget's label (a select's label, a dialog's title, a toast's message, a
|
|
83
|
+
* menu item's text).
|
|
84
|
+
*
|
|
85
|
+
* @summary Filters a library harness query by selector, ancestor and the widget label
|
|
86
|
+
* @since 0.3.0
|
|
87
|
+
*/
|
|
88
|
+
interface BfHarnessFilters extends BaseHarnessFilters {
|
|
89
|
+
/** The label the harness's `getLabel()` (or equivalent) returns: exact text or a pattern. */
|
|
90
|
+
label?: string | RegExp;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Harness for `bf-select`. It works by option label, so a test never needs the native option
|
|
94
|
+
* values (an object option's native value is its index).
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* const select = await loader.getHarness(BfSelectHarness.with({ label: 'Project' }));
|
|
98
|
+
* await select.selectOption('Two');
|
|
99
|
+
* @summary Test harness for the select: reads its label and options and picks one
|
|
100
|
+
* @since 0.3.0
|
|
101
|
+
*/
|
|
102
|
+
export declare class BfSelectHarness extends ComponentHarness {
|
|
103
|
+
/** The host element's selector. */
|
|
104
|
+
static hostSelector: string;
|
|
105
|
+
private readonly select;
|
|
106
|
+
private readonly label;
|
|
107
|
+
private readonly error;
|
|
108
|
+
private readonly help;
|
|
109
|
+
private readonly nativeOptions;
|
|
110
|
+
/**
|
|
111
|
+
* A predicate for a select with the given label.
|
|
112
|
+
* @param filters The label (text or pattern) and the CDK's selector and ancestor filters.
|
|
113
|
+
* @returns The predicate for `getHarness()` and friends.
|
|
114
|
+
*/
|
|
115
|
+
static with(filters?: BfHarnessFilters): HarnessPredicate<BfSelectHarness>;
|
|
116
|
+
/**
|
|
117
|
+
* The visible label without the required mark, else the `aria-label`.
|
|
118
|
+
* @returns The label text.
|
|
119
|
+
*/
|
|
120
|
+
getLabel(): Promise<string>;
|
|
121
|
+
/**
|
|
122
|
+
* The selected option's label, `''` while nothing is selected.
|
|
123
|
+
* @returns The label text.
|
|
124
|
+
*/
|
|
125
|
+
getValueLabel(): Promise<string>;
|
|
126
|
+
/**
|
|
127
|
+
* The labels of the options, in order, without the placeholder.
|
|
128
|
+
* @returns The option labels.
|
|
129
|
+
*/
|
|
130
|
+
getOptionLabels(): Promise<string[]>;
|
|
131
|
+
/**
|
|
132
|
+
* Chooses the option with this label, as a user would: the select's `value` becomes that
|
|
133
|
+
* option's value. Throws, leaving the value as it is, for an unknown or disabled option and
|
|
134
|
+
* while the select itself is disabled.
|
|
135
|
+
* @param label The option's label.
|
|
136
|
+
*/
|
|
137
|
+
selectOption(label: string): Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Whether the select is disabled.
|
|
140
|
+
* @returns True when disabled.
|
|
141
|
+
*/
|
|
142
|
+
isDisabled(): Promise<boolean>;
|
|
143
|
+
/**
|
|
144
|
+
* Whether the select is read-only (`aria-readonly`).
|
|
145
|
+
* @returns True when read-only.
|
|
146
|
+
*/
|
|
147
|
+
isReadonly(): Promise<boolean>;
|
|
148
|
+
/**
|
|
149
|
+
* Whether the select is required.
|
|
150
|
+
* @returns True when required.
|
|
151
|
+
*/
|
|
152
|
+
isRequired(): Promise<boolean>;
|
|
153
|
+
/**
|
|
154
|
+
* The error text under the select (an explicit message, or the first form error once touched).
|
|
155
|
+
* @returns The error text, `''` when there is none.
|
|
156
|
+
*/
|
|
157
|
+
getErrorText(): Promise<string>;
|
|
158
|
+
/**
|
|
159
|
+
* The help text under the select; it is hidden while an error shows.
|
|
160
|
+
* @returns The help text, `''` when there is none.
|
|
161
|
+
*/
|
|
162
|
+
getHelpText(): Promise<string>;
|
|
163
|
+
/** Focuses the native select. */
|
|
164
|
+
focus(): Promise<void>;
|
|
165
|
+
/** Blurs the native select, which marks a bound form field touched. */
|
|
166
|
+
blur(): Promise<void>;
|
|
167
|
+
/** Every native option; the placeholder or hidden empty option comes first, empty and disabled. */
|
|
168
|
+
private options;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Harness for `bf-radio-group`. It works by option label, so a test never needs the native radio
|
|
172
|
+
* values (an object option's native value is its index).
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* const plan = await loader.getHarness(BfRadioGroupHarness.with({ label: 'Plan' }));
|
|
176
|
+
* await plan.select('Team');
|
|
177
|
+
* @summary Test harness for the radio group: reads its options and selects one by label
|
|
178
|
+
* @since 0.3.0
|
|
179
|
+
*/
|
|
180
|
+
export declare class BfRadioGroupHarness extends ComponentHarness {
|
|
181
|
+
/** The host element's selector. */
|
|
182
|
+
static hostSelector: string;
|
|
183
|
+
private readonly fieldset;
|
|
184
|
+
private readonly legend;
|
|
185
|
+
private readonly error;
|
|
186
|
+
private readonly radios;
|
|
187
|
+
private readonly labels;
|
|
188
|
+
/**
|
|
189
|
+
* A predicate for a radio group with the given label.
|
|
190
|
+
* @param filters The label (text or pattern) and the CDK's selector and ancestor filters.
|
|
191
|
+
* @returns The predicate for `getHarness()` and friends.
|
|
192
|
+
*/
|
|
193
|
+
static with(filters?: BfHarnessFilters): HarnessPredicate<BfRadioGroupHarness>;
|
|
194
|
+
/**
|
|
195
|
+
* The legend, else the group's `aria-label`.
|
|
196
|
+
* @returns The label text.
|
|
197
|
+
*/
|
|
198
|
+
getLabel(): Promise<string>;
|
|
199
|
+
/**
|
|
200
|
+
* The labels of the options, in order.
|
|
201
|
+
* @returns The option labels.
|
|
202
|
+
*/
|
|
203
|
+
getOptionLabels(): Promise<string[]>;
|
|
204
|
+
/**
|
|
205
|
+
* The selected option's label, `null` while nothing is selected.
|
|
206
|
+
* @returns The label text or `null`.
|
|
207
|
+
*/
|
|
208
|
+
getSelectedLabel(): Promise<string | null>;
|
|
209
|
+
/**
|
|
210
|
+
* Clicks the option with this label, as a user would. Throws for an unknown label, and for a
|
|
211
|
+
* disabled option or group (a user's click would do nothing).
|
|
212
|
+
* @param label The option's label.
|
|
213
|
+
*/
|
|
214
|
+
select(label: string): Promise<void>;
|
|
215
|
+
/**
|
|
216
|
+
* Whether the whole group is disabled.
|
|
217
|
+
* @returns True when disabled.
|
|
218
|
+
*/
|
|
219
|
+
isDisabled(): Promise<boolean>;
|
|
220
|
+
/**
|
|
221
|
+
* The error text under the options.
|
|
222
|
+
* @returns The error text, `''` when there is none.
|
|
223
|
+
*/
|
|
224
|
+
getErrorText(): Promise<string>;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Harness for `bf-segmented`. It works by segment label, so a test never needs the option values.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* const range = await loader.getHarness(BfSegmentedHarness.with({ label: 'Range' }));
|
|
231
|
+
* await range.select('Week');
|
|
232
|
+
* @summary Test harness for the segmented control: reads its segments and selects one
|
|
233
|
+
* @since 0.3.0
|
|
234
|
+
*/
|
|
235
|
+
export declare class BfSegmentedHarness extends ComponentHarness {
|
|
236
|
+
/** The host element's selector. */
|
|
237
|
+
static hostSelector: string;
|
|
238
|
+
private readonly group;
|
|
239
|
+
private readonly error;
|
|
240
|
+
private readonly segments;
|
|
241
|
+
/**
|
|
242
|
+
* A predicate for a segmented control with the given label.
|
|
243
|
+
* @param filters The label (text or pattern) and the CDK's selector and ancestor filters.
|
|
244
|
+
* @returns The predicate for `getHarness()` and friends.
|
|
245
|
+
*/
|
|
246
|
+
static with(filters?: BfHarnessFilters): HarnessPredicate<BfSegmentedHarness>;
|
|
247
|
+
/**
|
|
248
|
+
* The group's accessible name (`label`, else `ariaLabel`); it is not rendered visibly.
|
|
249
|
+
* @returns The label text.
|
|
250
|
+
*/
|
|
251
|
+
getLabel(): Promise<string>;
|
|
252
|
+
/**
|
|
253
|
+
* The labels of the segments, in order.
|
|
254
|
+
* @returns The segment labels.
|
|
255
|
+
*/
|
|
256
|
+
getOptionLabels(): Promise<string[]>;
|
|
257
|
+
/**
|
|
258
|
+
* The selected segment's label, `null` while nothing is selected.
|
|
259
|
+
* @returns The label text or `null`.
|
|
260
|
+
*/
|
|
261
|
+
getSelectedLabel(): Promise<string | null>;
|
|
262
|
+
/**
|
|
263
|
+
* Clicks the segment with this label, as a user would. Throws for an unknown label, and for a
|
|
264
|
+
* disabled segment or control (a user's click would do nothing).
|
|
265
|
+
* @param label The segment's label.
|
|
266
|
+
*/
|
|
267
|
+
select(label: string): Promise<void>;
|
|
268
|
+
/**
|
|
269
|
+
* Whether the control is disabled: every segment is.
|
|
270
|
+
* @returns True when disabled.
|
|
271
|
+
*/
|
|
272
|
+
isDisabled(): Promise<boolean>;
|
|
273
|
+
/**
|
|
274
|
+
* The error text under the track.
|
|
275
|
+
* @returns The error text, `''` when there is none.
|
|
276
|
+
*/
|
|
277
|
+
getErrorText(): Promise<string>;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Harness for `bf-dialog`, the card `BfDialogService` opens (a `confirm()` alert dialog is built
|
|
281
|
+
* from it too). Dialogs render in the CDK overlay container outside the tested component, so get
|
|
282
|
+
* it through `TestbedHarnessEnvironment.documentRootLoader(fixture)`.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* const dialog = await TestbedHarnessEnvironment.documentRootLoader(fixture).getHarness(
|
|
286
|
+
* BfDialogHarness.with({ label: 'Delete project?' }),
|
|
287
|
+
* );
|
|
288
|
+
* await dialog.clickButton('Delete');
|
|
289
|
+
* @summary Test harness for a dialog: its title, text and role, its buttons and Escape
|
|
290
|
+
* @since 0.3.0
|
|
291
|
+
*/
|
|
292
|
+
export declare class BfDialogHarness extends ComponentHarness {
|
|
293
|
+
/** The host element's selector. */
|
|
294
|
+
static hostSelector: string;
|
|
295
|
+
private readonly title;
|
|
296
|
+
private readonly body;
|
|
297
|
+
private readonly closeButton;
|
|
298
|
+
private readonly buttons;
|
|
299
|
+
/**
|
|
300
|
+
* A predicate for a dialog with the given title.
|
|
301
|
+
* @param filters The title (text or pattern) and the CDK's selector and ancestor filters.
|
|
302
|
+
* @returns The predicate for `getHarness()` and friends.
|
|
303
|
+
*/
|
|
304
|
+
static with(filters?: BfHarnessFilters): HarnessPredicate<BfDialogHarness>;
|
|
305
|
+
/**
|
|
306
|
+
* The title heading.
|
|
307
|
+
* @returns The title, `''` without one.
|
|
308
|
+
*/
|
|
309
|
+
getTitle(): Promise<string>;
|
|
310
|
+
/**
|
|
311
|
+
* The text of the dialog's body (its content, without the title and footer).
|
|
312
|
+
* @returns The body text.
|
|
313
|
+
*/
|
|
314
|
+
getText(): Promise<string>;
|
|
315
|
+
/**
|
|
316
|
+
* The role of the overlay panel this dialog sits in: `dialog`, or `alertdialog` for
|
|
317
|
+
* `confirm()` and `role: 'alertdialog'`. The panel is found by the dialog's own
|
|
318
|
+
* `data-bf-dialog-id`, so a dialog under another one (a confirm opened from a dialog) reads its
|
|
319
|
+
* own panel.
|
|
320
|
+
* @returns The role, `null` outside `BfDialogService` (a `bf-dialog` rendered in the page).
|
|
321
|
+
*/
|
|
322
|
+
getRole(): Promise<string | null>;
|
|
323
|
+
/**
|
|
324
|
+
* Clicks the button with this text (a footer or content button). Throws for an unknown label.
|
|
325
|
+
* @param label The button's text.
|
|
326
|
+
*/
|
|
327
|
+
clickButton(label: string): Promise<void>;
|
|
328
|
+
/** Clicks the close button (×), which closes the dialog with no result. Throws without one. */
|
|
329
|
+
close(): Promise<void>;
|
|
330
|
+
/** Presses `Escape` inside the dialog: it closes, or a `confirm()` resolves its cancel answer. */
|
|
331
|
+
pressEscape(): Promise<void>;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Harness for one row of a `bf-menu`: a `bfMenuItem`, `bfMenuItemCheckbox` or `bfMenuItemRadio`
|
|
335
|
+
* button (or `a[bfMenuItem]` link). Its `label` filter matches the row's text.
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* const [first] = await menu.getItems({ label: 'Duplicate' });
|
|
339
|
+
* expect(await first.isDisabled()).toBe(false);
|
|
340
|
+
* @summary Test harness for a menu row: its text, disabled, checked and submenu state
|
|
341
|
+
* @since 0.3.0
|
|
342
|
+
*/
|
|
343
|
+
export declare class BfMenuItemHarness extends ComponentHarness {
|
|
344
|
+
/** The host element's selector: the menu item directives' selectors. */
|
|
345
|
+
static hostSelector: string;
|
|
346
|
+
/**
|
|
347
|
+
* A predicate for a menu item with the given text.
|
|
348
|
+
* @param filters The text (exact or a pattern) and the CDK's selector and ancestor filters.
|
|
349
|
+
* @returns The predicate for `getHarness()` and friends.
|
|
350
|
+
*/
|
|
351
|
+
static with(filters?: BfHarnessFilters): HarnessPredicate<BfMenuItemHarness>;
|
|
352
|
+
/**
|
|
353
|
+
* The row's text.
|
|
354
|
+
* @returns The text.
|
|
355
|
+
*/
|
|
356
|
+
getText(): Promise<string>;
|
|
357
|
+
/**
|
|
358
|
+
* Whether the row is disabled (`aria-disabled`; a disabled row stays focusable).
|
|
359
|
+
* @returns True when disabled.
|
|
360
|
+
*/
|
|
361
|
+
isDisabled(): Promise<boolean>;
|
|
362
|
+
/**
|
|
363
|
+
* Whether a checkbox or radio row is checked.
|
|
364
|
+
* @returns True when checked.
|
|
365
|
+
*/
|
|
366
|
+
isChecked(): Promise<boolean>;
|
|
367
|
+
/**
|
|
368
|
+
* Whether the row opens a submenu.
|
|
369
|
+
* @returns True when it has a submenu.
|
|
370
|
+
*/
|
|
371
|
+
hasSubmenu(): Promise<boolean>;
|
|
372
|
+
/** Clicks the row: runs its action (closing the menu), toggles it, or opens its submenu. */
|
|
373
|
+
click(): Promise<void>;
|
|
374
|
+
/**
|
|
375
|
+
* The submenu this row opened, or `null` while it is closed or when it has none.
|
|
376
|
+
* @returns The submenu's harness or `null`.
|
|
377
|
+
*/
|
|
378
|
+
getSubmenu(): Promise<BfMenuHarness | null>;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Harness for `bf-menu`, the card a `bfMenuTriggerFor` trigger or `bf-menu-button` opens. It
|
|
382
|
+
* renders in the CDK overlay container, so get it from `BfMenuButtonHarness.getMenu()` or through
|
|
383
|
+
* `TestbedHarnessEnvironment.documentRootLoader(fixture)`. Its `label` filter matches the menu's
|
|
384
|
+
* accessible name (its `ariaLabel`, else its trigger's text).
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* const menu = await (await loader.getHarness(BfMenuButtonHarness)).getMenu();
|
|
388
|
+
* await menu.clickItem('Move to', 'Archive');
|
|
389
|
+
* @summary Test harness for a menu: lists its items and clicks one, through submenus
|
|
390
|
+
* @since 0.3.0
|
|
391
|
+
*/
|
|
392
|
+
export declare class BfMenuHarness extends ComponentHarness {
|
|
393
|
+
/** The host element's selector. */
|
|
394
|
+
static hostSelector: string;
|
|
395
|
+
/**
|
|
396
|
+
* A predicate for a menu with the given accessible name.
|
|
397
|
+
* @param filters The name (text or pattern) and the CDK's selector and ancestor filters.
|
|
398
|
+
* @returns The predicate for `getHarness()` and friends.
|
|
399
|
+
*/
|
|
400
|
+
static with(filters?: BfHarnessFilters): HarnessPredicate<BfMenuHarness>;
|
|
401
|
+
/**
|
|
402
|
+
* The menu's accessible name: its `aria-label`, else the text of the element it is labelled
|
|
403
|
+
* by (its trigger).
|
|
404
|
+
* @returns The name, `''` without one.
|
|
405
|
+
*/
|
|
406
|
+
getLabel(): Promise<string>;
|
|
407
|
+
/**
|
|
408
|
+
* The menu's rows, in order (a submenu's rows belong to the submenu).
|
|
409
|
+
* @param filter Only the rows matching it, e.g. `{ label: 'Archive' }`.
|
|
410
|
+
* @returns The row harnesses.
|
|
411
|
+
*/
|
|
412
|
+
getItems(filter?: BfHarnessFilters): Promise<BfMenuItemHarness[]>;
|
|
413
|
+
/**
|
|
414
|
+
* Clicks the row with this text; with a `submenuPath`, the row opens a submenu and the path's
|
|
415
|
+
* labels are clicked in the submenus that open, in order. Throws for an unknown label.
|
|
416
|
+
* @param label The row's text.
|
|
417
|
+
* @param submenuPath The labels to click in the submenus that open, in order.
|
|
418
|
+
*/
|
|
419
|
+
clickItem(label: string, ...submenuPath: string[]): Promise<void>;
|
|
420
|
+
}
|
|
421
|
+
/** The `bf-menu` with this id in the document, or `null`. Internal. */
|
|
422
|
+
declare function menuById(root: LocatorFactory, id: string): Promise<BfMenuHarness | null>;
|
|
423
|
+
/**
|
|
424
|
+
* Harness for `bf-menu-button`, a button that opens a `bf-menu`. Its `label` filter matches the
|
|
425
|
+
* button's accessible name (its `label`, else its text).
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* const button = await loader.getHarness(BfMenuButtonHarness.with({ label: 'Actions' }));
|
|
429
|
+
* await (await button.getMenu()).clickItem('Archive');
|
|
430
|
+
* @summary Test harness for a menu button: opens it and hands out the menu it opened
|
|
431
|
+
* @since 0.3.0
|
|
432
|
+
*/
|
|
433
|
+
export declare class BfMenuButtonHarness extends ComponentHarness {
|
|
434
|
+
/** The host element's selector. */
|
|
435
|
+
static hostSelector: string;
|
|
436
|
+
private readonly button;
|
|
437
|
+
/**
|
|
438
|
+
* A predicate for a menu button with the given accessible name.
|
|
439
|
+
* @param filters The name (text or pattern) and the CDK's selector and ancestor filters.
|
|
440
|
+
* @returns The predicate for `getHarness()` and friends.
|
|
441
|
+
*/
|
|
442
|
+
static with(filters?: BfHarnessFilters): HarnessPredicate<BfMenuButtonHarness>;
|
|
443
|
+
/**
|
|
444
|
+
* The button's accessible name: its `aria-label` (the `label` input), else its text.
|
|
445
|
+
* @returns The name.
|
|
446
|
+
*/
|
|
447
|
+
getLabel(): Promise<string>;
|
|
448
|
+
/** Opens the menu with a click; does nothing while it is open. */
|
|
449
|
+
open(): Promise<void>;
|
|
450
|
+
/**
|
|
451
|
+
* Whether the menu is open (`aria-expanded`).
|
|
452
|
+
* @returns True while open.
|
|
453
|
+
*/
|
|
454
|
+
isOpen(): Promise<boolean>;
|
|
455
|
+
/**
|
|
456
|
+
* The open menu, opening it first when it is closed.
|
|
457
|
+
* @returns The menu's harness.
|
|
458
|
+
*/
|
|
459
|
+
getMenu(): Promise<BfMenuHarness>;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Harness for `bf-desktop-toast`, the card `BfDesktopToastService.show()` renders. Toasts render
|
|
463
|
+
* in the CDK overlay container, so get it through
|
|
464
|
+
* `TestbedHarnessEnvironment.documentRootLoader(fixture)`.
|
|
465
|
+
*
|
|
466
|
+
* @example
|
|
467
|
+
* const toast = await TestbedHarnessEnvironment.documentRootLoader(fixture).getHarness(
|
|
468
|
+
* BfDesktopToastHarness,
|
|
469
|
+
* );
|
|
470
|
+
* await toast.clickAction();
|
|
471
|
+
* @summary Test harness for a desktop toast: its message, its action and Escape
|
|
472
|
+
* @since 0.3.0
|
|
473
|
+
*/
|
|
474
|
+
export declare class BfDesktopToastHarness extends ComponentHarness {
|
|
475
|
+
/** The host element's selector. */
|
|
476
|
+
static hostSelector: string;
|
|
477
|
+
private readonly message;
|
|
478
|
+
private readonly action;
|
|
479
|
+
/**
|
|
480
|
+
* A predicate for a toast with the given message.
|
|
481
|
+
* @param filters The message (text or pattern) and the CDK's selector and ancestor filters.
|
|
482
|
+
* @returns The predicate for `getHarness()` and friends.
|
|
483
|
+
*/
|
|
484
|
+
static with(filters?: BfHarnessFilters): HarnessPredicate<BfDesktopToastHarness>;
|
|
485
|
+
/**
|
|
486
|
+
* The toast's message.
|
|
487
|
+
* @returns The message text.
|
|
488
|
+
*/
|
|
489
|
+
getMessage(): Promise<string>;
|
|
490
|
+
/** Clicks the action button, which dismisses the toast with `'action'`. Throws without one. */
|
|
491
|
+
clickAction(): Promise<void>;
|
|
492
|
+
/** Presses `Escape` inside the toast, which dismisses it with `'dismiss'`. */
|
|
493
|
+
pressEscape(): Promise<void>;
|
|
494
|
+
}
|
|
495
|
+
export type { BfHarnessFilters, BfJsdomShimOptions, BfTestingOptions };
|