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

29 lines (28 loc) 863 B
import { logger } from '../../lib'; import { AIElementError } from './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 AIElementError(`Unsupported AIElement version '${json.version}'.`); } toCustomElement() { logger.debug('Converting AIElement to CustomElementJson.'); return { customImage: this.imagePath, mask: this.mask, name: this.name, }; } hasName(name) { return this.name === name; } } export { AIElement };