An item's text takes four fifths of the reading pane, not 80 characters (#360)
Asked for as a share of the window. The pane is the window less the feed list, so a share of the window would never bind; a share of the pane does. On a phone the pane is the screen, and keeps all of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -189,14 +189,11 @@ test('the reading font is an item\'s title and text, and the interface keeps its
|
||||
// A serif gets more room between its lines (1.75 of the text's size, against 1.65).
|
||||
const lh = await page.locator('#detail .dbody').evaluate(el => { const c = getComputedStyle(el); return parseFloat(c.lineHeight) / parseFloat(c.fontSize); });
|
||||
expect(lh).toBeCloseTo(1.75, 2);
|
||||
// About 80 characters a line, however wide the pane (#360).
|
||||
const measure = await page.locator('#detail .dbody').evaluate(el => {
|
||||
const ch = document.createElement('span'); ch.textContent = '0'; el.append(ch);
|
||||
const n = el.getBoundingClientRect().width / ch.getBoundingClientRect().width; ch.remove(); return n; });
|
||||
expect(measure).toBeLessThanOrEqual(80.5);
|
||||
const [pane, text] = await page.locator('#detail .dbody').evaluate(el =>
|
||||
[el.parentElement.clientWidth, el.getBoundingClientRect().width]);
|
||||
expect(text, 'the pane is wider, so the measure is what holds it').toBeLessThan(pane - 100);
|
||||
// Four fifths of the pane, whatever the font (#360).
|
||||
const share = await page.locator('#detail .dbody').evaluate(el => {
|
||||
const p = el.parentElement, c = getComputedStyle(p);
|
||||
return el.getBoundingClientRect().width / (p.clientWidth - parseFloat(c.paddingLeft) - parseFloat(c.paddingRight)); });
|
||||
expect(share).toBeCloseTo(0.8, 2);
|
||||
|
||||
await page.locator('#srfont').selectOption('same');
|
||||
await page.locator('#sfont').selectOption('theme');
|
||||
|
||||
Reference in New Issue
Block a user