test(dashboard): loosen settings-button matcher for the new toolbar

The unified toolbar gives the gear button a title attribute for a11y,
which broke the previous "no title, no text" matcher. Matching on the
lucide-settings icon plus an empty text node is enough to identify it
uniquely on this page.
This commit is contained in:
Maurice
2026-04-18 01:30:55 +02:00
parent 01ed60e2d5
commit ee805369d1
+6 -15
View File
@@ -416,15 +416,10 @@ describe('DashboardPage', () => {
expect(screen.getAllByText('Paris Adventure').length).toBeGreaterThan(0); expect(screen.getAllByText('Paris Adventure').length).toBeGreaterThan(0);
}); });
// Find settings button — it's the gear icon button without title or text // Find settings button — the gear icon button (icon-only, no visible label)
const allBtns = screen.getAllByRole('button'); const allBtns = screen.getAllByRole('button');
const settingsButton = allBtns.find( const settingsButton = allBtns.find(btn =>
btn => { btn.querySelector('.lucide-settings') && !btn.textContent?.trim()
const title = btn.getAttribute('title');
const text = btn.textContent?.trim() || '';
// Settings gear: no title, no meaningful text, not the notification bell
return !title && !text && btn.querySelector('.lucide-settings');
}
); );
expect(settingsButton).toBeDefined(); expect(settingsButton).toBeDefined();
@@ -646,14 +641,10 @@ describe('DashboardPage', () => {
expect(screen.getAllByText('Paris Adventure').length).toBeGreaterThan(0); expect(screen.getAllByText('Paris Adventure').length).toBeGreaterThan(0);
}); });
// Open widget settings // Open widget settings — gear icon button (icon-only, no visible label)
const allBtns = screen.getAllByRole('button'); const allBtns = screen.getAllByRole('button');
const settingsButton = allBtns.find( const settingsButton = allBtns.find(btn =>
btn => { btn.querySelector('.lucide-settings') && !btn.textContent?.trim()
const title = btn.getAttribute('title');
const text = btn.textContent?.trim() || '';
return !title && !text && btn.querySelector('.lucide-settings');
}
); );
expect(settingsButton).toBeDefined(); expect(settingsButton).toBeDefined();