@skrillex1224/playwright-toolkit 2.1.229 → 2.1.230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +28 -5
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +28 -5
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -580,6 +580,21 @@ var expandScrollableContent = async (page, options = {}) => {
|
|
|
580
580
|
const scrollableOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]);
|
|
581
581
|
return scrollableOverflow.has(overflowY) || scrollableOverflow.has(overflow);
|
|
582
582
|
};
|
|
583
|
+
const measureNeededHeight = (el) => {
|
|
584
|
+
if (!el) return 0;
|
|
585
|
+
const scrollHeight = Math.ceil(el.scrollHeight || 0);
|
|
586
|
+
if (scrollHeight <= 0) return 0;
|
|
587
|
+
if (isDocumentElement(el)) {
|
|
588
|
+
return scrollHeight;
|
|
589
|
+
}
|
|
590
|
+
const rect = el.getBoundingClientRect();
|
|
591
|
+
if (!rect || rect.width <= 0 || rect.height <= 0) {
|
|
592
|
+
return 0;
|
|
593
|
+
}
|
|
594
|
+
const documentTop = Math.max(0, Math.ceil(rect.top + (window.scrollY || window.pageYOffset || 0)));
|
|
595
|
+
return documentTop + scrollHeight;
|
|
596
|
+
};
|
|
597
|
+
const scrollableElements = [];
|
|
583
598
|
candidates.forEach((el) => {
|
|
584
599
|
const style = window.getComputedStyle(el);
|
|
585
600
|
const rect = el.getBoundingClientRect();
|
|
@@ -589,13 +604,14 @@ var expandScrollableContent = async (page, options = {}) => {
|
|
|
589
604
|
if (!isScrollableY(el, style)) {
|
|
590
605
|
return;
|
|
591
606
|
}
|
|
592
|
-
const
|
|
593
|
-
if (
|
|
607
|
+
const neededHeight = measureNeededHeight(el);
|
|
608
|
+
if (neededHeight <= 0) {
|
|
594
609
|
return;
|
|
595
610
|
}
|
|
596
|
-
if (
|
|
597
|
-
maxHeight =
|
|
611
|
+
if (neededHeight > maxHeight) {
|
|
612
|
+
maxHeight = neededHeight;
|
|
598
613
|
}
|
|
614
|
+
scrollableElements.push(el);
|
|
599
615
|
if (isDocumentElement(el)) {
|
|
600
616
|
return;
|
|
601
617
|
}
|
|
@@ -611,6 +627,7 @@ var expandScrollableContent = async (page, options = {}) => {
|
|
|
611
627
|
el.classList.add(className);
|
|
612
628
|
}
|
|
613
629
|
if (forceScrollableHeight) {
|
|
630
|
+
const scrollHeight = Math.ceil(el.scrollHeight || 0);
|
|
614
631
|
el.style.setProperty("overflow", "visible", "important");
|
|
615
632
|
el.style.setProperty("height", `${scrollHeight}px`, "important");
|
|
616
633
|
el.style.setProperty("min-height", `${scrollHeight}px`, "important");
|
|
@@ -621,10 +638,16 @@ var expandScrollableContent = async (page, options = {}) => {
|
|
|
621
638
|
el.style.height = "auto";
|
|
622
639
|
el.style.maxHeight = "none";
|
|
623
640
|
});
|
|
641
|
+
scrollableElements.forEach((el) => {
|
|
642
|
+
const neededHeight = measureNeededHeight(el);
|
|
643
|
+
if (neededHeight > maxHeight) {
|
|
644
|
+
maxHeight = neededHeight;
|
|
645
|
+
}
|
|
646
|
+
});
|
|
624
647
|
return maxHeight;
|
|
625
648
|
}, {
|
|
626
649
|
className: EXPANDED_SCROLLABLE_CLASS,
|
|
627
|
-
forceScrollableHeight:
|
|
650
|
+
forceScrollableHeight: options.forceScrollableHeight !== false,
|
|
628
651
|
visibleOnly: options.visibleOnly !== false
|
|
629
652
|
});
|
|
630
653
|
};
|