playwright-fluent
Version:
Fluent API around playwright
16 lines (15 loc) • 860 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.areOptionsByValueAlreadySelectedInHandle = void 0;
const get_all_options_of_handle_1 = require("../get-all-options-of-handle");
async function areOptionsByValueAlreadySelectedInHandle(selector, name, expectedOptionValues) {
if (expectedOptionValues.length === 0) {
throw new Error(`You must specify at least one option for selector '${name}'`);
}
const allOptions = await (0, get_all_options_of_handle_1.getAllOptionsOfHandle)(selector, name);
const result = expectedOptionValues.every((expectedValue) => allOptions
.filter((option) => option.selected)
.some((selectedOption) => selectedOption.value === expectedValue));
return result;
}
exports.areOptionsByValueAlreadySelectedInHandle = areOptionsByValueAlreadySelectedInHandle;
;