UNPKG

playwright-fluent

Version:
16 lines (15 loc) 832 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.areOptionsAlreadySelectedInHandle = void 0; const get_all_options_of_handle_1 = require("../get-all-options-of-handle"); async function areOptionsAlreadySelectedInHandle(selector, name, expectedOptionLabels) { if (expectedOptionLabels.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 = expectedOptionLabels.every((expectedLabel) => allOptions .filter((option) => option.selected) .some((selectedOption) => selectedOption.label === expectedLabel)); return result; } exports.areOptionsAlreadySelectedInHandle = areOptionsAlreadySelectedInHandle;