1 parent
1c0c0f16bc
commit
90989f8f8a
6 files changed
+480
-55
No files matched your search
@@ -164,6 +164,29 @@ async function measure(page) {
|
||||
articleCount: document.querySelectorAll(".news-card, .notice-item")
|
||||
.length,
|
||||
tableCount: document.querySelectorAll(".list-table .p-datatable").length,
|
||||
columns: [...document.querySelectorAll(".p-datatable-thead th")].map(
|
||||
(cell) => ({
|
||||
title: cell.textContent.trim(),
|
||||
left: cell.getBoundingClientRect().left,
|
||||
width: cell.getBoundingClientRect().width,
|
||||
}),
|
||||
),
|
||||
overflowingButtons: [
|
||||
...document.querySelectorAll(".p-datatable-tbody td button"),
|
||||
]
|
||||
.filter((button) => {
|
||||
const box = button.getBoundingClientRect();
|
||||
const cell = button.closest("td").getBoundingClientRect();
|
||||
return (
|
||||
box.width > 0 &&
|
||||
box.height > 0 &&
|
||||
(box.left < cell.left - 1 || box.right > cell.right + 1)
|
||||
);
|
||||
})
|
||||
.map(
|
||||
(button) =>
|
||||
button.textContent.trim() || button.getAttribute("aria-label"),
|
||||
),
|
||||
rowDisplay: row ? getComputedStyle(row).display : null,
|
||||
actionLabelLines: [
|
||||
...document.querySelectorAll(".row-actions .p-button-label"),
|
||||
@@ -283,6 +306,28 @@ for (const [name, routePath, kind, visibleText] of pages) {
|
||||
if (empty.emptyIcon?.fontSize !== "16px")
|
||||
violations.push("empty: icon density");
|
||||
if (kind === "table") {
|
||||
if (filled.overflowingButtons.length)
|
||||
violations.push(
|
||||
`filled: buttons outside cell ${filled.overflowingButtons.join(", ")}`,
|
||||
);
|
||||
if (width >= 640) {
|
||||
if (empty.columns.length !== filled.columns.length)
|
||||
violations.push("filled: column set changed");
|
||||
for (let index = 0; index < empty.columns.length; index++) {
|
||||
const before = empty.columns[index];
|
||||
const after = filled.columns[index];
|
||||
if (
|
||||
!after ||
|
||||
["left", "width"].some(
|
||||
(dimension) =>
|
||||
Math.abs(before[dimension] - after[dimension]) > 1,
|
||||
)
|
||||
)
|
||||
violations.push(
|
||||
`filled: column geometry changed ${before.title}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (filled.tableCount !== 1)
|
||||
violations.push("filled: missing actual table");
|
||||
if (filled.header?.background !== "rgba(0, 0, 0, 0)")
|
||||
|
||||
Reference in new issue
Block a user