Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Category autocomplete should only search selectable categories #1681

Merged
merged 11 commits into from
Sep 16, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ export default function CategoryAutocomplete({
return suggestions.filter(suggestion => {
return (
suggestion.id === 'split' ||
defaultFilterSuggestion(suggestion, value) ||
suggestion.groupName.toLowerCase().includes(value.toLowerCase())
defaultFilterSuggestion(suggestion, value)
);
});
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,17 +448,12 @@ describe('Transactions', () => {
expect(items[1].textContent).toBe('General');
expect(items[1].dataset['testid']).toBe('category-item-highlighted');

// It should also allow filtering on group names
// It should not allow filtering on group names
await userEvent.clear(input);
await userEvent.type(input, 'Usual');
await userEvent.type(input, 'Usual Expenses');

items = tooltip.querySelectorAll('[data-testid*="category-item"]');
expect(items.length).toBe(4);
expect(items[0].textContent).toBe('Usual Expenses');
expect(items[1].textContent).toBe('Food');
expect(items[2].textContent).toBe('General');
expect(items[3].textContent).toBe('Home');
expect(items[1].dataset['testid']).toBe('category-item-highlighted');
expect(items.length).toBe(0);
});

test('dropdown selects an item with keyboard', async () => {
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/1681.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [shaankhosla]
---

Category autocomplete doesn't include unselectable category groups now