source: trip-planner-front/node_modules/@angular/material/radio/testing/radio-harness.d.ts@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { AsyncFactoryFn, BaseHarnessFilters, ComponentHarness, ComponentHarnessConstructor, HarnessPredicate, TestElement } from '@angular/cdk/testing';
9import { RadioButtonHarnessFilters, RadioGroupHarnessFilters } from './radio-harness-filters';
10export declare abstract class _MatRadioGroupHarnessBase<ButtonType extends (ComponentHarnessConstructor<Button> & {
11 with: (options?: ButtonFilters) => HarnessPredicate<Button>;
12}), Button extends ComponentHarness & {
13 isChecked(): Promise<boolean>;
14 getValue(): Promise<string | null>;
15 getName(): Promise<string | null>;
16 check(): Promise<void>;
17}, ButtonFilters extends BaseHarnessFilters> extends ComponentHarness {
18 protected abstract _buttonClass: ButtonType;
19 /** Gets the name of the radio-group. */
20 getName(): Promise<string | null>;
21 /** Gets the id of the radio-group. */
22 getId(): Promise<string | null>;
23 /** Gets the checked radio-button in a radio-group. */
24 getCheckedRadioButton(): Promise<Button | null>;
25 /** Gets the checked value of the radio-group. */
26 getCheckedValue(): Promise<string | null>;
27 /**
28 * Gets a list of radio buttons which are part of the radio-group.
29 * @param filter Optionally filters which radio buttons are included.
30 */
31 getRadioButtons(filter?: ButtonFilters): Promise<Button[]>;
32 /**
33 * Checks a radio button in this group.
34 * @param filter An optional filter to apply to the child radio buttons. The first tab matching
35 * the filter will be selected.
36 */
37 checkRadioButton(filter?: ButtonFilters): Promise<void>;
38 /** Gets the name attribute of the host element. */
39 private _getGroupNameFromHost;
40 /** Gets a list of the name attributes of all child radio buttons. */
41 private _getNamesFromRadioButtons;
42 /** Checks if the specified radio names are all equal. */
43 private _checkRadioNamesInGroupEqual;
44 /**
45 * Checks if a radio-group harness has the given name. Throws if a radio-group with
46 * matching name could be found but has mismatching radio-button names.
47 */
48 protected static _checkRadioGroupName(harness: _MatRadioGroupHarnessBase<any, any, any>, name: string): Promise<boolean>;
49}
50/** Harness for interacting with a standard mat-radio-group in tests. */
51export declare class MatRadioGroupHarness extends _MatRadioGroupHarnessBase<typeof MatRadioButtonHarness, MatRadioButtonHarness, RadioButtonHarnessFilters> {
52 /** The selector for the host element of a `MatRadioGroup` instance. */
53 static hostSelector: string;
54 protected _buttonClass: typeof MatRadioButtonHarness;
55 /**
56 * Gets a `HarnessPredicate` that can be used to search for a `MatRadioGroupHarness` that meets
57 * certain criteria.
58 * @param options Options for filtering which radio group instances are considered a match.
59 * @return a `HarnessPredicate` configured with the given options.
60 */
61 static with(options?: RadioGroupHarnessFilters): HarnessPredicate<MatRadioGroupHarness>;
62}
63export declare abstract class _MatRadioButtonHarnessBase extends ComponentHarness {
64 protected abstract _textLabel: AsyncFactoryFn<TestElement>;
65 protected abstract _clickLabel: AsyncFactoryFn<TestElement>;
66 private _input;
67 /** Whether the radio-button is checked. */
68 isChecked(): Promise<boolean>;
69 /** Whether the radio-button is disabled. */
70 isDisabled(): Promise<boolean>;
71 /** Whether the radio-button is required. */
72 isRequired(): Promise<boolean>;
73 /** Gets the radio-button's name. */
74 getName(): Promise<string | null>;
75 /** Gets the radio-button's id. */
76 getId(): Promise<string | null>;
77 /**
78 * Gets the value of the radio-button. The radio-button value will be converted to a string.
79 *
80 * Note: This means that for radio-button's with an object as a value `[object Object]` is
81 * intentionally returned.
82 */
83 getValue(): Promise<string | null>;
84 /** Gets the radio-button's label text. */
85 getLabelText(): Promise<string>;
86 /** Focuses the radio-button. */
87 focus(): Promise<void>;
88 /** Blurs the radio-button. */
89 blur(): Promise<void>;
90 /** Whether the radio-button is focused. */
91 isFocused(): Promise<boolean>;
92 /**
93 * Puts the radio-button in a checked state by clicking it if it is currently unchecked,
94 * or doing nothing if it is already checked.
95 */
96 check(): Promise<void>;
97}
98/** Harness for interacting with a standard mat-radio-button in tests. */
99export declare class MatRadioButtonHarness extends _MatRadioButtonHarnessBase {
100 /** The selector for the host element of a `MatRadioButton` instance. */
101 static hostSelector: string;
102 /**
103 * Gets a `HarnessPredicate` that can be used to search for a `MatRadioButtonHarness` that meets
104 * certain criteria.
105 * @param options Options for filtering which radio button instances are considered a match.
106 * @return a `HarnessPredicate` configured with the given options.
107 */
108 static with(options?: RadioButtonHarnessFilters): HarnessPredicate<MatRadioButtonHarness>;
109 protected _textLabel: AsyncFactoryFn<TestElement>;
110 protected _clickLabel: AsyncFactoryFn<TestElement>;
111}
Note: See TracBrowser for help on using the repository browser.