{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/legacy-slide-toggle/testing/slide-toggle-harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {HarnessPredicate} from '@angular/cdk/testing';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n _MatSlideToggleHarnessBase,\n SlideToggleHarnessFilters,\n} from '@angular/material/slide-toggle/testing';\n\n/**\n * Harness for interacting with a standard mat-slide-toggle in tests.\n * @deprecated Use `MatSlideToggleHarness` from `@angular/material/slide-toggle/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\nexport class MatLegacySlideToggleHarness extends _MatSlideToggleHarnessBase {\n private _inputContainer = this.locatorFor('.mat-slide-toggle-bar');\n protected _nativeElement = this.locatorFor('input');\n\n /** The selector for the host element of a `MatSlideToggle` instance. */\n static hostSelector = '.mat-slide-toggle';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatSlideToggleHarness` that meets\n * certain criteria.\n * @param options Options for filtering which slide toggle instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(\n options: SlideToggleHarnessFilters = {},\n ): HarnessPredicate {\n return (\n new HarnessPredicate(MatLegacySlideToggleHarness, options)\n .addOption('label', options.label, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getLabelText(), label),\n )\n // We want to provide a filter option for \"name\" because the name of the slide-toggle is\n // only set on the underlying input. This means that it's not possible for developers\n // to retrieve the harness of a specific checkbox with name through a CSS selector.\n .addOption(\n 'name',\n options.name,\n async (harness, name) => (await harness.getName()) === name,\n )\n .addOption(\n 'checked',\n options.checked,\n async (harness, checked) => (await harness.isChecked()) == checked,\n )\n .addOption(\n 'disabled',\n options.disabled,\n async (harness, disabled) => (await harness.isDisabled()) == disabled,\n )\n );\n }\n\n /** Toggle the checked state of the slide-toggle. */\n async toggle(): Promise {\n return (await this._inputContainer()).click();\n }\n\n /** Whether the slide-toggle is checked. */\n async isChecked(): Promise {\n const checked = (await this._nativeElement()).getProperty('checked');\n return coerceBooleanProperty(await checked);\n }\n}\n"],"names":[],"mappings":";;;;;AAeA;;;;AAIG;AACG,MAAO,2BAA4B,SAAQ,0BAA0B,CAAA;AAA3E,IAAA,WAAA,GAAA;;AACU,QAAA,IAAA,CAAA,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;AACzD,QAAA,IAAA,CAAA,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;KAkDrD;;aA/CQ,IAAY,CAAA,YAAA,GAAG,mBAAH,CAAuB,EAAA;AAE1C;;;;;AAKG;AACH,IAAA,OAAO,IAAI,CACT,OAAA,GAAqC,EAAE,EAAA;AAEvC,QAAA,QACE,IAAI,gBAAgB,CAAC,2BAA2B,EAAE,OAAO,CAAC;aACvD,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,KAChD,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,KAAK,CAAC,CAC9D;;;;aAIA,SAAS,CACR,MAAM,EACN,OAAO,CAAC,IAAI,EACZ,OAAO,OAAO,EAAE,IAAI,KAAK,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,CAC5D;aACA,SAAS,CACR,SAAS,EACT,OAAO,CAAC,OAAO,EACf,OAAO,OAAO,EAAE,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC,SAAS,EAAE,KAAK,OAAO,CACnE;aACA,SAAS,CACR,UAAU,EACV,OAAO,CAAC,QAAQ,EAChB,OAAO,OAAO,EAAE,QAAQ,KAAK,CAAC,MAAM,OAAO,CAAC,UAAU,EAAE,KAAK,QAAQ,CACtE,EACH;KACH;;AAGD,IAAA,MAAM,MAAM,GAAA;QACV,OAAO,CAAC,MAAM,IAAI,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,CAAC;KAC/C;;AAGD,IAAA,MAAM,SAAS,GAAA;AACb,QAAA,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,EAAE,WAAW,CAAU,SAAS,CAAC,CAAC;AAC9E,QAAA,OAAO,qBAAqB,CAAC,MAAM,OAAO,CAAC,CAAC;KAC7C;;;;;"}