Skip to content

Commit

Permalink
add test for ignoring umlauts/diacritics when filtering accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
powerpaul17 committed Jun 28, 2024
1 parent 096eb26 commit 4cd5ed6
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/components/AccountSelect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,43 @@ describe('AccountSelect', () => {
getAllByRole(dropdown, 'option').map((e) => e.textContent)
).toEqual(['LiabilityAss. ']);
});

it('should ignore diacritics and umlauts', async () => {
const { createAccount } = await setupEnvironment();

['Without umlaut', 'Bankgebühren', 'Héllo', 'Baño nuevo'].forEach(
(name) => createAccount({ name })
);

const element = screen.getByPlaceholderText('-- No Account --');
await fireEvent.mouseDown(element);

const dropdown = screen.getByRole('listbox');

await fireEvent.input(element, {
target: { value: 'gebu' }
});

expect(
getAllByRole(dropdown, 'option').map((e) => e.textContent)
).toEqual(['BankgebührenAss. ']);

await fireEvent.input(element, {
target: { value: 'bano' }
});

expect(
getAllByRole(dropdown, 'option').map((e) => e.textContent)
).toEqual(['Baño nuevoAss. ']);

await fireEvent.input(element, {
target: { value: 'ell' }
});

expect(
getAllByRole(dropdown, 'option').map((e) => e.textContent)
).toEqual(['HélloAss. ']);
});
});

afterEach(() => {
Expand Down

0 comments on commit 4cd5ed6

Please sign in to comment.