@nova-ui/bits
Version:
SolarWinds Nova Framework
49 lines • 1.77 kB
JavaScript
import { OverlayContentAtom } from "./overlay-content.atom";
import { Atom } from "../../atom";
import { expect } from "../../setup";
export class PopupAtom extends Atom {
static { this.CSS_CLASS = "nui-popup"; }
static findIn(atomClass, parentLocator, root = true) {
return Atom.findIn(atomClass, parentLocator, root);
}
get popupBox() {
return Atom.findIn(OverlayContentAtom, this.getLocator());
}
get popupBoxDetached() {
return Atom.findIn(OverlayContentAtom);
}
get getPopupToggle() {
return this.getLocator().locator("[nuiPopupToggle]");
}
async isOpened() {
await expect(this.getPopupBox).toBeVisible();
await expect(this.popupBox.getLocator()).toHaveCount(1);
}
async isNotOpened() {
await expect(this.getPopupBox).toBeHidden();
await expect(this.popupBox.getLocator()).toHaveCount(0);
}
async isOpenedAppendToBody() {
await expect(this.getPopupBoxDetached).toBeVisible();
await expect(this.getPopupBoxDetached).toHaveCount(1);
}
async isNotOpenedAppendToBody() {
await expect(this.getPopupBoxDetached).toBeHidden();
await expect(this.getPopupBoxDetached).toHaveCount(0);
}
async open(detached = false) {
const toggle = this.getPopupToggle;
await toggle.click();
await expect(detached ? this.getPopupBoxDetached : this.getPopupBox).toBeVisible();
}
get getPopupBox() {
return this.popupBox.getLocator();
}
get getPopupBoxDetached() {
return this.popupBoxDetached.getLocator();
}
getPopupBoxDetachedArea() {
return this.popupBoxDetached.getLocator().locator(".nui-popup__area");
}
}
//# sourceMappingURL=popup.atom.js.map