UNPKG

@o3r/testing

Version:

The module provides testing (e2e, unit test) utilities to help you build your own E2E pipeline integrating visual testing.

54 lines 2.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.O3rCheckboxElement = void 0; var tslib_1 = require("tslib"); var element_1 = require("../element"); /** * Implementation dedicated to karma / TestBed. * @deprecated Will be removed in v13, please use Playwright instead */ var O3rCheckboxElement = /** @class */ (function (_super) { tslib_1.__extends(O3rCheckboxElement, _super); function O3rCheckboxElement(sourceElement) { return _super.call(this, sourceElement) || this; } /** @inheritDoc */ O3rCheckboxElement.prototype.check = function () { return tslib_1.__awaiter(this, arguments, void 0, function (value, associatedLabel) { var currentValue; if (value === void 0) { value = true; } return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.isChecked()]; case 1: currentValue = _a.sent(); if (currentValue === value) { return [2 /*return*/, Promise.resolve()]; } return [2 /*return*/, associatedLabel ? associatedLabel.click() : this.click()]; } }); }); }; /** @inheritDoc */ O3rCheckboxElement.prototype.uncheck = function () { return this.check(false); }; /** @inheritDoc */ O3rCheckboxElement.prototype.isChecked = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var value; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.sourceElement.isSelected()]; case 1: value = _a.sent(); return [2 /*return*/, value]; } }); }); }; return O3rCheckboxElement; }(element_1.O3rElement)); exports.O3rCheckboxElement = O3rCheckboxElement; //# sourceMappingURL=checkbox-element.js.map