material-web/field/harness.ts
Elizabeth Mitchell c390291687 chore: format files with prettier
PiperOrigin-RevId: 576601342
2023-10-25 11:59:00 -07:00

36 lines
850 B
TypeScript

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {Harness} from '../testing/harness.js';
import {Field} from './internal/field.js';
/**
* Test harness for field elements.
*/
export class FieldHarness extends Harness<Field> {
override async focusWithKeyboard(init: KeyboardEventInit = {}) {
this.element.focused = true;
await super.focusWithKeyboard(init);
}
override async focusWithPointer() {
this.element.focused = true;
await super.focusWithPointer();
}
override async blur() {
this.element.focused = false;
await super.blur();
}
protected override async getInteractiveElement() {
await this.element.updateComplete;
return (this.element.querySelector(':not([slot])') ||
this.element.renderRoot.querySelector('.field')) as HTMLElement;
}
}