Skip to content

Commit

Permalink
Hide challenge when filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
ajuvonen committed Sep 9, 2024
1 parent d1262e7 commit 6452302
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/VeggieSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ watch(query, scrollToStart);
<li v-if="filteredVeggies().length === 0 && query !== ''" class="veggie-search__no-results">
{{ $t('veggieSearch.noResults') }}
</li>
<VeggieSearchChallenge />
<VeggieSearchChallenge v-if="!query.length" />
<VeggieSearchGroup
v-for="category in Category"
:key="category"
Expand Down
3 changes: 2 additions & 1 deletion src/components/__tests__/VeggieSearch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe('VeggieSearch', () => {
expect(wrapper.find('.veggie-search__options').isVisible()).toBe(true);
expect(wrapper.findAll('.veggie-search__heading').length).toBe(1);
expect(wrapper.find('.veggie-search__option').text()).toContain('tomato');
expect(wrapper.find('#veggie-search-heading-challenge').exists()).toBe(false);
});

it('shows all categories with matches', async () => {
Expand Down Expand Up @@ -67,6 +68,6 @@ describe('VeggieSearch', () => {
it('shows challenge if available', async () => {
const wrapper = mounter([], 'raspberry');
await wrapper.find('.veggie-search__button').trigger('click');
expect(wrapper.find('#veggie-search-heading-challenge').isVisible()).toBe(true);
expect(wrapper.find('#veggie-search-heading-challenge').exists()).toBe(true);
});
});

0 comments on commit 6452302

Please sign in to comment.