mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-01-20 20:01:22 +00:00
test filter by posts in my groups
This commit is contained in:
parent
b63ade8da1
commit
a784b0f860
@ -9,12 +9,14 @@ let wrapper
|
||||
describe('FollowingFilter', () => {
|
||||
const mutations = {
|
||||
'posts/TOGGLE_FILTER_BY_FOLLOWED': jest.fn(),
|
||||
'posts/TOGGLE_FILTER_BY_MY_GROUPS': jest.fn(),
|
||||
}
|
||||
const getters = {
|
||||
'auth/user': () => {
|
||||
return { id: 'u34' }
|
||||
},
|
||||
'posts/filteredByUsersFollowed': jest.fn(),
|
||||
'posts/filteredByPostsInMyGroups': jest.fn(),
|
||||
}
|
||||
|
||||
const mocks = {
|
||||
@ -34,12 +36,18 @@ describe('FollowingFilter', () => {
|
||||
describe('mount', () => {
|
||||
it('sets "filter-by-followed" button attribute `filled`', () => {
|
||||
getters['posts/filteredByUsersFollowed'] = jest.fn(() => true)
|
||||
getters['posts/filteredByPostsInMyGroups'] = jest.fn(() => true)
|
||||
const wrapper = Wrapper()
|
||||
expect(
|
||||
wrapper
|
||||
.find('.following-filter .filter-list .follower-item .base-button')
|
||||
.classes('--filled'),
|
||||
).toBe(true)
|
||||
expect(
|
||||
wrapper
|
||||
.find('.following-filter .filter-list .posts-in-my-groups-item .base-button')
|
||||
.classes('--filled'),
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
describe('click "filter-by-followed" button', () => {
|
||||
@ -48,5 +56,14 @@ describe('FollowingFilter', () => {
|
||||
expect(mutations['posts/TOGGLE_FILTER_BY_FOLLOWED']).toHaveBeenCalledWith({}, 'u34')
|
||||
})
|
||||
})
|
||||
|
||||
describe('click "filter-by-my-groups" button', () => {
|
||||
it('calls TOGGLE_FILTER_BY_MY_GROUPS', () => {
|
||||
wrapper
|
||||
.find('.following-filter .filter-list .posts-in-my-groups-item .base-button')
|
||||
.trigger('click')
|
||||
expect(mutations['posts/TOGGLE_FILTER_BY_MY_GROUPS']).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
:label="$t('filter-menu.my-groups')"
|
||||
:filled="filteredByPostsInMyGroups"
|
||||
:title="$t('contribution.filterMyGroups')"
|
||||
@click="toggleFilteredByMyGroups(currentUser.id)"
|
||||
@click="toggleFilteredByMyGroups()"
|
||||
/>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user