Commit 89d710a
committed
test(chat): the margin guard must read every declaration, not the first
Review on #88: the guard used `.exec()` without /g on each rule body, so it inspected
only the FIRST `margin:` shorthand and the FIRST direct inline-margin longhand. A body
that declares a safe one and then an unsafe one would pass — and CSS applies the LAST
declaration, so the bar would sit against the window edge with a green test.
Correct, and reproduced before fixing. Injecting exactly the shape the reviewer named:
#ctxBar { margin: 6px auto; margin: 0 8px 6px; }
the suite passed. That is the bug this test exists to catch, live, undetected.
Both scans are now matchAll over the whole body. The shorthand loop keeps the slot
parsing ([all] / [block inline] / [top inline bottom] / [top right bottom left]); the
longhand loop moved to strictEqual so it reads as "every one of these must be auto"
rather than "the first is not non-auto".
Same class of mistake as two others this session — an `indexOf` that found the wrong
`case 'listSessions'`, and an ordering assertion that passed when its subject was
absent. All three are a partial read standing in for a total one.
Re-verified, each by reverting the fix:
- the review's case: safe shorthand then the bug
- safe longhand then a bad longhand; safe shorthand then a bad longhand
- the six original bypasses (reported bug, reviewBar, bgTasksBar, 4-slot asymmetric,
direct margin-inline, shell column dropping margin-inline)
- three controls still pass: `margin: 6px auto`, two auto shorthands in a row, and
margin-inline: auto beside margin-block
34 suites green.1 parent 8a6f1b1 commit 89d710a
1 file changed
Lines changed: 9 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
753 | 753 | | |
754 | 754 | | |
755 | 755 | | |
756 | | - | |
757 | | - | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
758 | 761 | | |
759 | 762 | | |
760 | 763 | | |
761 | 764 | | |
762 | 765 | | |
763 | 766 | | |
764 | 767 | | |
765 | | - | |
766 | | - | |
767 | | - | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
768 | 772 | | |
769 | 773 | | |
770 | 774 | | |
| |||
0 commit comments