@serenity-js/web
Version:
Serenity/JS Screenplay Pattern library offering a flexible, web driver-agnostic approach for interacting with web-based user interfaces and components, suitable for various testing contexts
31 lines • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModalDialogHandler = void 0;
const tiny_types_1 = require("tiny-types");
const AbsentModalDialog_1 = require("./AbsentModalDialog");
/**
* Represent the strategy to use with any upcoming [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/) windows.
*
* ## Learn more
*
* - [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/)
* - [`Page.modalDialog`](https://serenity-js.org/api/web/class/Page/#modalDialog)
*
* @group Models
*/
class ModalDialogHandler {
modalDialog;
constructor(modalDialog = new AbsentModalDialog_1.AbsentModalDialog()) {
this.modalDialog = modalDialog;
(0, tiny_types_1.ensure)('modalDialog', modalDialog, (0, tiny_types_1.isDefined)());
}
/**
* Returns the most recently handled [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/),
* or [`AbsentModalDialog`](https://serenity-js.org/api/web/class/AbsentModalDialog/) when no dialogs have been handled yet.
*/
async last() {
return this.modalDialog;
}
}
exports.ModalDialogHandler = ModalDialogHandler;
//# sourceMappingURL=ModalDialogHandler.js.map