Commit cfdd4dc
committed
test(chat): read the right rule, and assert the invariant instead of a proxy
Review on #85, two distinct points and both correct.
THE SELECTOR COULD DRIFT TO THE WRONG RULE. `.lc-ascii-wrap` is declared BEFORE `.lc-ascii`
and `.lc-ascii-sub` immediately after it, and the old pattern —
`\.lc-ascii[^{]*\{[^}]*font-size:…cqi` — matched the right one only because -wrap happens to
declare no font-size. Luck of content, not construction.
Demonstrated rather than asserted: giving .lc-ascii-wrap a `clamp(5px, 9.9cqi, 13px)`, the
old regex reads 9.9 and the new one still reads 4.6. The rule is now anchored with a
negative lookahead so a hyphenated sibling cannot match, and the cqi is read from the
captured body rather than from a span that could cross rules.
THE FILL PERCENTAGE WAS FAKE PRECISION. It multiplied in a hard-coded 0.6em cell width to
report a tidy "88% of its container", but that factor is a property of whatever font the
editor resolves — it differs between Monaco and SF Mono — so the number dressed the real
invariant in an accuracy it does not have.
The contract is `cols x cqi`: the art's width in columns and the font size as a percentage
of the container are two halves of one value, and their product is what stays constant.
41x3.6 and 32x4.6 both land on ~147. That is what the test asserts now, and what the
failure message reports.
Guards, each bypass-verified by reverting the fix:
- the decoy cqi on .lc-ascii-wrap, which the old pattern read and this one ignores
- the cqi left at the old 41-column value (115.2); raised too far (192.0)
- the art widened without the cqi (193.2)
- sizing no longer container-relative at all
33 tests in webviewCss, 34 suites green.1 parent b315f45 commit cfdd4dc
1 file changed
Lines changed: 18 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
605 | | - | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
606 | 612 | | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
612 | 624 | | |
613 | 625 | | |
614 | 626 | | |
| |||
0 commit comments