@o3r/testing
Version:
The module provides testing (e2e, unit test) utilities to help you build your own E2E pipeline integrating visual testing.
56 lines • 2.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.O3rRadioElement = 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 O3rRadioElement = /** @class */ (function (_super) {
tslib_1.__extends(O3rRadioElement, _super);
function O3rRadioElement(sourceElement) {
return _super.call(this, sourceElement) || this;
}
/** @inheritDoc */
O3rRadioElement.prototype.check = function () {
return tslib_1.__awaiter(this, arguments, void 0, function (value) {
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) {
// eslint-disable-next-line no-console -- no other logger available
console.warn("O3rRadioElement is already ".concat(value ? 'checked' : 'unchecked'));
return [2 /*return*/, Promise.resolve()];
}
return [2 /*return*/, this.click()];
}
});
});
};
/** @inheritDoc */
O3rRadioElement.prototype.uncheck = function () {
return this.check(false);
};
/** @inheritDoc */
O3rRadioElement.prototype.isChecked = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var checked;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getAttribute('checked')];
case 1:
checked = _a.sent();
return [2 /*return*/, checked !== undefined];
}
});
});
};
return O3rRadioElement;
}(element_1.O3rElement));
exports.O3rRadioElement = O3rRadioElement;
//# sourceMappingURL=radio-element.js.map