mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
include magic numbers in tokens, fix tests
This commit is contained in:
parent
d9c3412b41
commit
478e4fa08f
@ -248,7 +248,9 @@ $size-ribbon: 6px;
|
|||||||
* @presenter Spacing
|
* @presenter Spacing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$size-width-filter-sidebar: 85px;
|
||||||
$size-width-paginate: 100px;
|
$size-width-paginate: 100px;
|
||||||
|
$size-max-width-filter-menu: 1026px;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tokens Size Avatar
|
* @tokens Size Avatar
|
||||||
|
|||||||
@ -49,7 +49,7 @@ 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 > .labeled-button > .base-button',
|
'.categories-filter .sidebar .base-button',
|
||||||
)
|
)
|
||||||
expect(allCategoriesButton.attributes().class).toContain('--filled')
|
expect(allCategoriesButton.attributes().class).toContain('--filled')
|
||||||
})
|
})
|
||||||
@ -58,7 +58,7 @@ describe('CategoriesFilter.vue', () => {
|
|||||||
getters['posts/filteredCategoryIds'] = jest.fn(() => ['cat9'])
|
getters['posts/filteredCategoryIds'] = jest.fn(() => ['cat9'])
|
||||||
wrapper = await Wrapper()
|
wrapper = await Wrapper()
|
||||||
democracyAndPoliticsButton = wrapper
|
democracyAndPoliticsButton = wrapper
|
||||||
.findAll('.menu-item > .labeled-button > .base-button')
|
.findAll('.categories-filter .item .base-button')
|
||||||
.at(2)
|
.at(2)
|
||||||
expect(democracyAndPoliticsButton.attributes().class).toContain('--filled')
|
expect(democracyAndPoliticsButton.attributes().class).toContain('--filled')
|
||||||
})
|
})
|
||||||
@ -66,7 +66,7 @@ describe('CategoriesFilter.vue', () => {
|
|||||||
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('.menu-item > .labeled-button > .base-button')
|
.findAll('.categories-filter .item .base-button')
|
||||||
.at(0)
|
.at(0)
|
||||||
environmentAndNatureButton.trigger('click')
|
environmentAndNatureButton.trigger('click')
|
||||||
expect(mutations['posts/TOGGLE_CATEGORY']).toHaveBeenCalledWith({}, 'cat4')
|
expect(mutations['posts/TOGGLE_CATEGORY']).toHaveBeenCalledWith({}, 'cat4')
|
||||||
@ -78,7 +78,7 @@ describe('CategoriesFilter.vue', () => {
|
|||||||
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 > .labeled-button > .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)
|
||||||
|
|||||||
@ -30,7 +30,7 @@ describe('EmotionsFilter', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
it('starts with all emotions button active', () => {
|
it('starts with all emotions button active', () => {
|
||||||
const allEmotionsButton = wrapper.find('.emotions-filter > .labeled-button > .base-button')
|
const allEmotionsButton = wrapper.find('.emotions-filter .sidebar .base-button')
|
||||||
expect(allEmotionsButton.attributes().class).toContain('--filled')
|
expect(allEmotionsButton.attributes().class).toContain('--filled')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ describe('EmotionsFilter', () => {
|
|||||||
it('when all button is clicked', async () => {
|
it('when all button is clicked', async () => {
|
||||||
getters['posts/filteredByEmotions'] = jest.fn(() => ['happy'])
|
getters['posts/filteredByEmotions'] = jest.fn(() => ['happy'])
|
||||||
wrapper = await Wrapper()
|
wrapper = await Wrapper()
|
||||||
const allEmotionsButton = wrapper.find('.emotions-filter > .labeled-button > .base-button')
|
const allEmotionsButton = wrapper.find('.emotions-filter .sidebar .base-button')
|
||||||
allEmotionsButton.trigger('click')
|
allEmotionsButton.trigger('click')
|
||||||
expect(mutations['posts/RESET_EMOTIONS']).toHaveBeenCalledTimes(1)
|
expect(mutations['posts/RESET_EMOTIONS']).toHaveBeenCalledTimes(1)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -52,7 +52,7 @@ export default {
|
|||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.filter-menu-options {
|
.filter-menu-options {
|
||||||
max-width: 1026px;
|
max-width: $size-max-width-filter-menu;
|
||||||
padding: $space-small $space-x-small;
|
padding: $space-small $space-x-small;
|
||||||
|
|
||||||
> .title {
|
> .title {
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export default {
|
|||||||
|
|
||||||
> .sidebar {
|
> .sidebar {
|
||||||
flex-basis: 12%;
|
flex-basis: 12%;
|
||||||
max-width: 85px;
|
max-width: $size-width-filter-sidebar;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .divider {
|
> .divider {
|
||||||
|
|||||||
@ -36,13 +36,13 @@ describe('FollowingFilter', () => {
|
|||||||
getters['posts/filteredByUsersFollowed'] = jest.fn(() => true)
|
getters['posts/filteredByUsersFollowed'] = jest.fn(() => true)
|
||||||
const wrapper = Wrapper()
|
const wrapper = Wrapper()
|
||||||
expect(
|
expect(
|
||||||
wrapper.find('.following-filter > .labeled-button > .base-button').classes('--filled'),
|
wrapper.find('.following-filter .sidebar .base-button').classes('--filled'),
|
||||||
).toBe(true)
|
).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('click "filter-by-followed" button', () => {
|
describe('click "filter-by-followed" button', () => {
|
||||||
it('calls TOGGLE_FILTER_BY_FOLLOWED', () => {
|
it('calls TOGGLE_FILTER_BY_FOLLOWED', () => {
|
||||||
wrapper.find('.following-filter > .labeled-button > .base-button').trigger('click')
|
wrapper.find('.following-filter .sidebar .base-button').trigger('click')
|
||||||
expect(mutations['posts/TOGGLE_FILTER_BY_FOLLOWED']).toHaveBeenCalledWith({}, 'u34')
|
expect(mutations['posts/TOGGLE_FILTER_BY_FOLLOWED']).toHaveBeenCalledWith({}, 'u34')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -33,7 +33,7 @@ describe('LanguagesFilter.vue', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
it('starts with all categories button active', () => {
|
it('starts with all categories button active', () => {
|
||||||
const allLanguagesButton = wrapper.find('.languages-filter > .labeled-button > .base-button')
|
const allLanguagesButton = wrapper.find('.languages-filter .sidebar .base-button')
|
||||||
expect(allLanguagesButton.attributes().class).toContain('--filled')
|
expect(allLanguagesButton.attributes().class).toContain('--filled')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ describe('LanguagesFilter.vue', () => {
|
|||||||
getters['posts/filteredLanguageCodes'] = jest.fn(() => ['es'])
|
getters['posts/filteredLanguageCodes'] = jest.fn(() => ['es'])
|
||||||
const wrapper = Wrapper()
|
const wrapper = Wrapper()
|
||||||
spanishButton = wrapper
|
spanishButton = wrapper
|
||||||
.findAll('.languages-filter > .languages-list .base-button')
|
.findAll('.languages-filter .item .base-button')
|
||||||
.at(languages.findIndex(l => l.code === 'es'))
|
.at(languages.findIndex(l => l.code === 'es'))
|
||||||
expect(spanishButton.attributes().class).toContain('--filled')
|
expect(spanishButton.attributes().class).toContain('--filled')
|
||||||
})
|
})
|
||||||
@ -50,7 +50,7 @@ describe('LanguagesFilter.vue', () => {
|
|||||||
it('calls TOGGLE_LANGUAGE when clicked', () => {
|
it('calls TOGGLE_LANGUAGE when clicked', () => {
|
||||||
const wrapper = Wrapper()
|
const wrapper = Wrapper()
|
||||||
englishButton = wrapper
|
englishButton = wrapper
|
||||||
.findAll('.languages-filter > .languages-list .base-button')
|
.findAll('.languages-filter .item .base-button')
|
||||||
.at(languages.findIndex(l => l.code === 'en'))
|
.at(languages.findIndex(l => l.code === 'en'))
|
||||||
englishButton.trigger('click')
|
englishButton.trigger('click')
|
||||||
expect(mutations['posts/TOGGLE_LANGUAGE']).toHaveBeenCalledWith({}, 'en')
|
expect(mutations['posts/TOGGLE_LANGUAGE']).toHaveBeenCalledWith({}, 'en')
|
||||||
@ -62,7 +62,7 @@ describe('LanguagesFilter.vue', () => {
|
|||||||
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 > .labeled-button > .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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user