Skip to content

Commit 91718d4

Browse files
Copilothotlong
andauthored
fix(plugin-report): tolerate jsdom hex colors in conditional-formatting test
Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/b5533f3b-25a3-405f-865f-a6709716c886 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 2743f19 commit 91718d4

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- **CI: `ReportViewer` conditional-formatting test.** Made the
13+
background-color assertion in
14+
`packages/plugin-report/src/__tests__/ReportViewer.test.tsx`
15+
tolerant of both `rgb(...)` and hex (`#rrggbb`) representations.
16+
Newer jsdom versions preserve the original hex value on
17+
`HTMLElement.style.backgroundColor` instead of normalizing to
18+
`rgb(...)`, which broke the previous strict equality check
19+
(CI run #25539753515).
20+
1021
### Added
1122

1223
- **Page-mode record forms (`editMode: 'page'`).** New per-object

packages/plugin-report/src/__tests__/ReportViewer.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,9 @@ describe('ReportViewer', () => {
408408
const cells = container.querySelectorAll('td');
409409
const wonCell = Array.from(cells).find((td) => td.textContent === 'Won');
410410
expect(wonCell).toBeDefined();
411-
expect(wonCell?.style.backgroundColor).toBe('rgb(187, 247, 208)');
411+
// jsdom may normalize colors to `rgb(...)` or preserve the original hex
412+
// depending on the version, so accept either representation.
413+
expect(wonCell?.style.backgroundColor).toMatch(/^(rgb\(187,\s*247,\s*208\)|#bbf7d0)$/i);
412414

413415
// The cell with 'Lost' should NOT have background styling
414416
const lostCell = Array.from(cells).find((td) => td.textContent === 'Lost');

0 commit comments

Comments
 (0)