@angular/material
Version:
Angular Material
1 lines • 13.9 kB
Source Map (JSON)
{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/sidenav/testing/drawer-harness.ts","../../../../../../../src/material/sidenav/testing/drawer-content-harness.ts","../../../../../../../src/material/sidenav/testing/drawer-container-harness.ts","../../../../../../../src/material/sidenav/testing/sidenav-content-harness.ts","../../../../../../../src/material/sidenav/testing/sidenav-harness.ts","../../../../../../../src/material/sidenav/testing/sidenav-container-harness.ts","../../../../../../../src/material/sidenav/testing/public-api.ts","../../../../../../../src/material/sidenav/testing/index.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 {ContentContainerComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {DrawerHarnessFilters} from './drawer-harness-filters';\n\n/**\n * Base class for the drawer harness functionality.\n * @docs-private\n */\nexport class MatDrawerHarnessBase extends ContentContainerComponentHarness<string> {\n /** Whether the drawer is open. */\n async isOpen(): Promise<boolean> {\n return (await this.host()).hasClass('mat-drawer-opened');\n }\n\n /** Gets the position of the drawer inside its container. */\n async getPosition(): Promise<'start' | 'end'> {\n const host = await this.host();\n return (await host.hasClass('mat-drawer-end')) ? 'end' : 'start';\n }\n\n /** Gets the mode that the drawer is in. */\n async getMode(): Promise<'over' | 'push' | 'side'> {\n const host = await this.host();\n\n if (await host.hasClass('mat-drawer-push')) {\n return 'push';\n }\n\n if (await host.hasClass('mat-drawer-side')) {\n return 'side';\n }\n\n return 'over';\n }\n}\n\n/** Harness for interacting with a standard mat-drawer in tests. */\nexport class MatDrawerHarness extends MatDrawerHarnessBase {\n /** The selector for the host element of a `MatDrawer` instance. */\n static hostSelector = '.mat-drawer';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatDrawerHarness` that meets\n * certain criteria.\n * @param options Options for filtering which drawer instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: DrawerHarnessFilters = {}): HarnessPredicate<MatDrawerHarness> {\n return new HarnessPredicate(MatDrawerHarness, options).addOption(\n 'position',\n options.position,\n async (harness, position) => (await harness.getPosition()) === position,\n );\n }\n}\n","/**\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 {ContentContainerComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {DrawerContentHarnessFilters} from './drawer-harness-filters';\n\n/** Harness for interacting with a standard mat-drawer-content in tests. */\nexport class MatDrawerContentHarness extends ContentContainerComponentHarness<string> {\n /** The selector for the host element of a `MatDrawerContent` instance. */\n static hostSelector = '.mat-drawer-content';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatDrawerContentHarness` that\n * meets certain criteria.\n * @param options Options for filtering which drawer content instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(\n options: DrawerContentHarnessFilters = {},\n ): HarnessPredicate<MatDrawerContentHarness> {\n return new HarnessPredicate(MatDrawerContentHarness, options);\n }\n}\n","/**\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 {ContentContainerComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {DrawerContainerHarnessFilters, DrawerHarnessFilters} from './drawer-harness-filters';\nimport {MatDrawerContentHarness} from './drawer-content-harness';\nimport {MatDrawerHarness} from './drawer-harness';\n\n/** Harness for interacting with a standard mat-drawer-container in tests. */\nexport class MatDrawerContainerHarness extends ContentContainerComponentHarness<string> {\n /** The selector for the host element of a `MatDrawerContainer` instance. */\n static hostSelector = '.mat-drawer-container';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatDrawerContainerHarness` that\n * meets certain criteria.\n * @param options Options for filtering which container instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(\n options: DrawerContainerHarnessFilters = {},\n ): HarnessPredicate<MatDrawerContainerHarness> {\n return new HarnessPredicate(MatDrawerContainerHarness, options);\n }\n\n /**\n * Gets drawers that match particular criteria within the container.\n * @param filter Optionally filters which chips are included.\n */\n async getDrawers(filter: DrawerHarnessFilters = {}): Promise<MatDrawerHarness[]> {\n return this.locatorForAll(MatDrawerHarness.with(filter))();\n }\n\n /** Gets the element that has the container's content. */\n async getContent(): Promise<MatDrawerContentHarness> {\n return this.locatorFor(MatDrawerContentHarness)();\n }\n}\n","/**\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 {ContentContainerComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {DrawerContentHarnessFilters} from './drawer-harness-filters';\n\n/** Harness for interacting with a standard mat-sidenav-content in tests. */\nexport class MatSidenavContentHarness extends ContentContainerComponentHarness<string> {\n /** The selector for the host element of a `MatSidenavContent` instance. */\n static hostSelector = '.mat-sidenav-content';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatSidenavContentHarness` that\n * meets certain criteria.\n * @param options Options for filtering which sidenav content instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(\n options: DrawerContentHarnessFilters = {},\n ): HarnessPredicate<MatSidenavContentHarness> {\n return new HarnessPredicate(MatSidenavContentHarness, options);\n }\n}\n","/**\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 {MatDrawerHarnessBase} from './drawer-harness';\nimport {DrawerHarnessFilters} from './drawer-harness-filters';\n\n/** Harness for interacting with a standard mat-sidenav in tests. */\nexport class MatSidenavHarness extends MatDrawerHarnessBase {\n /** The selector for the host element of a `MatSidenav` instance. */\n static hostSelector = '.mat-sidenav';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatSidenavHarness` that meets\n * certain criteria.\n * @param options Options for filtering which sidenav instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: DrawerHarnessFilters = {}): HarnessPredicate<MatSidenavHarness> {\n return new HarnessPredicate(MatSidenavHarness, options).addOption(\n 'position',\n options.position,\n async (harness, position) => (await harness.getPosition()) === position,\n );\n }\n\n /** Whether the sidenav is fixed in the viewport. */\n async isFixedInViewport(): Promise<boolean> {\n return (await this.host()).hasClass('mat-sidenav-fixed');\n }\n}\n","/**\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 {ContentContainerComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {DrawerContainerHarnessFilters, DrawerHarnessFilters} from './drawer-harness-filters';\nimport {MatSidenavContentHarness} from './sidenav-content-harness';\nimport {MatSidenavHarness} from './sidenav-harness';\n\n/** Harness for interacting with a standard mat-sidenav-container in tests. */\nexport class MatSidenavContainerHarness extends ContentContainerComponentHarness<string> {\n /** The selector for the host element of a `MatSidenavContainer` instance. */\n static hostSelector = '.mat-sidenav-container';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatSidenavContainerHarness` that\n * meets certain criteria.\n * @param options Options for filtering which container instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(\n options: DrawerContainerHarnessFilters = {},\n ): HarnessPredicate<MatSidenavContainerHarness> {\n return new HarnessPredicate(MatSidenavContainerHarness, options);\n }\n\n /**\n * Gets sidenavs that match particular criteria within the container.\n * @param filter Optionally filters which chips are included.\n */\n async getSidenavs(filter: DrawerHarnessFilters = {}): Promise<MatSidenavHarness[]> {\n return this.locatorForAll(MatSidenavHarness.with(filter))();\n }\n\n /** Gets the element that has the container's content. */\n async getContent(): Promise<MatSidenavContentHarness> {\n return this.locatorFor(MatSidenavContentHarness)();\n }\n}\n","/**\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\nexport {MatDrawerHarness} from './drawer-harness';\nexport * from './drawer-container-harness';\nexport * from './drawer-content-harness';\nexport * from './drawer-harness-filters';\nexport * from './sidenav-container-harness';\nexport * from './sidenav-content-harness';\nexport * from './sidenav-harness';\n","/**\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\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAWA;;;AAGG;AACG,MAAO,oBAAqB,SAAQ,gCAAwC,CAAA;;IAE1E,MAAM,GAAA;;AACV,YAAA,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;SAC1D,CAAA,CAAA;AAAA,KAAA;;IAGK,WAAW,GAAA;;AACf,YAAA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAC/B,YAAA,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,KAAK,GAAG,OAAO,CAAC;SAClE,CAAA,CAAA;AAAA,KAAA;;IAGK,OAAO,GAAA;;AACX,YAAA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAE/B,YAAA,IAAI,MAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;AAC1C,gBAAA,OAAO,MAAM,CAAC;AACf,aAAA;AAED,YAAA,IAAI,MAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;AAC1C,gBAAA,OAAO,MAAM,CAAC;AACf,aAAA;AAED,YAAA,OAAO,MAAM,CAAC;SACf,CAAA,CAAA;AAAA,KAAA;AACF,CAAA;AAED;AACM,MAAO,gBAAiB,SAAQ,oBAAoB,CAAA;AAIxD;;;;;AAKG;AACH,IAAA,OAAO,IAAI,CAAC,OA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