UNPKG

@nova-ui/bits

Version:

SolarWinds Nova Framework

38 lines 1.52 kB
import { Atom } from "../../atom"; import { Helpers } from "../../setup"; import { IconAtom } from "../icon/icon.atom"; export class ButtonAtom extends Atom { constructor() { super(...arguments); this.isIconShown = async () => await this.getLocator() .locator(Helpers.page.locator("nui-icon")) .isVisible(); this.isNotBusy = async () => await this.toNotContainClass("is-busy"); this.isBusy = async () => await this.toContainClass("is-busy"); this.click = async () => this.getLocator().click(); // New interaction helpers for visual tests this.hover = async () => { await this.getLocator().hover(); }; this.mouseDown = async () => { const box = await this.getLocator().boundingBox(); if (box) { await Helpers.page.mouse.move(box.x + box.width / 2, box.y + box.height / 2); await Helpers.page.mouse.down(); } }; this.mouseUp = async () => { await Helpers.page.mouse.up(); }; this.getIcon = () => Atom.findIn(IconAtom, this.getLocator()); } static { this.CSS_CLASS = "nui-button"; } static findIn(atomClass, parentLocator, root = true) { return Atom.findIn(atomClass, parentLocator, root); } async isDisabled() { const disabled = await this.getLocator().getAttribute("disabled"); return disabled !== null; } } //# sourceMappingURL=button.atom.js.map