mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
chore: Fix lint, follow @alina-beck suggestions
This commit is contained in:
parent
478e4fa08f
commit
e1733201e8
@ -48,26 +48,20 @@ describe('CategoriesFilter.vue', () => {
|
||||
|
||||
describe('mount', () => {
|
||||
it('starts with all categories button active', () => {
|
||||
const allCategoriesButton = wrapper.find(
|
||||
'.categories-filter .sidebar .base-button',
|
||||
)
|
||||
const allCategoriesButton = wrapper.find('.categories-filter .sidebar .base-button')
|
||||
expect(allCategoriesButton.attributes().class).toContain('--filled')
|
||||
})
|
||||
|
||||
it('sets category button attribute `filled` when corresponding category is filtered', async () => {
|
||||
getters['posts/filteredCategoryIds'] = jest.fn(() => ['cat9'])
|
||||
wrapper = await Wrapper()
|
||||
democracyAndPoliticsButton = wrapper
|
||||
.findAll('.categories-filter .item .base-button')
|
||||
.at(2)
|
||||
democracyAndPoliticsButton = wrapper.findAll('.categories-filter .item .base-button').at(2)
|
||||
expect(democracyAndPoliticsButton.attributes().class).toContain('--filled')
|
||||
})
|
||||
|
||||
describe('click on an "catetories-buttons" button', () => {
|
||||
it('calls TOGGLE_CATEGORY when clicked', () => {
|
||||
environmentAndNatureButton = wrapper
|
||||
.findAll('.categories-filter .item .base-button')
|
||||
.at(0)
|
||||
environmentAndNatureButton = wrapper.findAll('.categories-filter .item .base-button').at(0)
|
||||
environmentAndNatureButton.trigger('click')
|
||||
expect(mutations['posts/TOGGLE_CATEGORY']).toHaveBeenCalledWith({}, 'cat4')
|
||||
})
|
||||
@ -77,9 +71,7 @@ describe('CategoriesFilter.vue', () => {
|
||||
it('when all button is clicked', async () => {
|
||||
getters['posts/filteredCategoryIds'] = jest.fn(() => ['cat9'])
|
||||
wrapper = await Wrapper()
|
||||
const allCategoriesButton = wrapper.find(
|
||||
'.categories-filter .sidebar .base-button',
|
||||
)
|
||||
const allCategoriesButton = wrapper.find('.categories-filter .sidebar .base-button')
|
||||
allCategoriesButton.trigger('click')
|
||||
expect(mutations['posts/RESET_CATEGORIES']).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
@ -35,9 +35,7 @@ describe('FollowingFilter', () => {
|
||||
it('sets "filter-by-followed" button attribute `filled`', () => {
|
||||
getters['posts/filteredByUsersFollowed'] = jest.fn(() => true)
|
||||
const wrapper = Wrapper()
|
||||
expect(
|
||||
wrapper.find('.following-filter .sidebar .base-button').classes('--filled'),
|
||||
).toBe(true)
|
||||
expect(wrapper.find('.following-filter .sidebar .base-button').classes('--filled')).toBe(true)
|
||||
})
|
||||
|
||||
describe('click "filter-by-followed" button', () => {
|
||||
|
||||
@ -61,9 +61,7 @@ describe('LanguagesFilter.vue', () => {
|
||||
it('when all button is clicked', async () => {
|
||||
getters['posts/filteredLanguageCodes'] = jest.fn(() => ['en'])
|
||||
wrapper = await Wrapper()
|
||||
const allLanguagesButton = wrapper.find(
|
||||
'.languages-filter .sidebar .base-button',
|
||||
)
|
||||
const allLanguagesButton = wrapper.find('.languages-filter .sidebar .base-button')
|
||||
allLanguagesButton.trigger('click')
|
||||
expect(mutations['posts/RESET_LANGUAGES']).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
@ -2,6 +2,8 @@ import { storiesOf } from '@storybook/vue'
|
||||
import helpers from '~/storybook/helpers'
|
||||
import LabeledButton from './LabeledButton.vue'
|
||||
|
||||
helpers.init()
|
||||
|
||||
storiesOf('Generic/LabeledButton', module)
|
||||
.addDecorator(helpers.layout)
|
||||
.add('default', () => ({
|
||||
@ -13,22 +15,7 @@ storiesOf('Generic/LabeledButton', module)
|
||||
<labeled-button
|
||||
icon="check"
|
||||
:filled="filled"
|
||||
label="All"
|
||||
@click="filled = !filled"
|
||||
/>
|
||||
`,
|
||||
}))
|
||||
|
||||
.add('filled', () => ({
|
||||
components: { LabeledButton },
|
||||
data: () => ({
|
||||
filled: true,
|
||||
}),
|
||||
template: `
|
||||
<labeled-button
|
||||
icon="check"
|
||||
:filled="filled"
|
||||
label="All"
|
||||
label="Toggle Me!!"
|
||||
@click="filled = !filled"
|
||||
/>
|
||||
`,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user