File tree Expand file tree Collapse file tree 3 files changed +8
-9
lines changed
src/material/autocomplete/testing Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ export class MatAutocompleteHarness extends ComponentHarness {
80
80
MatAutocompleteOptionGroupHarness . with ( filters ) ) ( ) ;
81
81
}
82
82
83
- /** Selects the first options matching the given filters. */
84
- async selectOption ( filters : OptionHarnessFilters = { } ) : Promise < void > {
83
+ /** Selects the first option matching the given filters. */
84
+ async selectOption ( filters : OptionHarnessFilters ) : Promise < void > {
85
85
await this . focus ( ) ; // Focus the input to make sure the autocomplete panel is shown.
86
86
const options = await this . getOptions ( filters ) ;
87
87
if ( ! options . length ) {
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export interface OptionHarnessFilters extends BaseHarnessFilters {
16
16
}
17
17
18
18
export interface OptionGroupHarnessFilters extends BaseHarnessFilters {
19
- text ?: string | RegExp ;
19
+ labelText ?: string | RegExp ;
20
20
}
21
21
22
22
/**
@@ -53,13 +53,12 @@ export class MatAutocompleteOptionGroupHarness extends ComponentHarness {
53
53
54
54
static with ( options : OptionGroupHarnessFilters = { } ) {
55
55
return new HarnessPredicate ( MatAutocompleteOptionGroupHarness , options )
56
- . addOption ( 'text ' , options . text ,
57
- ( harness , title ) => HarnessPredicate . stringMatches ( harness . getText ( ) , title ) ) ;
56
+ . addOption ( 'labelText ' , options . labelText ,
57
+ ( harness , label ) => HarnessPredicate . stringMatches ( harness . getLabelText ( ) , label ) ) ;
58
58
}
59
59
60
60
/** Gets a promise for the option group's label text. */
61
- async getText ( ) : Promise < string > {
61
+ async getLabelText ( ) : Promise < string > {
62
62
return ( await this . _label ( ) ) . text ( ) ;
63
63
}
64
64
}
65
-
Original file line number Diff line number Diff line change @@ -108,10 +108,10 @@ export function runHarnessTests(
108
108
it ( 'should be able to get filtered panel groups' , async ( ) => {
109
109
const input = await loader . getHarness ( autocompleteHarness . with ( { selector : '#grouped' } ) ) ;
110
110
await input . focus ( ) ;
111
- const groups = await input . getOptionGroups ( { text : 'Two' } ) ;
111
+ const groups = await input . getOptionGroups ( { labelText : 'Two' } ) ;
112
112
113
113
expect ( groups . length ) . toBe ( 1 ) ;
114
- expect ( await groups [ 0 ] . getText ( ) ) . toBe ( 'Two' ) ;
114
+ expect ( await groups [ 0 ] . getLabelText ( ) ) . toBe ( 'Two' ) ;
115
115
} ) ;
116
116
117
117
it ( 'should be able to get whether the autocomplete is open' , async ( ) => {
You can’t perform that action at this time.
0 commit comments