UNPKG

playwright-fluent

Version:
31 lines (30 loc) 856 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasHandleText = void 0; const get_inner_text_of_handle_1 = require("../get-inner-text-of-handle"); async function hasHandleText(handle, expectedText) { if (!handle) { return false; } const text = await (0, get_inner_text_of_handle_1.getInnerTextOfHandle)(handle); if (text === undefined && expectedText === '') { return true; } if (text === null && expectedText === '') { return true; } if (text === undefined || text === null) { return false; } if (text === '' && expectedText === '') { return true; } if (expectedText === '') { return false; } if (text.includes(expectedText)) { return true; } return false; } exports.hasHandleText = hasHandleText;