fix: lint and test for SearchableInput ok

This commit is contained in:
ogerly 2020-04-22 09:58:53 +02:00
parent 1d79900e5e
commit 4a60911c9a
5 changed files with 22 additions and 12 deletions

View File

@ -46,6 +46,7 @@ describe('SearchResults', () => {
describe('contains posts', () => {
beforeEach(() => {
console.log
wrapper.setData({ posts: [post], activeTab: 'Post' })
})

View File

@ -1,14 +1,20 @@
<template>
<div id="search-results" class="search-results">
<div class="search-results">
{{ $t('search.results', { searchCount: searchCount, search: search }) }}
<div>
<ds-section>
<ds-text class="search-results">
<strong>{{ searchCount }}</strong>
{{ $t('search.results') }}
</ds-text>
</ds-section>
</div>
<tab-navigation :tabs="tabOptions" :activeTab="activeTab" @switchTab="switchTab" />
<section
:class="['results', activeTab === 'User' && '--user', !activeResourceCount > 0 && '--empty']"
>
<hc-empty
v-if="!activeResourceCount"
v-if="!activeResourceCount || searchCount === 0"
icon="tasks"
:message="$t('search.no-results', { search })"
/>

View File

@ -60,13 +60,6 @@ describe('SearchableInput.vue', () => {
expect(select.element.value).toBe('abcd')
})
it('searches for the term when enter is pressed', async () => {
select.element.value = 'ab'
select.trigger('input')
select.trigger('keyup.enter')
await expect(wrapper.emitted().query[0]).toEqual(['ab'])
})
it('calls onDelete when the delete key is pressed', () => {
const spy = jest.spyOn(wrapper.vm, 'onDelete')
select.trigger('input')
@ -117,5 +110,15 @@ describe('SearchableInput.vue', () => {
expect(mocks.$router.push).toHaveBeenCalledWith('?hashtag=Hashtag')
})
})
it('searches for the term when enter is pressed', async () => {
select.element.value = 'ab'
select.trigger('input')
select.trigger('keyup.enter')
expect(mocks.$router.push).toHaveBeenCalledWith({
path: '/search/search-results',
query: { search: 'ab' },
})
})
})
})

View File

@ -595,7 +595,7 @@
"User": "Benutzer"
},
"hint": "Wonach suchst Du?",
"results": " \"{searchCount}\" Ergebnisse für \"{search}\" gefunden ",
"results": "Ergebnisse gefunden ",
"no-results": "Keine Ergebnisse für \"{search}\" gefunden. Versuch' es mit einem anderen Begriff!",
"placeholder": "Suchen"
},

View File

@ -595,7 +595,7 @@
"User": "Users"
},
"hint": "What are you searching for?",
"results": " \"{searchCount}\" Results found for \"{search}\" ",
"results": "{searchCount} Results founding",
"no-results": "No results found for \"{search}\". Try a different search term!",
"placeholder": "Search"
},