DS3+DS4 reconcile: edge coloring via the centralized colorContract enforcer
Both sessions fixed the negative-edge-green bug; kept DS3's centralized colorContract.edgeColor helper (removed DS4's local const), updated DS4's source-assertion test to match. Same semantics, one enforcer. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -107,11 +107,13 @@ describe('GradeResultCard — the letter is hero, edge is sign-colored', () => {
|
|||||||
const src = read('components/vyndr/GradeResultCard.tsx');
|
const src = read('components/vyndr/GradeResultCard.tsx');
|
||||||
|
|
||||||
test('a negative edge NEVER renders green — negative = var(--miss)', () => {
|
test('a negative edge NEVER renders green — negative = var(--miss)', () => {
|
||||||
expect(src).toMatch(/edgeColor\s*=\s*d\.edge != null && d\.edge < 0 \? 'var\(--miss\)' : 'var\(--g-a\)'/);
|
// DS3 superseded DS4's local const with the centralized colorContract
|
||||||
// both the confidence strip and the projection row use edgeColor, not a
|
// enforcer — same semantics (negative → var(--miss)), now via the shared
|
||||||
// hardcoded green.
|
// helper. Both the confidence strip and the projection row route edge
|
||||||
expect(src).toContain('color: edgeColor');
|
// through edgeColor(d.edge), never a hardcoded green.
|
||||||
expect(src).toMatch(/d\.edge != null \? edgeColor : 'var\(--text-2\)'/);
|
expect(src).toMatch(/import \{ edgeColor.*\} from '@\/lib\/colorContract'/);
|
||||||
|
expect(src).toContain('color: edgeColor(d.edge)');
|
||||||
|
expect(src).toMatch(/d\.edge != null \? edgeColor\(d\.edge\) : 'var\(--text-2\)'/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('the grade LETTER is still the hero (largest element)', () => {
|
test('the grade LETTER is still the hero (largest element)', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user