feat: 한국어 우선 쇼케이스 정리
This commit is contained in:
parent
e4087c29f5
commit
2b7fa32b5b
109 changed files with 437 additions and 279 deletions
|
|
@ -27,6 +27,19 @@ const UTILS = `
|
|||
for (const t of tops) if (!ls.length || t - ls[ls.length - 1] > 5) ls.push(t);
|
||||
return ls.length;
|
||||
};
|
||||
window.__textLines = (sel) => {
|
||||
const el = document.querySelector(sel);
|
||||
if (!el) return -1;
|
||||
const text = [...el.childNodes].find((node) => node.nodeType === 3 && node.textContent.trim());
|
||||
if (!text) return window.__lines(sel);
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(text);
|
||||
const rects = [...range.getClientRects()].filter((r) => r.width > 1 && r.height > 4);
|
||||
const tops = rects.map((r) => r.top).sort((a, b) => a - b);
|
||||
const ls = [];
|
||||
for (const t of tops) if (!ls.length || t - ls[ls.length - 1] > 5) ls.push(t);
|
||||
return ls.length;
|
||||
};
|
||||
`;
|
||||
|
||||
const browser = await webkit.launch();
|
||||
|
|
@ -40,7 +53,7 @@ for (const [app, views] of Object.entries(APPS)) {
|
|||
await page.evaluate(() => document.fonts.ready);
|
||||
|
||||
// 브랜드 1줄 + h1 1줄 + 페이지 오버플로
|
||||
const brand = await page.evaluate(`__lines('.brand')`);
|
||||
const brand = await page.evaluate(`__textLines('.brand')`);
|
||||
if (brand > 1) fail(`${app} WebKit 브랜드 세로`, brand + "줄"); else pass(`${app} WebKit 브랜드`);
|
||||
const h1 = await page.evaluate(`__lines('h1')`);
|
||||
if (h1 > 1) fail(`${app} WebKit h1 여러 줄`, h1 + "줄"); else pass(`${app} WebKit h1`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue