UNPKG

askui

Version:

Reliable, automated end-to-end-testing that depends on what is shown on your screen instead of the technology you are running on

32 lines (31 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AIElement = void 0; const lib_1 = require("../../lib"); const ai_element_error_1 = require("./ai-element-error"); class AIElement { constructor(name, imagePath, mask) { this.name = name; this.imagePath = imagePath; this.mask = mask; } static fromJson(json, imagePath) { var _a; if (json.version === 1) { return new AIElement(json.name, imagePath, (_a = json.image) === null || _a === void 0 ? void 0 : _a.mask); } throw new ai_element_error_1.AIElementError(`Unsupported AIElement version '${json.version}'.`); } toCustomElement() { lib_1.logger.debug('Converting AIElement to CustomElementJson.'); return { customImage: this.imagePath, mask: this.mask, name: this.name, }; } hasName(name) { return this.name === name; } } exports.AIElement = AIElement;