Skip to content

Commit

Permalink
Category autocomplete should only search selectable categories (#1681)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaankhosla authored Sep 16, 2023
1 parent f6f496f commit 3496ac2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
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

0 comments on commit 3496ac2

Please sign in to comment.