@angular/material 10.0.0-rc.3 → 10.1.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/_theming.scss +17 -17
- package/autocomplete/index.metadata.json +1 -1
- package/autocomplete/testing/autocomplete-harness.d.ts +2 -0
- package/bundles/material-autocomplete-testing.umd.js +11 -0
- package/bundles/material-autocomplete-testing.umd.js.map +1 -1
- package/bundles/material-autocomplete-testing.umd.min.js +2 -2
- package/bundles/material-autocomplete-testing.umd.min.js.map +1 -1
- package/bundles/material-autocomplete.umd.js +3 -1
- package/bundles/material-autocomplete.umd.js.map +1 -1
- package/bundles/material-autocomplete.umd.min.js +5 -5
- package/bundles/material-autocomplete.umd.min.js.map +1 -1
- package/bundles/material-badge-testing.umd.min.js +1 -1
- package/bundles/material-badge-testing.umd.min.js.map +1 -1
- package/bundles/material-bottom-sheet-testing.umd.min.js +1 -1
- package/bundles/material-bottom-sheet-testing.umd.min.js.map +1 -1
- package/bundles/material-button-testing.umd.js +11 -0
- package/bundles/material-button-testing.umd.js.map +1 -1
- package/bundles/material-button-testing.umd.min.js +2 -2
- package/bundles/material-button-testing.umd.min.js.map +1 -1
- package/bundles/material-button-toggle-testing.umd.js +11 -0
- package/bundles/material-button-toggle-testing.umd.js.map +1 -1
- package/bundles/material-button-toggle-testing.umd.min.js +3 -3
- package/bundles/material-button-toggle-testing.umd.min.js.map +1 -1
- package/bundles/material-button-toggle.umd.js +12 -3
- package/bundles/material-button-toggle.umd.js.map +1 -1
- package/bundles/material-button-toggle.umd.min.js +2 -2
- package/bundles/material-button-toggle.umd.min.js.map +1 -1
- package/bundles/material-button.umd.js +7 -2
- package/bundles/material-button.umd.js.map +1 -1
- package/bundles/material-button.umd.min.js +4 -4
- package/bundles/material-button.umd.min.js.map +1 -1
- package/bundles/material-card-testing.umd.js +335 -0
- package/bundles/material-card-testing.umd.js.map +1 -0
- package/bundles/material-card-testing.umd.min.js +44 -0
- package/bundles/material-card-testing.umd.min.js.map +1 -0
- package/bundles/material-checkbox-testing.umd.js +11 -0
- package/bundles/material-checkbox-testing.umd.js.map +1 -1
- package/bundles/material-checkbox-testing.umd.min.js +3 -3
- package/bundles/material-checkbox-testing.umd.min.js.map +1 -1
- package/bundles/material-checkbox.umd.js.map +1 -1
- package/bundles/material-chips.umd.js +36 -12
- package/bundles/material-chips.umd.js.map +1 -1
- package/bundles/material-chips.umd.min.js +4 -4
- package/bundles/material-chips.umd.min.js.map +1 -1
- package/bundles/material-core-testing.umd.min.js +1 -1
- package/bundles/material-core-testing.umd.min.js.map +1 -1
- package/bundles/material-core.umd.js +11 -3
- package/bundles/material-core.umd.js.map +1 -1
- package/bundles/material-core.umd.min.js +11 -11
- package/bundles/material-core.umd.min.js.map +1 -1
- package/bundles/material-datepicker.umd.js +20 -11
- package/bundles/material-datepicker.umd.js.map +1 -1
- package/bundles/material-datepicker.umd.min.js +5 -5
- package/bundles/material-datepicker.umd.min.js.map +1 -1
- package/bundles/material-dialog-testing.umd.min.js +1 -1
- package/bundles/material-dialog-testing.umd.min.js.map +1 -1
- package/bundles/material-dialog.umd.js +45 -8
- package/bundles/material-dialog.umd.js.map +1 -1
- package/bundles/material-dialog.umd.min.js +14 -7
- package/bundles/material-dialog.umd.min.js.map +1 -1
- package/bundles/material-divider-testing.umd.min.js +1 -1
- package/bundles/material-divider-testing.umd.min.js.map +1 -1
- package/bundles/material-expansion-testing.umd.js +11 -0
- package/bundles/material-expansion-testing.umd.js.map +1 -1
- package/bundles/material-expansion-testing.umd.min.js +3 -3
- package/bundles/material-expansion-testing.umd.min.js.map +1 -1
- package/bundles/material-form-field-testing.umd.js +32 -0
- package/bundles/material-form-field-testing.umd.js.map +1 -1
- package/bundles/material-form-field-testing.umd.min.js +4 -4
- package/bundles/material-form-field-testing.umd.min.js.map +1 -1
- package/bundles/material-form-field.umd.js +47 -21
- package/bundles/material-form-field.umd.js.map +1 -1
- package/bundles/material-form-field.umd.min.js +5 -5
- package/bundles/material-form-field.umd.min.js.map +1 -1
- package/bundles/material-grid-list-testing.umd.min.js +1 -1
- package/bundles/material-grid-list-testing.umd.min.js.map +1 -1
- package/bundles/material-grid-list.umd.js +2 -2
- package/bundles/material-grid-list.umd.js.map +1 -1
- package/bundles/material-grid-list.umd.min.js +2 -2
- package/bundles/material-grid-list.umd.min.js.map +1 -1
- package/bundles/material-input-testing.umd.js +23 -6
- package/bundles/material-input-testing.umd.js.map +1 -1
- package/bundles/material-input-testing.umd.min.js +3 -3
- package/bundles/material-input-testing.umd.min.js.map +1 -1
- package/bundles/material-input.umd.js +28 -3
- package/bundles/material-input.umd.js.map +1 -1
- package/bundles/material-input.umd.min.js +3 -3
- package/bundles/material-input.umd.min.js.map +1 -1
- package/bundles/material-list-testing.umd.js +33 -0
- package/bundles/material-list-testing.umd.js.map +1 -1
- package/bundles/material-list-testing.umd.min.js +2 -2
- package/bundles/material-list-testing.umd.min.js.map +1 -1
- package/bundles/material-list.umd.js +3 -3
- package/bundles/material-list.umd.min.js +1 -1
- package/bundles/material-list.umd.min.js.map +1 -1
- package/bundles/material-menu-testing.umd.js +22 -0
- package/bundles/material-menu-testing.umd.js.map +1 -1
- package/bundles/material-menu-testing.umd.min.js +2 -2
- package/bundles/material-menu-testing.umd.min.js.map +1 -1
- package/bundles/material-menu.umd.js +13 -2
- package/bundles/material-menu.umd.js.map +1 -1
- package/bundles/material-menu.umd.min.js +4 -4
- package/bundles/material-menu.umd.min.js.map +1 -1
- package/bundles/material-paginator-testing.umd.min.js +1 -1
- package/bundles/material-paginator-testing.umd.min.js.map +1 -1
- package/bundles/material-progress-bar-testing.umd.min.js +1 -1
- package/bundles/material-progress-bar-testing.umd.min.js.map +1 -1
- package/bundles/material-progress-spinner-testing.umd.js +1 -1
- package/bundles/material-progress-spinner-testing.umd.js.map +1 -1
- package/bundles/material-progress-spinner-testing.umd.min.js +2 -2
- package/bundles/material-progress-spinner-testing.umd.min.js.map +1 -1
- package/bundles/material-progress-spinner.umd.js +2 -2
- package/bundles/material-progress-spinner.umd.min.js +3 -3
- package/bundles/material-progress-spinner.umd.min.js.map +1 -1
- package/bundles/material-radio-testing.umd.js +11 -0
- package/bundles/material-radio-testing.umd.js.map +1 -1
- package/bundles/material-radio-testing.umd.min.js +3 -3
- package/bundles/material-radio-testing.umd.min.js.map +1 -1
- package/bundles/material-radio.umd.js +15 -5
- package/bundles/material-radio.umd.js.map +1 -1
- package/bundles/material-radio.umd.min.js +2 -2
- package/bundles/material-radio.umd.min.js.map +1 -1
- package/bundles/material-select-testing.umd.js +11 -0
- package/bundles/material-select-testing.umd.js.map +1 -1
- package/bundles/material-select-testing.umd.min.js +2 -2
- package/bundles/material-select-testing.umd.min.js.map +1 -1
- package/bundles/material-select.umd.js +11 -3
- package/bundles/material-select.umd.js.map +1 -1
- package/bundles/material-select.umd.min.js +4 -4
- package/bundles/material-select.umd.min.js.map +1 -1
- package/bundles/material-sidenav-testing.umd.min.js +1 -1
- package/bundles/material-sidenav-testing.umd.min.js.map +1 -1
- package/bundles/material-sidenav.umd.js +41 -17
- package/bundles/material-sidenav.umd.js.map +1 -1
- package/bundles/material-sidenav.umd.min.js +2 -2
- package/bundles/material-sidenav.umd.min.js.map +1 -1
- package/bundles/material-slide-toggle-testing.umd.js +11 -0
- package/bundles/material-slide-toggle-testing.umd.js.map +1 -1
- package/bundles/material-slide-toggle-testing.umd.min.js +2 -2
- package/bundles/material-slide-toggle-testing.umd.min.js.map +1 -1
- package/bundles/material-slide-toggle.umd.js.map +1 -1
- package/bundles/material-slider-testing.umd.js +11 -0
- package/bundles/material-slider-testing.umd.js.map +1 -1
- package/bundles/material-slider-testing.umd.min.js +2 -2
- package/bundles/material-slider-testing.umd.min.js.map +1 -1
- package/bundles/material-snack-bar-testing.umd.min.js +1 -1
- package/bundles/material-snack-bar-testing.umd.min.js.map +1 -1
- package/bundles/material-snack-bar.umd.js +47 -39
- package/bundles/material-snack-bar.umd.js.map +1 -1
- package/bundles/material-snack-bar.umd.min.js +2 -2
- package/bundles/material-snack-bar.umd.min.js.map +1 -1
- package/bundles/material-sort-testing.umd.js +10 -10
- package/bundles/material-sort-testing.umd.js.map +1 -1
- package/bundles/material-sort-testing.umd.min.js +3 -3
- package/bundles/material-sort-testing.umd.min.js.map +1 -1
- package/bundles/material-sort.umd.js +25 -12
- package/bundles/material-sort.umd.js.map +1 -1
- package/bundles/material-sort.umd.min.js +5 -5
- package/bundles/material-sort.umd.min.js.map +1 -1
- package/bundles/material-table-testing.umd.min.js +1 -1
- package/bundles/material-table-testing.umd.min.js.map +1 -1
- package/bundles/material-table.umd.min.js +2 -2
- package/bundles/material-table.umd.min.js.map +1 -1
- package/bundles/material-tabs-testing.umd.min.js +1 -1
- package/bundles/material-tabs-testing.umd.min.js.map +1 -1
- package/bundles/material-tabs.umd.js +23 -4
- package/bundles/material-tabs.umd.js.map +1 -1
- package/bundles/material-tabs.umd.min.js +5 -12
- package/bundles/material-tabs.umd.min.js.map +1 -1
- package/bundles/material-toolbar-testing.umd.js +330 -0
- package/bundles/material-toolbar-testing.umd.js.map +1 -0
- package/bundles/material-toolbar-testing.umd.min.js +44 -0
- package/bundles/material-toolbar-testing.umd.min.js.map +1 -0
- package/bundles/material-tooltip-testing.umd.min.js +1 -1
- package/bundles/material-tooltip-testing.umd.min.js.map +1 -1
- package/bundles/material-tooltip.umd.js +14 -1
- package/bundles/material-tooltip.umd.js.map +1 -1
- package/bundles/material-tooltip.umd.min.js +3 -3
- package/bundles/material-tooltip.umd.min.js.map +1 -1
- package/bundles/material-tree.umd.js.map +1 -1
- package/button/_button-base.scss +1 -1
- package/button/_button-theme.scss +8 -8
- package/button/index.metadata.json +1 -1
- package/button/testing/button-harness.d.ts +2 -0
- package/button-toggle/button-toggle.d.ts +10 -3
- package/button-toggle/index.metadata.json +1 -1
- package/button-toggle/testing/button-toggle-harness.d.ts +2 -0
- package/card/testing/card-harness-filters.d.ts +17 -0
- package/card/testing/card-harness.d.ts +36 -0
- package/card/testing/index.d.ts +8 -0
- package/card/testing/package.json +9 -0
- package/card/testing/public-api.d.ts +9 -0
- package/checkbox/index.metadata.json +1 -1
- package/checkbox/testing/checkbox-harness.d.ts +2 -0
- package/chips/chip.d.ts +19 -1
- package/chips/index.metadata.json +1 -1
- package/core/focus-indicators/_focus-indicators.scss +6 -6
- package/core/index.metadata.json +1 -1
- package/core/option/optgroup.d.ts +7 -0
- package/core/ripple/ripple-ref.d.ts +21 -2
- package/core/ripple/ripple-renderer.d.ts +1 -19
- package/core/ripple/ripple.d.ts +2 -2
- package/core/style/_list-common.scss +1 -1
- package/datepicker/date-range-input-parts.d.ts +2 -4
- package/datepicker/date-range-input.d.ts +4 -4
- package/datepicker/date-range-picker.d.ts +10 -3
- package/datepicker/datepicker.d.ts +2 -3
- package/datepicker/index.metadata.json +1 -1
- package/datepicker/public-api.d.ts +1 -1
- package/dialog/dialog-container.d.ts +9 -2
- package/dialog/dialog-content-directives.d.ts +1 -0
- package/dialog/dialog-ref.d.ts +7 -0
- package/dialog/index.metadata.json +1 -1
- package/esm2015/autocomplete/autocomplete-module.js +18 -22
- package/esm2015/autocomplete/autocomplete-origin.js +16 -20
- package/esm2015/autocomplete/autocomplete-trigger.js +519 -521
- package/esm2015/autocomplete/autocomplete.js +126 -130
- package/esm2015/autocomplete/testing/autocomplete-harness.js +99 -97
- package/esm2015/badge/badge-module.js +13 -17
- package/esm2015/badge/badge.js +184 -188
- package/esm2015/badge/testing/badge-harness.js +74 -78
- package/esm2015/bottom-sheet/bottom-sheet-container.js +161 -165
- package/esm2015/bottom-sheet/bottom-sheet-module.js +15 -19
- package/esm2015/bottom-sheet/bottom-sheet.js +124 -128
- package/esm2015/bottom-sheet/testing/bottom-sheet-harness.js +29 -33
- package/esm2015/button/button-module.js +20 -24
- package/esm2015/button/button.js +111 -114
- package/esm2015/button/testing/button-harness.js +60 -58
- package/esm2015/button-toggle/button-toggle-module.js +10 -14
- package/esm2015/button-toggle/button-toggle.js +368 -368
- package/esm2015/button-toggle/testing/button-toggle-group-harness.js +42 -46
- package/esm2015/button-toggle/testing/button-toggle-harness.js +113 -111
- package/esm2015/card/card-module.js +30 -34
- package/esm2015/card/card.js +147 -203
- package/esm2015/card/testing/card-harness-filters.js +8 -0
- package/esm2015/card/testing/card-harness.js +52 -0
- package/esm2015/card/testing/index.js +9 -0
- package/esm2015/card/testing/public-api.js +10 -0
- package/esm2015/card/testing/testing.externs.js +0 -0
- package/esm2015/checkbox/checkbox-module.js +21 -29
- package/esm2015/checkbox/checkbox-required-validator.js +9 -13
- package/esm2015/checkbox/checkbox.js +315 -319
- package/esm2015/checkbox/testing/checkbox-harness.js +150 -148
- package/esm2015/chips/chip-input.js +119 -123
- package/esm2015/chips/chip-list.js +572 -576
- package/esm2015/chips/chip.js +333 -328
- package/esm2015/chips/chips-module.js +16 -20
- package/esm2015/core/animation/animation.js +12 -20
- package/esm2015/core/common-behaviors/common-module.js +91 -95
- package/esm2015/core/datetime/index.js +19 -27
- package/esm2015/core/datetime/native-date-adapter.js +202 -206
- package/esm2015/core/error/error-options.js +16 -24
- package/esm2015/core/line/line.js +18 -26
- package/esm2015/core/option/index.js +10 -14
- package/esm2015/core/option/optgroup.js +36 -33
- package/esm2015/core/option/option.js +181 -185
- package/esm2015/core/ripple/index.js +10 -14
- package/esm2015/core/ripple/ripple-ref.js +1 -1
- package/esm2015/core/ripple/ripple-renderer.js +1 -1
- package/esm2015/core/ripple/ripple.js +102 -106
- package/esm2015/core/selection/index.js +9 -13
- package/esm2015/core/selection/pseudo-checkbox/pseudo-checkbox.js +32 -36
- package/esm2015/core/testing/optgroup-harness.js +39 -43
- package/esm2015/core/testing/option-harness.js +51 -55
- package/esm2015/core/version.js +1 -1
- package/esm2015/datepicker/calendar-body.js +214 -218
- package/esm2015/datepicker/calendar.js +295 -303
- package/esm2015/datepicker/date-range-input-parts.js +214 -229
- package/esm2015/datepicker/date-range-input.js +244 -242
- package/esm2015/datepicker/date-range-picker.js +19 -23
- package/esm2015/datepicker/date-range-selection-strategy.js +31 -35
- package/esm2015/datepicker/date-selection-model.js +110 -122
- package/esm2015/datepicker/datepicker-base.js +418 -426
- package/esm2015/datepicker/datepicker-input-base.js +227 -224
- package/esm2015/datepicker/datepicker-input.js +111 -115
- package/esm2015/datepicker/datepicker-intl.js +37 -41
- package/esm2015/datepicker/datepicker-module.js +62 -66
- package/esm2015/datepicker/datepicker-toggle.js +81 -89
- package/esm2015/datepicker/datepicker.js +13 -17
- package/esm2015/datepicker/month-view.js +283 -287
- package/esm2015/datepicker/multi-year-view.js +198 -202
- package/esm2015/datepicker/public-api.js +2 -2
- package/esm2015/datepicker/year-view.js +220 -224
- package/esm2015/dialog/dialog-container.js +175 -164
- package/esm2015/dialog/dialog-content-directives.js +105 -114
- package/esm2015/dialog/dialog-module.js +32 -36
- package/esm2015/dialog/dialog-ref.js +17 -3
- package/esm2015/dialog/dialog.js +236 -240
- package/esm2015/dialog/testing/dialog-harness.js +58 -62
- package/esm2015/divider/divider-module.js +10 -14
- package/esm2015/divider/divider.js +33 -37
- package/esm2015/divider/testing/divider-harness.js +16 -20
- package/esm2015/expansion/accordion.js +73 -77
- package/esm2015/expansion/expansion-module.js +26 -30
- package/esm2015/expansion/expansion-panel-content.js +13 -17
- package/esm2015/expansion/expansion-panel-header.js +168 -180
- package/esm2015/expansion/expansion-panel.js +144 -152
- package/esm2015/expansion/testing/accordion-harness.js +24 -28
- package/esm2015/expansion/testing/expansion-harness.js +136 -134
- package/esm2015/form-field/error.js +26 -23
- package/esm2015/form-field/form-field-control.js +6 -10
- package/esm2015/form-field/form-field-module.js +31 -35
- package/esm2015/form-field/form-field.js +407 -409
- package/esm2015/form-field/hint.js +35 -29
- package/esm2015/form-field/label.js +8 -12
- package/esm2015/form-field/placeholder.js +8 -12
- package/esm2015/form-field/prefix.js +16 -13
- package/esm2015/form-field/suffix.js +16 -13
- package/esm2015/form-field/testing/form-field-harness.js +220 -206
- package/esm2015/grid-list/grid-list-module.js +26 -30
- package/esm2015/grid-list/grid-list.js +108 -112
- package/esm2015/grid-list/grid-tile.js +91 -111
- package/esm2015/grid-list/testing/grid-list-harness.js +62 -66
- package/esm2015/grid-list/testing/grid-tile-harness.js +69 -73
- package/esm2015/grid-list/tile-styler.js +1 -1
- package/esm2015/icon/icon-module.js +10 -14
- package/esm2015/icon/icon-registry.js +406 -410
- package/esm2015/icon/icon.js +228 -232
- package/esm2015/icon/testing/fake-icon-registry.js +66 -74
- package/esm2015/input/autosize.js +30 -34
- package/esm2015/input/input-module.js +21 -25
- package/esm2015/input/input.js +305 -284
- package/esm2015/input/testing/input-harness.js +129 -123
- package/esm2015/list/list-module.js +32 -36
- package/esm2015/list/list.js +165 -189
- package/esm2015/list/selection-list.js +503 -511
- package/esm2015/list/testing/action-list-harness.js +55 -57
- package/esm2015/list/testing/list-harness.js +31 -39
- package/esm2015/list/testing/list-item-harness-base.js +13 -17
- package/esm2015/list/testing/nav-list-harness.js +62 -64
- package/esm2015/list/testing/selection-list-harness.js +136 -138
- package/esm2015/menu/menu-content.js +74 -71
- package/esm2015/menu/menu-item.js +119 -123
- package/esm2015/menu/menu-module.js +29 -37
- package/esm2015/menu/menu-panel.js +1 -1
- package/esm2015/menu/menu-trigger.js +402 -405
- package/esm2015/menu/menu.js +329 -339
- package/esm2015/menu/testing/menu-harness.js +193 -189
- package/esm2015/paginator/paginator-intl.js +36 -40
- package/esm2015/paginator/paginator-module.js +16 -20
- package/esm2015/paginator/paginator.js +205 -209
- package/esm2015/paginator/testing/paginator-harness.js +91 -95
- package/esm2015/progress-bar/progress-bar-module.js +10 -14
- package/esm2015/progress-bar/progress-bar.js +114 -118
- package/esm2015/progress-bar/testing/progress-bar-harness.js +27 -31
- package/esm2015/progress-spinner/progress-spinner-module.js +17 -21
- package/esm2015/progress-spinner/progress-spinner.js +181 -189
- package/esm2015/progress-spinner/testing/progress-spinner-harness.js +28 -32
- package/esm2015/radio/radio-module.js +10 -14
- package/esm2015/radio/radio.js +437 -444
- package/esm2015/radio/testing/radio-harness.js +241 -243
- package/esm2015/select/select-module.js +23 -27
- package/esm2015/select/select.js +917 -918
- package/esm2015/select/testing/select-harness.js +138 -136
- package/esm2015/sidenav/drawer.js +632 -620
- package/esm2015/sidenav/sidenav-module.js +31 -35
- package/esm2015/sidenav/sidenav.js +104 -116
- package/esm2015/sidenav/testing/drawer-harness.js +40 -44
- package/esm2015/sidenav/testing/sidenav-harness.js +20 -24
- package/esm2015/slide-toggle/slide-toggle-module.js +27 -35
- package/esm2015/slide-toggle/slide-toggle-required-validator.js +9 -13
- package/esm2015/slide-toggle/slide-toggle.js +184 -188
- package/esm2015/slide-toggle/testing/slide-toggle-harness.js +123 -121
- package/esm2015/slider/slider-module.js +10 -14
- package/esm2015/slider/slider.js +640 -644
- package/esm2015/slider/testing/slider-harness.js +129 -127
- package/esm2015/snack-bar/simple-snack-bar.js +32 -36
- package/esm2015/snack-bar/snack-bar-container.js +144 -148
- package/esm2015/snack-bar/snack-bar-module.js +17 -21
- package/esm2015/snack-bar/snack-bar-ref.js +1 -1
- package/esm2015/snack-bar/snack-bar.js +208 -205
- package/esm2015/snack-bar/testing/snack-bar-harness.js +112 -116
- package/esm2015/sort/sort-header-intl.js +21 -21
- package/esm2015/sort/sort-header.js +200 -194
- package/esm2015/sort/sort-module.js +11 -15
- package/esm2015/sort/sort.js +92 -96
- package/esm2015/sort/testing/sort-harness.js +28 -32
- package/esm2015/sort/testing/sort-header-harness.js +66 -67
- package/esm2015/stepper/step-header.js +78 -82
- package/esm2015/stepper/step-label.js +8 -12
- package/esm2015/stepper/stepper-button.js +23 -31
- package/esm2015/stepper/stepper-icon.js +16 -20
- package/esm2015/stepper/stepper-intl.js +15 -19
- package/esm2015/stepper/stepper-module.js +40 -44
- package/esm2015/stepper/stepper.js +139 -155
- package/esm2015/table/cell.js +94 -122
- package/esm2015/table/row.js +90 -118
- package/esm2015/table/table-module.js +13 -17
- package/esm2015/table/table.js +26 -30
- package/esm2015/table/testing/cell-harness.js +56 -68
- package/esm2015/table/testing/row-harness.js +90 -102
- package/esm2015/table/testing/table-harness.js +65 -69
- package/esm2015/table/text-column.js +17 -21
- package/esm2015/tabs/index.js +4 -2
- package/esm2015/tabs/ink-bar.js +55 -59
- package/esm2015/tabs/paginated-tab-header.js +415 -419
- package/esm2015/tabs/tab-body.js +179 -191
- package/esm2015/tabs/tab-content.js +21 -16
- package/esm2015/tabs/tab-group.js +263 -271
- package/esm2015/tabs/tab-header.js +69 -77
- package/esm2015/tabs/tab-label-wrapper.js +29 -33
- package/esm2015/tabs/tab-label.js +16 -13
- package/esm2015/tabs/tab-nav-bar/tab-nav-bar.js +199 -215
- package/esm2015/tabs/tab.js +80 -83
- package/esm2015/tabs/tabs-module.js +38 -42
- package/esm2015/tabs/testing/tab-group-harness.js +52 -56
- package/esm2015/tabs/testing/tab-harness.js +78 -82
- package/esm2015/toolbar/testing/index.js +9 -0
- package/esm2015/toolbar/testing/public-api.js +10 -0
- package/esm2015/toolbar/testing/testing.externs.js +0 -0
- package/esm2015/toolbar/testing/toolbar-harness-filters.js +8 -0
- package/esm2015/toolbar/testing/toolbar-harness.js +47 -0
- package/esm2015/toolbar/toolbar-module.js +10 -14
- package/esm2015/toolbar/toolbar.js +61 -69
- package/esm2015/tooltip/testing/tooltip-harness.js +43 -47
- package/esm2015/tooltip/tooltip-module.js +17 -21
- package/esm2015/tooltip/tooltip.js +502 -497
- package/esm2015/tree/data-source/flat-data-source.js +1 -1
- package/esm2015/tree/node.js +99 -111
- package/esm2015/tree/outlet.js +19 -23
- package/esm2015/tree/padding.js +13 -17
- package/esm2015/tree/toggle.js +15 -19
- package/esm2015/tree/tree-module.js +10 -14
- package/esm2015/tree/tree.js +23 -27
- package/expansion/testing/expansion-harness.d.ts +2 -0
- package/fesm2015/autocomplete/testing.js +98 -95
- package/fesm2015/autocomplete/testing.js.map +1 -1
- package/fesm2015/autocomplete.js +677 -687
- package/fesm2015/autocomplete.js.map +1 -1
- package/fesm2015/badge/testing.js +73 -76
- package/fesm2015/badge/testing.js.map +1 -1
- package/fesm2015/badge.js +195 -201
- package/fesm2015/badge.js.map +1 -1
- package/fesm2015/bottom-sheet/testing.js +28 -31
- package/fesm2015/bottom-sheet/testing.js.map +1 -1
- package/fesm2015/bottom-sheet.js +297 -306
- package/fesm2015/bottom-sheet.js.map +1 -1
- package/fesm2015/button/testing.js +59 -56
- package/fesm2015/button/testing.js.map +1 -1
- package/fesm2015/button-toggle/testing.js +155 -155
- package/fesm2015/button-toggle/testing.js.map +1 -1
- package/fesm2015/button-toggle.js +377 -378
- package/fesm2015/button-toggle.js.map +1 -1
- package/fesm2015/button.js +129 -133
- package/fesm2015/button.js.map +1 -1
- package/fesm2015/card/testing.js +79 -0
- package/fesm2015/card/testing.js.map +1 -0
- package/fesm2015/card.js +175 -220
- package/fesm2015/card.js.map +1 -1
- package/fesm2015/checkbox/testing.js +149 -146
- package/fesm2015/checkbox/testing.js.map +1 -1
- package/fesm2015/checkbox.js +342 -354
- package/fesm2015/checkbox.js.map +1 -1
- package/fesm2015/chips.js +1039 -1039
- package/fesm2015/chips.js.map +1 -1
- package/fesm2015/core/testing.js +88 -94
- package/fesm2015/core/testing.js.map +1 -1
- package/fesm2015/core.js +729 -773
- package/fesm2015/core.js.map +1 -1
- package/fesm2015/datepicker.js +2821 -2884
- package/fesm2015/datepicker.js.map +1 -1
- package/fesm2015/dialog/testing.js +57 -60
- package/fesm2015/dialog/testing.js.map +1 -1
- package/fesm2015/dialog.js +564 -549
- package/fesm2015/dialog.js.map +1 -1
- package/fesm2015/divider/testing.js +15 -18
- package/fesm2015/divider/testing.js.map +1 -1
- package/fesm2015/divider.js +41 -47
- package/fesm2015/divider.js.map +1 -1
- package/fesm2015/expansion/testing.js +159 -159
- package/fesm2015/expansion/testing.js.map +1 -1
- package/fesm2015/expansion.js +422 -446
- package/fesm2015/expansion.js.map +1 -1
- package/fesm2015/form-field/testing.js +219 -204
- package/fesm2015/form-field/testing.js.map +1 -1
- package/fesm2015/form-field.js +538 -532
- package/fesm2015/form-field.js.map +1 -1
- package/fesm2015/grid-list/testing.js +129 -135
- package/fesm2015/grid-list/testing.js.map +1 -1
- package/fesm2015/grid-list.js +221 -242
- package/fesm2015/grid-list.js.map +1 -1
- package/fesm2015/icon/testing.js +65 -71
- package/fesm2015/icon/testing.js.map +1 -1
- package/fesm2015/icon.js +660 -669
- package/fesm2015/icon.js.map +1 -1
- package/fesm2015/input/testing.js +128 -121
- package/fesm2015/input/testing.js.map +1 -1
- package/fesm2015/input.js +353 -337
- package/fesm2015/input.js.map +1 -1
- package/fesm2015/list/testing.js +298 -307
- package/fesm2015/list/testing.js.map +1 -1
- package/fesm2015/list.js +698 -725
- package/fesm2015/list.js.map +1 -1
- package/fesm2015/menu/testing.js +192 -186
- package/fesm2015/menu/testing.js.map +1 -1
- package/fesm2015/menu.js +948 -962
- package/fesm2015/menu.js.map +1 -1
- package/fesm2015/paginator/testing.js +90 -93
- package/fesm2015/paginator/testing.js.map +1 -1
- package/fesm2015/paginator.js +247 -256
- package/fesm2015/paginator.js.map +1 -1
- package/fesm2015/progress-bar/testing.js +26 -29
- package/fesm2015/progress-bar/testing.js.map +1 -1
- package/fesm2015/progress-bar.js +122 -128
- package/fesm2015/progress-bar.js.map +1 -1
- package/fesm2015/progress-spinner/testing.js +27 -30
- package/fesm2015/progress-spinner/testing.js.map +1 -1
- package/fesm2015/progress-spinner.js +196 -205
- package/fesm2015/progress-spinner.js.map +1 -1
- package/fesm2015/radio/testing.js +240 -240
- package/fesm2015/radio/testing.js.map +1 -1
- package/fesm2015/radio.js +447 -453
- package/fesm2015/radio.js.map +1 -1
- package/fesm2015/select/testing.js +137 -134
- package/fesm2015/select/testing.js.map +1 -1
- package/fesm2015/select.js +939 -941
- package/fesm2015/select.js.map +1 -1
- package/fesm2015/sidenav/testing.js +58 -64
- package/fesm2015/sidenav/testing.js.map +1 -1
- package/fesm2015/sidenav.js +765 -762
- package/fesm2015/sidenav.js.map +1 -1
- package/fesm2015/slide-toggle/testing.js +122 -119
- package/fesm2015/slide-toggle/testing.js.map +1 -1
- package/fesm2015/slide-toggle.js +217 -229
- package/fesm2015/slide-toggle.js.map +1 -1
- package/fesm2015/slider/testing.js +128 -125
- package/fesm2015/slider/testing.js.map +1 -1
- package/fesm2015/slider.js +648 -654
- package/fesm2015/slider.js.map +1 -1
- package/fesm2015/snack-bar/testing.js +111 -114
- package/fesm2015/snack-bar/testing.js.map +1 -1
- package/fesm2015/snack-bar.js +426 -431
- package/fesm2015/snack-bar.js.map +1 -1
- package/fesm2015/sort/testing.js +92 -95
- package/fesm2015/sort/testing.js.map +1 -1
- package/fesm2015/sort.js +320 -318
- package/fesm2015/sort.js.map +1 -1
- package/fesm2015/stepper.js +312 -345
- package/fesm2015/stepper.js.map +1 -1
- package/fesm2015/table/testing.js +208 -229
- package/fesm2015/table/testing.js.map +1 -1
- package/fesm2015/table.js +235 -286
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/tabs/testing.js +128 -134
- package/fesm2015/tabs/testing.js.map +1 -1
- package/fesm2015/tabs.js +1362 -1399
- package/fesm2015/tabs.js.map +1 -1
- package/fesm2015/toolbar/testing.js +74 -0
- package/fesm2015/toolbar/testing.js.map +1 -0
- package/fesm2015/toolbar.js +69 -78
- package/fesm2015/toolbar.js.map +1 -1
- package/fesm2015/tooltip/testing.js +42 -45
- package/fesm2015/tooltip/testing.js.map +1 -1
- package/fesm2015/tooltip.js +517 -513
- package/fesm2015/tooltip.js.map +1 -1
- package/fesm2015/tree.js +173 -197
- package/fesm2015/tree.js.map +1 -1
- package/form-field/error.d.ts +7 -0
- package/form-field/hint.d.ts +10 -0
- package/form-field/index.metadata.json +1 -1
- package/form-field/prefix.d.ts +7 -0
- package/form-field/suffix.d.ts +7 -0
- package/form-field/testing/form-field-harness.d.ts +8 -0
- package/grid-list/grid-list.d.ts +2 -1
- package/grid-list/index.metadata.json +1 -1
- package/grid-list/tile-styler.d.ts +10 -5
- package/input/_input-theme.scss +2 -2
- package/input/index.metadata.json +1 -1
- package/input/input.d.ts +6 -2
- package/input/testing/input-harness.d.ts +2 -0
- package/list/index.metadata.json +1 -1
- package/list/testing/action-list-harness.d.ts +2 -0
- package/list/testing/nav-list-harness.d.ts +2 -0
- package/list/testing/selection-list-harness.d.ts +2 -0
- package/menu/index.metadata.json +1 -1
- package/menu/menu-content.d.ts +7 -1
- package/menu/menu-panel.d.ts +1 -0
- package/menu/menu.d.ts +4 -0
- package/menu/testing/menu-harness.d.ts +4 -0
- package/package.json +6 -6
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/progress-spinner/index.metadata.json +1 -1
- package/radio/index.metadata.json +1 -1
- package/radio/radio.d.ts +6 -0
- package/radio/testing/radio-harness.d.ts +2 -0
- package/schematics/migration.json +5 -0
- package/schematics/ng-add/index.js +2 -2
- package/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template +3 -3
- package/schematics/ng-generate/navigation/schema.json +5 -0
- package/schematics/ng-update/data/index.js +1 -1
- package/schematics/ng-update/index.d.ts +2 -0
- package/schematics/ng-update/index.js +7 -2
- package/schematics/ng-update/migrations/hammer-gestures-v9/hammer-gestures-migration.js +639 -639
- package/schematics/ng-update/migrations/misc-ripples-v7/ripple-speed-factor-migration.js +1 -1
- package/select/index.metadata.json +1 -1
- package/select/select.d.ts +6 -0
- package/select/testing/select-harness.d.ts +2 -0
- package/sidenav/drawer.d.ts +15 -3
- package/sidenav/index.metadata.json +1 -1
- package/slide-toggle/index.metadata.json +1 -1
- package/slide-toggle/testing/slide-toggle-harness.d.ts +2 -0
- package/slider/testing/slider-harness.d.ts +2 -0
- package/snack-bar/index.metadata.json +1 -1
- package/snack-bar/simple-snack-bar.d.ts +13 -1
- package/snack-bar/snack-bar-container.d.ts +16 -3
- package/snack-bar/snack-bar-ref.d.ts +3 -3
- package/snack-bar/snack-bar.d.ts +10 -3
- package/sort/index.metadata.json +1 -1
- package/sort/sort-header-intl.d.ts +5 -1
- package/sort/sort-header.d.ts +3 -1
- package/sort/testing/sort-header-harness.d.ts +6 -2
- package/tabs/index.d.ts +3 -1
- package/tabs/index.metadata.json +1 -1
- package/tabs/tab-content.d.ts +7 -1
- package/tabs/tab-label.d.ts +7 -0
- package/toolbar/testing/index.d.ts +8 -0
- package/toolbar/testing/package.json +9 -0
- package/toolbar/testing/public-api.d.ts +9 -0
- package/toolbar/testing/toolbar-harness-filters.d.ts +13 -0
- package/toolbar/testing/toolbar-harness.d.ts +31 -0
- package/tooltip/index.metadata.json +1 -1
- package/tooltip/tooltip.d.ts +1 -0
- package/tree/data-source/flat-data-source.d.ts +4 -4
- package/tree/index.metadata.json +1 -1
package/fesm2015/menu/testing.js
CHANGED
|
@@ -10,193 +10,199 @@ import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
|
10
10
|
* found in the LICENSE file at https://angular.io/license
|
|
11
11
|
*/
|
|
12
12
|
/** Harness for interacting with a standard mat-menu in tests. */
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
close() {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const panel = yield this._getMenuPanel();
|
|
73
|
-
if (panel) {
|
|
74
|
-
return panel.sendKeys(TestKey.ESCAPE);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Gets a list of `MatMenuItemHarness` representing the items in the menu.
|
|
80
|
-
* @param filters Optionally filters which menu items are included.
|
|
81
|
-
*/
|
|
82
|
-
getItems(filters = {}) {
|
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
const panelId = yield this._getPanelId();
|
|
85
|
-
if (panelId) {
|
|
86
|
-
return this._documentRootLocator.locatorForAll(MatMenuItemHarness.with(Object.assign(Object.assign({}, filters), { ancestor: `#${panelId}` })))();
|
|
87
|
-
}
|
|
88
|
-
return [];
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Clicks an item in the menu, and optionally continues clicking items in subsequent sub-menus.
|
|
93
|
-
* @param itemFilter A filter used to represent which item in the menu should be clicked. The
|
|
94
|
-
* first matching menu item will be clicked.
|
|
95
|
-
* @param subItemFilters A list of filters representing the items to click in any subsequent
|
|
96
|
-
* sub-menus. The first item in the sub-menu matching the corresponding filter in
|
|
97
|
-
* `subItemFilters` will be clicked.
|
|
98
|
-
*/
|
|
99
|
-
clickItem(itemFilter, ...subItemFilters) {
|
|
100
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
yield this.open();
|
|
102
|
-
const items = yield this.getItems(itemFilter);
|
|
103
|
-
if (!items.length) {
|
|
104
|
-
throw Error(`Could not find item matching ${JSON.stringify(itemFilter)}`);
|
|
105
|
-
}
|
|
106
|
-
if (!subItemFilters.length) {
|
|
107
|
-
return yield items[0].click();
|
|
108
|
-
}
|
|
109
|
-
const menu = yield items[0].getSubmenu();
|
|
110
|
-
if (!menu) {
|
|
111
|
-
throw Error(`Item matching ${JSON.stringify(itemFilter)} does not have a submenu`);
|
|
112
|
-
}
|
|
113
|
-
return menu.clickItem(...subItemFilters);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
/** Gets the menu panel associated with this menu. */
|
|
117
|
-
_getMenuPanel() {
|
|
118
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
const panelId = yield this._getPanelId();
|
|
120
|
-
return panelId ? this._documentRootLocator.locatorForOptional(`#${panelId}`)() : null;
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
/** Gets the id of the menu panel associated with this menu. */
|
|
124
|
-
_getPanelId() {
|
|
125
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
const panelId = yield (yield this.host()).getAttribute('aria-controls');
|
|
127
|
-
return panelId || null;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/** The selector for the host element of a `MatMenu` instance. */
|
|
132
|
-
MatMenuHarness.hostSelector = '.mat-menu-trigger';
|
|
133
|
-
return MatMenuHarness;
|
|
134
|
-
})();
|
|
135
|
-
/** Harness for interacting with a standard mat-menu-item in tests. */
|
|
136
|
-
let MatMenuItemHarness = /** @class */ (() => {
|
|
137
|
-
class MatMenuItemHarness extends ComponentHarness {
|
|
138
|
-
/**
|
|
139
|
-
* Gets a `HarnessPredicate` that can be used to search for a `MatMenuItemHarness` that meets
|
|
140
|
-
* certain criteria.
|
|
141
|
-
* @param options Options for filtering which menu item instances are considered a match.
|
|
142
|
-
* @return a `HarnessPredicate` configured with the given options.
|
|
143
|
-
*/
|
|
144
|
-
static with(options = {}) {
|
|
145
|
-
return new HarnessPredicate(MatMenuItemHarness, options)
|
|
146
|
-
.addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))
|
|
147
|
-
.addOption('hasSubmenu', options.hasSubmenu, (harness, hasSubmenu) => __awaiter(this, void 0, void 0, function* () { return (yield harness.hasSubmenu()) === hasSubmenu; }));
|
|
148
|
-
}
|
|
149
|
-
/** Whether the menu is disabled. */
|
|
150
|
-
isDisabled() {
|
|
151
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
-
const disabled = (yield this.host()).getAttribute('disabled');
|
|
153
|
-
return coerceBooleanProperty(yield disabled);
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
/** Gets the text of the menu item. */
|
|
157
|
-
getText() {
|
|
158
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
-
return (yield this.host()).text();
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
/** Focuses the menu item. */
|
|
163
|
-
focus() {
|
|
164
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
-
return (yield this.host()).focus();
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
/** Blurs the menu item. */
|
|
169
|
-
blur() {
|
|
170
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
-
return (yield this.host()).blur();
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
/** Clicks the menu item. */
|
|
175
|
-
click() {
|
|
176
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
class MatMenuHarness extends ComponentHarness {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this._documentRootLocator = this.documentRootLocatorFactory();
|
|
17
|
+
}
|
|
18
|
+
// TODO: potentially extend MatButtonHarness
|
|
19
|
+
/**
|
|
20
|
+
* Gets a `HarnessPredicate` that can be used to search for a `MatMenuHarness` that meets certain
|
|
21
|
+
* criteria.
|
|
22
|
+
* @param options Options for filtering which menu instances are considered a match.
|
|
23
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
24
|
+
*/
|
|
25
|
+
static with(options = {}) {
|
|
26
|
+
return new HarnessPredicate(MatMenuHarness, options)
|
|
27
|
+
.addOption('triggerText', options.triggerText, (harness, text) => HarnessPredicate.stringMatches(harness.getTriggerText(), text));
|
|
28
|
+
}
|
|
29
|
+
/** Whether the menu is disabled. */
|
|
30
|
+
isDisabled() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const disabled = (yield this.host()).getAttribute('disabled');
|
|
33
|
+
return coerceBooleanProperty(yield disabled);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** Whether the menu is open. */
|
|
37
|
+
isOpen() {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return !!(yield this._getMenuPanel());
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/** Gets the text of the menu's trigger element. */
|
|
43
|
+
getTriggerText() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
return (yield this.host()).text();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/** Focuses the menu. */
|
|
49
|
+
focus() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
return (yield this.host()).focus();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** Blurs the menu. */
|
|
55
|
+
blur() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
return (yield this.host()).blur();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** Whether the menu is focused. */
|
|
61
|
+
isFocused() {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
return (yield this.host()).isFocused();
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/** Opens the menu. */
|
|
67
|
+
open() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
if (!(yield this.isOpen())) {
|
|
177
70
|
return (yield this.host()).click();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** Closes the menu. */
|
|
75
|
+
close() {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const panel = yield this._getMenuPanel();
|
|
78
|
+
if (panel) {
|
|
79
|
+
return panel.sendKeys(TestKey.ESCAPE);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Gets a list of `MatMenuItemHarness` representing the items in the menu.
|
|
85
|
+
* @param filters Optionally filters which menu items are included.
|
|
86
|
+
*/
|
|
87
|
+
getItems(filters = {}) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
const panelId = yield this._getPanelId();
|
|
90
|
+
if (panelId) {
|
|
91
|
+
return this._documentRootLocator.locatorForAll(MatMenuItemHarness.with(Object.assign(Object.assign({}, filters), { ancestor: `#${panelId}` })))();
|
|
92
|
+
}
|
|
93
|
+
return [];
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Clicks an item in the menu, and optionally continues clicking items in subsequent sub-menus.
|
|
98
|
+
* @param itemFilter A filter used to represent which item in the menu should be clicked. The
|
|
99
|
+
* first matching menu item will be clicked.
|
|
100
|
+
* @param subItemFilters A list of filters representing the items to click in any subsequent
|
|
101
|
+
* sub-menus. The first item in the sub-menu matching the corresponding filter in
|
|
102
|
+
* `subItemFilters` will be clicked.
|
|
103
|
+
*/
|
|
104
|
+
clickItem(itemFilter, ...subItemFilters) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
yield this.open();
|
|
107
|
+
const items = yield this.getItems(itemFilter);
|
|
108
|
+
if (!items.length) {
|
|
109
|
+
throw Error(`Could not find item matching ${JSON.stringify(itemFilter)}`);
|
|
110
|
+
}
|
|
111
|
+
if (!subItemFilters.length) {
|
|
112
|
+
return yield items[0].click();
|
|
113
|
+
}
|
|
114
|
+
const menu = yield items[0].getSubmenu();
|
|
115
|
+
if (!menu) {
|
|
116
|
+
throw Error(`Item matching ${JSON.stringify(itemFilter)} does not have a submenu`);
|
|
117
|
+
}
|
|
118
|
+
return menu.clickItem(...subItemFilters);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/** Gets the menu panel associated with this menu. */
|
|
122
|
+
_getMenuPanel() {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
const panelId = yield this._getPanelId();
|
|
125
|
+
return panelId ? this._documentRootLocator.locatorForOptional(`#${panelId}`)() : null;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/** Gets the id of the menu panel associated with this menu. */
|
|
129
|
+
_getPanelId() {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
const panelId = yield (yield this.host()).getAttribute('aria-controls');
|
|
132
|
+
return panelId || null;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/** The selector for the host element of a `MatMenu` instance. */
|
|
137
|
+
MatMenuHarness.hostSelector = '.mat-menu-trigger';
|
|
138
|
+
/** Harness for interacting with a standard mat-menu-item in tests. */
|
|
139
|
+
class MatMenuItemHarness extends ComponentHarness {
|
|
140
|
+
/**
|
|
141
|
+
* Gets a `HarnessPredicate` that can be used to search for a `MatMenuItemHarness` that meets
|
|
142
|
+
* certain criteria.
|
|
143
|
+
* @param options Options for filtering which menu item instances are considered a match.
|
|
144
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
145
|
+
*/
|
|
146
|
+
static with(options = {}) {
|
|
147
|
+
return new HarnessPredicate(MatMenuItemHarness, options)
|
|
148
|
+
.addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))
|
|
149
|
+
.addOption('hasSubmenu', options.hasSubmenu, (harness, hasSubmenu) => __awaiter(this, void 0, void 0, function* () { return (yield harness.hasSubmenu()) === hasSubmenu; }));
|
|
150
|
+
}
|
|
151
|
+
/** Whether the menu is disabled. */
|
|
152
|
+
isDisabled() {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
const disabled = (yield this.host()).getAttribute('disabled');
|
|
155
|
+
return coerceBooleanProperty(yield disabled);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/** Gets the text of the menu item. */
|
|
159
|
+
getText() {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
return (yield this.host()).text();
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/** Focuses the menu item. */
|
|
165
|
+
focus() {
|
|
166
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
return (yield this.host()).focus();
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/** Blurs the menu item. */
|
|
171
|
+
blur() {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
return (yield this.host()).blur();
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/** Whether the menu item is focused. */
|
|
177
|
+
isFocused() {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
return (yield this.host()).isFocused();
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/** Clicks the menu item. */
|
|
183
|
+
click() {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
return (yield this.host()).click();
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/** Whether this item has a submenu. */
|
|
189
|
+
hasSubmenu() {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
return (yield this.host()).matchesSelector(MatMenuHarness.hostSelector);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/** Gets the submenu associated with this menu item, or null if none. */
|
|
195
|
+
getSubmenu() {
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
if (yield this.hasSubmenu()) {
|
|
198
|
+
return new MatMenuHarness(this.locatorFactory);
|
|
199
|
+
}
|
|
200
|
+
return null;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/** The selector for the host element of a `MatMenuItem` instance. */
|
|
205
|
+
MatMenuItemHarness.hostSelector = '.mat-menu-item';
|
|
200
206
|
|
|
201
207
|
/**
|
|
202
208
|
* @license
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu__testing.js","sources":["../../../../../../src/material/menu/testing/menu-harness.ts","../../../../../../src/material/menu/testing/menu-harness-filters.ts","../../../../../../src/material/menu/testing/public-api.ts","../../../../../../src/material/menu/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 {ComponentHarness, HarnessPredicate, TestElement, TestKey} from '@angular/cdk/testing';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {MenuHarnessFilters, MenuItemHarnessFilters} from './menu-harness-filters';\n\n/** Harness for interacting with a standard mat-menu in tests. */\nexport class MatMenuHarness extends ComponentHarness {\n /** The selector for the host element of a `MatMenu` instance. */\n static hostSelector = '.mat-menu-trigger';\n\n private _documentRootLocator = this.documentRootLocatorFactory();\n\n // TODO: potentially extend MatButtonHarness\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatMenuHarness` that meets certain\n * criteria.\n * @param options Options for filtering which menu instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: MenuHarnessFilters = {}): HarnessPredicate<MatMenuHarness> {\n return new HarnessPredicate(MatMenuHarness, options)\n .addOption('triggerText', options.triggerText,\n (harness, text) => HarnessPredicate.stringMatches(harness.getTriggerText(), text));\n }\n\n /** Whether the menu is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled');\n return coerceBooleanProperty(await disabled);\n }\n\n /** Whether the menu is open. */\n async isOpen(): Promise<boolean> {\n return !!(await this._getMenuPanel());\n }\n\n /** Gets the text of the menu's trigger element. */\n async getTriggerText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** Focuses the menu. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blurs the menu. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Opens the menu. */\n async open(): Promise<void> {\n if (!await this.isOpen()) {\n return (await this.host()).click();\n }\n }\n\n /** Closes the menu. */\n async close(): Promise<void> {\n const panel = await this._getMenuPanel();\n if (panel) {\n return panel.sendKeys(TestKey.ESCAPE);\n }\n }\n\n /**\n * Gets a list of `MatMenuItemHarness` representing the items in the menu.\n * @param filters Optionally filters which menu items are included.\n */\n async getItems(filters: Omit<MenuItemHarnessFilters, 'ancestor'> = {}):\n Promise<MatMenuItemHarness[]> {\n const panelId = await this._getPanelId();\n if (panelId) {\n return this._documentRootLocator.locatorForAll(\n MatMenuItemHarness.with({...filters, ancestor: `#${panelId}`}))();\n }\n return [];\n }\n\n /**\n * Clicks an item in the menu, and optionally continues clicking items in subsequent sub-menus.\n * @param itemFilter A filter used to represent which item in the menu should be clicked. The\n * first matching menu item will be clicked.\n * @param subItemFilters A list of filters representing the items to click in any subsequent\n * sub-menus. The first item in the sub-menu matching the corresponding filter in\n * `subItemFilters` will be clicked.\n */\n async clickItem(\n itemFilter: Omit<MenuItemHarnessFilters, 'ancestor'>,\n ...subItemFilters: Omit<MenuItemHarnessFilters, 'ancestor'>[]): Promise<void> {\n await this.open();\n const items = await this.getItems(itemFilter);\n if (!items.length) {\n throw Error(`Could not find item matching ${JSON.stringify(itemFilter)}`);\n }\n\n if (!subItemFilters.length) {\n return await items[0].click();\n }\n\n const menu = await items[0].getSubmenu();\n if (!menu) {\n throw Error(`Item matching ${JSON.stringify(itemFilter)} does not have a submenu`);\n }\n return menu.clickItem(...subItemFilters as [Omit<MenuItemHarnessFilters, 'ancestor'>]);\n }\n\n /** Gets the menu panel associated with this menu. */\n private async _getMenuPanel(): Promise<TestElement | null> {\n const panelId = await this._getPanelId();\n return panelId ? this._documentRootLocator.locatorForOptional(`#${panelId}`)() : null;\n }\n\n /** Gets the id of the menu panel associated with this menu. */\n private async _getPanelId(): Promise<string | null> {\n const panelId = await (await this.host()).getAttribute('aria-controls');\n return panelId || null;\n }\n}\n\n\n/** Harness for interacting with a standard mat-menu-item in tests. */\nexport class MatMenuItemHarness extends ComponentHarness {\n /** The selector for the host element of a `MatMenuItem` instance. */\n static hostSelector = '.mat-menu-item';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatMenuItemHarness` that meets\n * certain criteria.\n * @param options Options for filtering which menu item instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: MenuItemHarnessFilters = {}): HarnessPredicate<MatMenuItemHarness> {\n return new HarnessPredicate(MatMenuItemHarness, options)\n .addOption('text', options.text,\n (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('hasSubmenu', options.hasSubmenu,\n async (harness, hasSubmenu) => (await harness.hasSubmenu()) === hasSubmenu);\n }\n\n /** Whether the menu is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled');\n return coerceBooleanProperty(await disabled);\n }\n\n /** Gets the text of the menu item. */\n async getText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** Focuses the menu item. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blurs the menu item. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Clicks the menu item. */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n\n /** Whether this item has a submenu. */\n async hasSubmenu(): Promise<boolean> {\n return (await this.host()).matchesSelector(MatMenuHarness.hostSelector);\n }\n\n /** Gets the submenu associated with this menu item, or null if none. */\n async getSubmenu(): Promise<MatMenuHarness | null> {\n if (await this.hasSubmenu()) {\n return new MatMenuHarness(this.locatorFactory);\n }\n return null;\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 {BaseHarnessFilters} from '@angular/cdk/testing';\n\n/** A set of criteria that can be used to filter a list of `MatMenuHarness` instances. */\nexport interface MenuHarnessFilters extends BaseHarnessFilters {\n /** Only find instances whose trigger text matches the given value. */\n triggerText?: string | RegExp;\n}\n\n/** A set of criteria that can be used to filter a list of `MatMenuItemHarness` instances. */\nexport interface MenuItemHarnessFilters extends BaseHarnessFilters {\n /** Only find instances whose text matches the given value. */\n text?: string | RegExp;\n /** Only find instances that have a sub-menu. */\n hasSubmenu?: boolean;\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 * from './menu-harness';\nexport * from './menu-harness-filters';\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":";;;;AAAA;;;;;;;AAYA;AACA;IAAA,MAAa,cAAe,SAAQ,gBAAgB;QAApD;;YAIU,yBAAoB,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC;SA8GlE;;;;;;;;QApGC,OAAO,IAAI,CAAC,UAA8B,EAAE;YAC1C,OAAO,IAAI,gBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC;iBAC/C,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,EACzC,CAAC,OAAO,EAAE,IAAI,KAAK,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;SAC5F;;Q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AAO,IAAI,CAAC;aACb;SAAA;;;IArDM,+BAAY,GAAG,gBAAgB,CAAC;IAsDzC,yBAAC;;;AC3LD;;;;;;GAMG;;ACNH;;;;;;GAMG;;ACNH;;;;;;GAMG;;;;"}
|
|
1
|
+
{"version":3,"file":"menu__testing.js","sources":["../../../../../../src/material/menu/testing/menu-harness.ts","../../../../../../src/material/menu/testing/menu-harness-filters.ts","../../../../../../src/material/menu/testing/public-api.ts","../../../../../../src/material/menu/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 {ComponentHarness, HarnessPredicate, TestElement, TestKey} from '@angular/cdk/testing';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {MenuHarnessFilters, MenuItemHarnessFilters} from './menu-harness-filters';\n\n/** Harness for interacting with a standard mat-menu in tests. */\nexport class MatMenuHarness extends ComponentHarness {\n /** The selector for the host element of a `MatMenu` instance. */\n static hostSelector = '.mat-menu-trigger';\n\n private _documentRootLocator = this.documentRootLocatorFactory();\n\n // TODO: potentially extend MatButtonHarness\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatMenuHarness` that meets certain\n * criteria.\n * @param options Options for filtering which menu instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: MenuHarnessFilters = {}): HarnessPredicate<MatMenuHarness> {\n return new HarnessPredicate(MatMenuHarness, options)\n .addOption('triggerText', options.triggerText,\n (harness, text) => HarnessPredicate.stringMatches(harness.getTriggerText(), text));\n }\n\n /** Whether the menu is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled');\n return coerceBooleanProperty(await disabled);\n }\n\n /** Whether the menu is open. */\n async isOpen(): Promise<boolean> {\n return !!(await this._getMenuPanel());\n }\n\n /** Gets the text of the menu's trigger element. */\n async getTriggerText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** Focuses the menu. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blurs the menu. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether the menu is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /** Opens the menu. */\n async open(): Promise<void> {\n if (!await this.isOpen()) {\n return (await this.host()).click();\n }\n }\n\n /** Closes the menu. */\n async close(): Promise<void> {\n const panel = await this._getMenuPanel();\n if (panel) {\n return panel.sendKeys(TestKey.ESCAPE);\n }\n }\n\n /**\n * Gets a list of `MatMenuItemHarness` representing the items in the menu.\n * @param filters Optionally filters which menu items are included.\n */\n async getItems(filters: Omit<MenuItemHarnessFilters, 'ancestor'> = {}):\n Promise<MatMenuItemHarness[]> {\n const panelId = await this._getPanelId();\n if (panelId) {\n return this._documentRootLocator.locatorForAll(\n MatMenuItemHarness.with({...filters, ancestor: `#${panelId}`}))();\n }\n return [];\n }\n\n /**\n * Clicks an item in the menu, and optionally continues clicking items in subsequent sub-menus.\n * @param itemFilter A filter used to represent which item in the menu should be clicked. The\n * first matching menu item will be clicked.\n * @param subItemFilters A list of filters representing the items to click in any subsequent\n * sub-menus. The first item in the sub-menu matching the corresponding filter in\n * `subItemFilters` will be clicked.\n */\n async clickItem(\n itemFilter: Omit<MenuItemHarnessFilters, 'ancestor'>,\n ...subItemFilters: Omit<MenuItemHarnessFilters, 'ancestor'>[]): Promise<void> {\n await this.open();\n const items = await this.getItems(itemFilter);\n if (!items.length) {\n throw Error(`Could not find item matching ${JSON.stringify(itemFilter)}`);\n }\n\n if (!subItemFilters.length) {\n return await items[0].click();\n }\n\n const menu = await items[0].getSubmenu();\n if (!menu) {\n throw Error(`Item matching ${JSON.stringify(itemFilter)} does not have a submenu`);\n }\n return menu.clickItem(...subItemFilters as [Omit<MenuItemHarnessFilters, 'ancestor'>]);\n }\n\n /** Gets the menu panel associated with this menu. */\n private async _getMenuPanel(): Promise<TestElement | null> {\n const panelId = await this._getPanelId();\n return panelId ? this._documentRootLocator.locatorForOptional(`#${panelId}`)() : null;\n }\n\n /** Gets the id of the menu panel associated with this menu. */\n private async _getPanelId(): Promise<string | null> {\n const panelId = await (await this.host()).getAttribute('aria-controls');\n return panelId || null;\n }\n}\n\n\n/** Harness for interacting with a standard mat-menu-item in tests. */\nexport class MatMenuItemHarness extends ComponentHarness {\n /** The selector for the host element of a `MatMenuItem` instance. */\n static hostSelector = '.mat-menu-item';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatMenuItemHarness` that meets\n * certain criteria.\n * @param options Options for filtering which menu item instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: MenuItemHarnessFilters = {}): HarnessPredicate<MatMenuItemHarness> {\n return new HarnessPredicate(MatMenuItemHarness, options)\n .addOption('text', options.text,\n (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('hasSubmenu', options.hasSubmenu,\n async (harness, hasSubmenu) => (await harness.hasSubmenu()) === hasSubmenu);\n }\n\n /** Whether the menu is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled');\n return coerceBooleanProperty(await disabled);\n }\n\n /** Gets the text of the menu item. */\n async getText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** Focuses the menu item. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blurs the menu item. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether the menu item is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /** Clicks the menu item. */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n\n /** Whether this item has a submenu. */\n async hasSubmenu(): Promise<boolean> {\n return (await this.host()).matchesSelector(MatMenuHarness.hostSelector);\n }\n\n /** Gets the submenu associated with this menu item, or null if none. */\n async getSubmenu(): Promise<MatMenuHarness | null> {\n if (await this.hasSubmenu()) {\n return new MatMenuHarness(this.locatorFactory);\n }\n return null;\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 {BaseHarnessFilters} from '@angular/cdk/testing';\n\n/** A set of criteria that can be used to filter a list of `MatMenuHarness` instances. */\nexport interface MenuHarnessFilters extends BaseHarnessFilters {\n /** Only find instances whose trigger text matches the given value. */\n triggerText?: string | RegExp;\n}\n\n/** A set of criteria that can be used to filter a list of `MatMenuItemHarness` instances. */\nexport interface MenuItemHarnessFilters extends BaseHarnessFilters {\n /** Only find instances whose text matches the given value. */\n text?: string | RegExp;\n /** Only find instances that have a sub-menu. */\n hasSubmenu?: boolean;\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 * from './menu-harness';\nexport * from './menu-harness-filters';\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":";;;;AAAA;;;;;;;AAYA;AACA,MAAa,cAAe,SAAQ,gBAAgB;IAApD;;QAIU,yBAAoB,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC;KAmHlE;;;;;;;;IAzGC,OAAO,IAAI,CAAC,UAA8B,EAAE;QAC1C,OAAO,IAAI,gBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC;aAC/C,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,EACzC,CAAC,OAAO,EAAE,IAAI,KAAK,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;KAC5F;;IAGK,UAAU;;YACd,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;YAC9D,OAAO,qBAAqB,CAAC,MAA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