playwright-fluent
Version:
Fluent API around playwright
19 lines (18 loc) • 855 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.areOptionsAvailableInHandle = void 0;
const is_option_available_in_handle_1 = require("../is-option-available-in-handle");
async function areOptionsAvailableInHandle(selector, name, expectedOptionLabels) {
if (expectedOptionLabels.length === 0) {
throw new Error('No option to check: you must specify at least one option');
}
for (let index = 0; index < expectedOptionLabels.length; index++) {
const expectedOptionLabel = expectedOptionLabels[index];
const isAvailable = await (0, is_option_available_in_handle_1.isOptionAvailableInHandle)(selector, name, expectedOptionLabel);
if (!isAvailable) {
return false;
}
}
return true;
}
exports.areOptionsAvailableInHandle = areOptionsAvailableInHandle;
;