Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions frontend/src/__tests__/recommendations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4522,6 +4522,22 @@ describe('Issues #225 + #226: cell grouping with savings range and collapse/expa
expect(chevron).not.toBeNull();
});

test('chevron is a <button> with aria-label and is not inside rec-cell-summary-content (closes #280)', async () => {
const recs = multiVariantRecs();
(api.getRecommendations as jest.Mock).mockResolvedValue({ summary: {}, recommendations: recs });
(state.getRecommendations as jest.Mock).mockReturnValue(recs);
await loadRecommendations();

const chevron = document.querySelector<HTMLButtonElement>('.rec-cell-chevron');
expect(chevron).not.toBeNull();
// Must be a <button> so native Enter/Space keyboard activation works without extra keydown handlers.
expect(chevron!.tagName.toLowerCase()).toBe('button');
expect(chevron!.getAttribute('type')).toBe('button');
expect(chevron!.getAttribute('aria-label')).toBeTruthy();
// Chevron must NOT be a descendant of .rec-cell-summary-content.
expect(chevron!.closest('.rec-cell-summary-content')).toBeNull();
});

test('clicking chevron expands the cell and shows variant rows', async () => {
const recs = multiVariantRecs();
(api.getRecommendations as jest.Mock).mockResolvedValue({ summary: {}, recommendations: recs });
Expand Down
15 changes: 10 additions & 5 deletions frontend/src/styles/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -897,18 +897,23 @@ tr.rec-cell-summary-row:hover {
background: transparent;
border: none;
cursor: pointer;
font-size: 1.2em;
font-size: 1.5em;
color: var(--cudly-text-muted);
padding: 4px;
min-width: 24px;
min-height: 24px;
padding: 6px;
min-width: 32px;
min-height: 32px;
line-height: 1;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 4px;
transition: background 0.15s, color 0.15s;
}
.rec-cell-chevron:hover {
.rec-cell-chevron:hover,
.rec-cell-chevron:focus-visible {
color: var(--cudly-primary);
background: var(--cudly-info-bg, #eaf0fb);
outline: none;
}
.rec-cell-identity {
font-weight: 500;
Expand Down
Loading