[6a3a178] | 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 | */
|
---|
| 8 | import { __awaiter } from "tslib";
|
---|
| 9 | import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
---|
| 10 | import { ComponentHarness, HarnessPredicate, } from '@angular/cdk/testing';
|
---|
| 11 | export class _MatRadioGroupHarnessBase extends ComponentHarness {
|
---|
| 12 | /** Gets the name of the radio-group. */
|
---|
| 13 | getName() {
|
---|
| 14 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 15 | const hostName = yield this._getGroupNameFromHost();
|
---|
| 16 | // It's not possible to always determine the "name" of a radio-group by reading
|
---|
| 17 | // the attribute. This is because the radio-group does not set the "name" as an
|
---|
| 18 | // element attribute if the "name" value is set through a binding.
|
---|
| 19 | if (hostName !== null) {
|
---|
| 20 | return hostName;
|
---|
| 21 | }
|
---|
| 22 | // In case we couldn't determine the "name" of a radio-group by reading the
|
---|
| 23 | // "name" attribute, we try to determine the "name" of the group by going
|
---|
| 24 | // through all radio buttons.
|
---|
| 25 | const radioNames = yield this._getNamesFromRadioButtons();
|
---|
| 26 | if (!radioNames.length) {
|
---|
| 27 | return null;
|
---|
| 28 | }
|
---|
| 29 | if (!this._checkRadioNamesInGroupEqual(radioNames)) {
|
---|
| 30 | throw Error('Radio buttons in radio-group have mismatching names.');
|
---|
| 31 | }
|
---|
| 32 | return radioNames[0];
|
---|
| 33 | });
|
---|
| 34 | }
|
---|
| 35 | /** Gets the id of the radio-group. */
|
---|
| 36 | getId() {
|
---|
| 37 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 38 | return (yield this.host()).getProperty('id');
|
---|
| 39 | });
|
---|
| 40 | }
|
---|
| 41 | /** Gets the checked radio-button in a radio-group. */
|
---|
| 42 | getCheckedRadioButton() {
|
---|
| 43 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 44 | for (let radioButton of yield this.getRadioButtons()) {
|
---|
| 45 | if (yield radioButton.isChecked()) {
|
---|
| 46 | return radioButton;
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
| 49 | return null;
|
---|
| 50 | });
|
---|
| 51 | }
|
---|
| 52 | /** Gets the checked value of the radio-group. */
|
---|
| 53 | getCheckedValue() {
|
---|
| 54 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 55 | const checkedRadio = yield this.getCheckedRadioButton();
|
---|
| 56 | if (!checkedRadio) {
|
---|
| 57 | return null;
|
---|
| 58 | }
|
---|
| 59 | return checkedRadio.getValue();
|
---|
| 60 | });
|
---|
| 61 | }
|
---|
| 62 | /**
|
---|
| 63 | * Gets a list of radio buttons which are part of the radio-group.
|
---|
| 64 | * @param filter Optionally filters which radio buttons are included.
|
---|
| 65 | */
|
---|
| 66 | getRadioButtons(filter) {
|
---|
| 67 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 68 | return this.locatorForAll(this._buttonClass.with(filter))();
|
---|
| 69 | });
|
---|
| 70 | }
|
---|
| 71 | /**
|
---|
| 72 | * Checks a radio button in this group.
|
---|
| 73 | * @param filter An optional filter to apply to the child radio buttons. The first tab matching
|
---|
| 74 | * the filter will be selected.
|
---|
| 75 | */
|
---|
| 76 | checkRadioButton(filter) {
|
---|
| 77 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 78 | const radioButtons = yield this.getRadioButtons(filter);
|
---|
| 79 | if (!radioButtons.length) {
|
---|
| 80 | throw Error(`Could not find radio button matching ${JSON.stringify(filter)}`);
|
---|
| 81 | }
|
---|
| 82 | return radioButtons[0].check();
|
---|
| 83 | });
|
---|
| 84 | }
|
---|
| 85 | /** Gets the name attribute of the host element. */
|
---|
| 86 | _getGroupNameFromHost() {
|
---|
| 87 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 88 | return (yield this.host()).getAttribute('name');
|
---|
| 89 | });
|
---|
| 90 | }
|
---|
| 91 | /** Gets a list of the name attributes of all child radio buttons. */
|
---|
| 92 | _getNamesFromRadioButtons() {
|
---|
| 93 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 94 | const groupNames = [];
|
---|
| 95 | for (let radio of yield this.getRadioButtons()) {
|
---|
| 96 | const radioName = yield radio.getName();
|
---|
| 97 | if (radioName !== null) {
|
---|
| 98 | groupNames.push(radioName);
|
---|
| 99 | }
|
---|
| 100 | }
|
---|
| 101 | return groupNames;
|
---|
| 102 | });
|
---|
| 103 | }
|
---|
| 104 | /** Checks if the specified radio names are all equal. */
|
---|
| 105 | _checkRadioNamesInGroupEqual(radioNames) {
|
---|
| 106 | let groupName = null;
|
---|
| 107 | for (let radioName of radioNames) {
|
---|
| 108 | if (groupName === null) {
|
---|
| 109 | groupName = radioName;
|
---|
| 110 | }
|
---|
| 111 | else if (groupName !== radioName) {
|
---|
| 112 | return false;
|
---|
| 113 | }
|
---|
| 114 | }
|
---|
| 115 | return true;
|
---|
| 116 | }
|
---|
| 117 | /**
|
---|
| 118 | * Checks if a radio-group harness has the given name. Throws if a radio-group with
|
---|
| 119 | * matching name could be found but has mismatching radio-button names.
|
---|
| 120 | */
|
---|
| 121 | static _checkRadioGroupName(harness, name) {
|
---|
| 122 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 123 | // Check if there is a radio-group which has the "name" attribute set
|
---|
| 124 | // to the expected group name. It's not possible to always determine
|
---|
| 125 | // the "name" of a radio-group by reading the attribute. This is because
|
---|
| 126 | // the radio-group does not set the "name" as an element attribute if the
|
---|
| 127 | // "name" value is set through a binding.
|
---|
| 128 | if ((yield harness._getGroupNameFromHost()) === name) {
|
---|
| 129 | return true;
|
---|
| 130 | }
|
---|
| 131 | // Check if there is a group with radio-buttons that all have the same
|
---|
| 132 | // expected name. This implies that the group has the given name. It's
|
---|
| 133 | // not possible to always determine the name of a radio-group through
|
---|
| 134 | // the attribute because there is
|
---|
| 135 | const radioNames = yield harness._getNamesFromRadioButtons();
|
---|
| 136 | if (radioNames.indexOf(name) === -1) {
|
---|
| 137 | return false;
|
---|
| 138 | }
|
---|
| 139 | if (!harness._checkRadioNamesInGroupEqual(radioNames)) {
|
---|
| 140 | throw Error(`The locator found a radio-group with name "${name}", but some ` +
|
---|
| 141 | `radio-button's within the group have mismatching names, which is invalid.`);
|
---|
| 142 | }
|
---|
| 143 | return true;
|
---|
| 144 | });
|
---|
| 145 | }
|
---|
| 146 | }
|
---|
| 147 | /** Harness for interacting with a standard mat-radio-group in tests. */
|
---|
| 148 | export class MatRadioGroupHarness extends _MatRadioGroupHarnessBase {
|
---|
| 149 | constructor() {
|
---|
| 150 | super(...arguments);
|
---|
| 151 | this._buttonClass = MatRadioButtonHarness;
|
---|
| 152 | }
|
---|
| 153 | /**
|
---|
| 154 | * Gets a `HarnessPredicate` that can be used to search for a `MatRadioGroupHarness` that meets
|
---|
| 155 | * certain criteria.
|
---|
| 156 | * @param options Options for filtering which radio group instances are considered a match.
|
---|
| 157 | * @return a `HarnessPredicate` configured with the given options.
|
---|
| 158 | */
|
---|
| 159 | static with(options = {}) {
|
---|
| 160 | return new HarnessPredicate(MatRadioGroupHarness, options)
|
---|
| 161 | .addOption('name', options.name, this._checkRadioGroupName);
|
---|
| 162 | }
|
---|
| 163 | }
|
---|
| 164 | /** The selector for the host element of a `MatRadioGroup` instance. */
|
---|
| 165 | MatRadioGroupHarness.hostSelector = '.mat-radio-group';
|
---|
| 166 | export class _MatRadioButtonHarnessBase extends ComponentHarness {
|
---|
| 167 | constructor() {
|
---|
| 168 | super(...arguments);
|
---|
| 169 | this._input = this.locatorFor('input');
|
---|
| 170 | }
|
---|
| 171 | /** Whether the radio-button is checked. */
|
---|
| 172 | isChecked() {
|
---|
| 173 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 174 | const checked = (yield this._input()).getProperty('checked');
|
---|
| 175 | return coerceBooleanProperty(yield checked);
|
---|
| 176 | });
|
---|
| 177 | }
|
---|
| 178 | /** Whether the radio-button is disabled. */
|
---|
| 179 | isDisabled() {
|
---|
| 180 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 181 | const disabled = (yield this._input()).getAttribute('disabled');
|
---|
| 182 | return coerceBooleanProperty(yield disabled);
|
---|
| 183 | });
|
---|
| 184 | }
|
---|
| 185 | /** Whether the radio-button is required. */
|
---|
| 186 | isRequired() {
|
---|
| 187 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 188 | const required = (yield this._input()).getAttribute('required');
|
---|
| 189 | return coerceBooleanProperty(yield required);
|
---|
| 190 | });
|
---|
| 191 | }
|
---|
| 192 | /** Gets the radio-button's name. */
|
---|
| 193 | getName() {
|
---|
| 194 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 195 | return (yield this._input()).getAttribute('name');
|
---|
| 196 | });
|
---|
| 197 | }
|
---|
| 198 | /** Gets the radio-button's id. */
|
---|
| 199 | getId() {
|
---|
| 200 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 201 | return (yield this.host()).getProperty('id');
|
---|
| 202 | });
|
---|
| 203 | }
|
---|
| 204 | /**
|
---|
| 205 | * Gets the value of the radio-button. The radio-button value will be converted to a string.
|
---|
| 206 | *
|
---|
| 207 | * Note: This means that for radio-button's with an object as a value `[object Object]` is
|
---|
| 208 | * intentionally returned.
|
---|
| 209 | */
|
---|
| 210 | getValue() {
|
---|
| 211 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 212 | return (yield this._input()).getProperty('value');
|
---|
| 213 | });
|
---|
| 214 | }
|
---|
| 215 | /** Gets the radio-button's label text. */
|
---|
| 216 | getLabelText() {
|
---|
| 217 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 218 | return (yield this._textLabel()).text();
|
---|
| 219 | });
|
---|
| 220 | }
|
---|
| 221 | /** Focuses the radio-button. */
|
---|
| 222 | focus() {
|
---|
| 223 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 224 | return (yield this._input()).focus();
|
---|
| 225 | });
|
---|
| 226 | }
|
---|
| 227 | /** Blurs the radio-button. */
|
---|
| 228 | blur() {
|
---|
| 229 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 230 | return (yield this._input()).blur();
|
---|
| 231 | });
|
---|
| 232 | }
|
---|
| 233 | /** Whether the radio-button is focused. */
|
---|
| 234 | isFocused() {
|
---|
| 235 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 236 | return (yield this._input()).isFocused();
|
---|
| 237 | });
|
---|
| 238 | }
|
---|
| 239 | /**
|
---|
| 240 | * Puts the radio-button in a checked state by clicking it if it is currently unchecked,
|
---|
| 241 | * or doing nothing if it is already checked.
|
---|
| 242 | */
|
---|
| 243 | check() {
|
---|
| 244 | return __awaiter(this, void 0, void 0, function* () {
|
---|
| 245 | if (!(yield this.isChecked())) {
|
---|
| 246 | return (yield this._clickLabel()).click();
|
---|
| 247 | }
|
---|
| 248 | });
|
---|
| 249 | }
|
---|
| 250 | }
|
---|
| 251 | /** Harness for interacting with a standard mat-radio-button in tests. */
|
---|
| 252 | export class MatRadioButtonHarness extends _MatRadioButtonHarnessBase {
|
---|
| 253 | constructor() {
|
---|
| 254 | super(...arguments);
|
---|
| 255 | this._textLabel = this.locatorFor('.mat-radio-label-content');
|
---|
| 256 | this._clickLabel = this.locatorFor('.mat-radio-label');
|
---|
| 257 | }
|
---|
| 258 | /**
|
---|
| 259 | * Gets a `HarnessPredicate` that can be used to search for a `MatRadioButtonHarness` that meets
|
---|
| 260 | * certain criteria.
|
---|
| 261 | * @param options Options for filtering which radio button instances are considered a match.
|
---|
| 262 | * @return a `HarnessPredicate` configured with the given options.
|
---|
| 263 | */
|
---|
| 264 | static with(options = {}) {
|
---|
| 265 | return new HarnessPredicate(MatRadioButtonHarness, options)
|
---|
| 266 | .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabelText(), label))
|
---|
| 267 | .addOption('name', options.name, (harness, name) => __awaiter(this, void 0, void 0, function* () { return (yield harness.getName()) === name; }));
|
---|
| 268 | }
|
---|
| 269 | }
|
---|
| 270 | /** The selector for the host element of a `MatRadioButton` instance. */
|
---|
| 271 | MatRadioButtonHarness.hostSelector = '.mat-radio-button';
|
---|
| 272 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmFkaW8taGFybmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9yYWRpby90ZXN0aW5nL3JhZGlvLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOztBQUVILE9BQU8sRUFBQyxxQkFBcUIsRUFBQyxNQUFNLHVCQUF1QixDQUFDO0FBQzVELE9BQU8sRUFHTCxnQkFBZ0IsRUFFaEIsZ0JBQWdCLEdBRWpCLE1BQU0sc0JBQXNCLENBQUM7QUFHOUIsTUFBTSxPQUFnQix5QkFRcEIsU0FBUSxnQkFBZ0I7SUFHeEIsd0NBQXdDO0lBQ2xDLE9BQU87O1lBQ1gsTUFBTSxRQUFRLEdBQUcsTUFBTSxJQUFJLENBQUMscUJBQXFCLEVBQUUsQ0FBQztZQUNwRCwrRUFBK0U7WUFDL0UsK0VBQStFO1lBQy9FLGtFQUFrRTtZQUNsRSxJQUFJLFFBQVEsS0FBSyxJQUFJLEVBQUU7Z0JBQ3JCLE9BQU8sUUFBUSxDQUFDO2FBQ2pCO1lBQ0QsMkVBQTJFO1lBQzNFLHlFQUF5RTtZQUN6RSw2QkFBNkI7WUFDN0IsTUFBTSxVQUFVLEdBQUcsTUFBTSxJQUFJLENBQUMseUJBQXlCLEVBQUUsQ0FBQztZQUMxRCxJQUFJLENBQUMsVUFBVSxDQUFDLE1BQU0sRUFBRTtnQkFDdEIsT0FBTyxJQUFJLENBQUM7YUFDYjtZQUNELElBQUksQ0FBQyxJQUFJLENBQUMsNEJBQTRCLENBQUMsVUFBVSxDQUFDLEVBQUU7Z0JBQ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