UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

46 lines (45 loc) 1.65 kB
/** * DevExtreme (esm/__internal/ui/__tests__/__mock__/model/popup.js) * Version: 25.2.8 * Build date: Mon Jun 08 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import Popup from "../../../../../ui/popup"; const CLASSES = { popupWrapper: "dx-popup-wrapper", popupTitle: "dx-popup-title", overlayContent: "dx-overlay-content" }; const SELECTORS = { cancelButton: '[role="button"][aria-label*="Cancel"]' }; export class PopupModel { getPopupWrapper() { return document.body.querySelector(`.${CLASSES.popupWrapper}`) } getOverlayContent() { const wrapper = this.getPopupWrapper(); return null === wrapper || void 0 === wrapper ? void 0 : wrapper.querySelector(`.${CLASSES.overlayContent}`) } isVisible() { return !!this.getOverlayContent() } getTitle() { const overlay = this.getOverlayContent(); const titleElement = null === overlay || void 0 === overlay ? void 0 : overlay.querySelector(`.${CLASSES.popupTitle}`); return (null === titleElement || void 0 === titleElement ? void 0 : titleElement.textContent) ?? "" } getElement() { return this.getPopupWrapper() } getInstance() { const element = this.getElement(); return Popup.getInstance(element) } getCancelButton() { const wrapper = this.getPopupWrapper(); return null === wrapper || void 0 === wrapper ? void 0 : wrapper.querySelector(SELECTORS.cancelButton) } }