UNPKG

@atomic-testing/component-driver-html

Version:
48 lines 2.2 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HTMLTextInputDriver = void 0; const core_1 = require("@atomic-testing/core"); class HTMLTextInputDriver extends core_1.ComponentDriver { constructor(locator, interactor, option) { super(locator, interactor, Object.assign(Object.assign({}, option), { parts: {} })); } getValue() { return __awaiter(this, void 0, void 0, function* () { const value = yield this.interactor.getInputValue(this.locator); return value !== null && value !== void 0 ? value : null; }); } /** * Set the value of the input, if the input is date, the value should be in the format of 'yyyy-MM-dd'. * If the input is time, the value should be in the format of 'HH:mm:'. * If the input is datetime-local, the value should be in the format of 'yyyy-MM-ddTHH:mm'. * @param value Value to be set. * @returns */ setValue(value) { return __awaiter(this, void 0, void 0, function* () { yield this.interactor.enterText(this.locator, value !== null && value !== void 0 ? value : ''); return true; }); } isDisabled() { return this.interactor.isDisabled(this.locator); } isReadonly() { return this.interactor.isReadonly(this.locator); } get driverName() { return 'HTMLTextInput'; } } exports.HTMLTextInputDriver = HTMLTextInputDriver; //# sourceMappingURL=HTMLTextInputDriver.js.map