import { OptionMenu } from '@/manager/shared/components/OptionMenu';
import { BaseComponent } from '@/shared/base/BaseComponent';

export class SingleSelect extends BaseComponent {
  private readonly body = this.host.locator('.v-field');
  private readonly input = this.body.locator('input[type=text]');
  private readonly menu = new OptionMenu(this.input);

  async select(value: string): Promise<void> {
    // TODO: due to a vuetify aria-owns bug, body.click() is used instead of menu.open()
    await this.body.click();
    await this.menu.select(value);
  }
}
