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