@o3r/testing
Version:
The module provides testing (e2e, unit test) utilities to help you build your own E2E pipeline integrating visual testing.
40 lines • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.O3rRadioGroup = void 0;
const group_1 = require("../group");
/**
* Group element to manage a radio group
*/
class O3rRadioGroup extends group_1.O3rGroup {
constructor(sourceElement) {
super(sourceElement);
}
/** @inheritDoc */
async isValidGroup() {
let name = '';
for (const item of this.items) {
const itemName = await item.getAttribute('name');
if (name !== '' && name !== itemName) {
return false;
}
if (itemName !== undefined) {
name = itemName;
}
}
return true;
}
/**
* Get the selected radio
*/
async getSelectedItem() {
for (const item of this.items) {
const isSelected = await item.isChecked();
if (isSelected) {
return item;
}
}
return undefined;
}
}
exports.O3rRadioGroup = O3rRadioGroup;
//# sourceMappingURL=radio-group.js.map