File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
src/material/input/testing Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ import {InputHarnessFilters} from './input-harness-filters';
12
12
13
13
/** Harness for interacting with a standard Material inputs in tests. */
14
14
export class MatInputHarness extends MatFormFieldControlHarness {
15
- static hostSelector = '.mat-input-element' ;
15
+ // TODO: We do not want to handle `select` elements with `matNativeControl` because
16
+ // not all methods of this harness work reasonably for native select elements.
17
+ // For more details. See: https://github.com/angular/components/pull/18221.
18
+ static hostSelector = '[matInput], input[matNativeControl]' ;
16
19
17
20
/**
18
21
* Gets a `HarnessPredicate` that can be used to search for a `MatInputHarness` that meets
Original file line number Diff line number Diff line change @@ -195,6 +195,16 @@ function getActiveElementTagName() {
195
195
<mat-form-field>
196
196
<input matNativeControl placeholder="Native control" id="nativeControl">
197
197
</mat-form-field>
198
+
199
+ <mat-form-field>
200
+ <!--
201
+ Select native controls should not be handled as part of the input harness. We add this
202
+ to assert that the harness does not accidentally match it.
203
+ -->
204
+ <select matNativeControl>
205
+ <option value="first">First</option>
206
+ </select>
207
+ </mat-form-field>
198
208
`
199
209
} )
200
210
class InputHarnessTest {
You can’t perform that action at this time.
0 commit comments