mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
* shout comments * fix notifications * Remove whitespace for empty category sections * Overhaul post actions * Adjust spacing * Allow fine-grained size control for icons and circle buttons via css variables; adjust comments layout * Adjust spacing * Add test for ActionButton (WIP) * Rename import * Remove text and add count bubble * Use filled icons to indicate active states * Adjust sizes and orientation * Remove unused properties, add test * Fix ObserveButton test * Fix ShoutButton test * fix tests * Adapt styles * Adjust style for larger numbers * Remove unused icon * Fix test structure * Remove unused class names --------- Co-authored-by: Maximilian Harz <maxharz@gmail.com>
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
import { render, screen, fireEvent } from '@testing-library/vue'
|
|
import ObserveButton from './ObserveButton.vue'
|
|
|
|
const localVue = global.localVue
|
|
|
|
describe('ObserveButton', () => {
|
|
const Wrapper = (count = 1, postId = '123', isObserved = true) => {
|
|
return render(ObserveButton, {
|
|
mocks: {
|
|
$t: jest.fn((t) => t),
|
|
},
|
|
localVue,
|
|
propsData: {
|
|
count,
|
|
postId,
|
|
isObserved,
|
|
},
|
|
})
|
|
}
|
|
|
|
describe('observed', () => {
|
|
let wrapper
|
|
|
|
beforeEach(() => {
|
|
wrapper = Wrapper(1, '123', true)
|
|
})
|
|
|
|
it('renders', () => {
|
|
expect(wrapper.container).toMatchSnapshot()
|
|
})
|
|
|
|
it('emits toggleObservePost with false when clicked', async () => {
|
|
const button = screen.getByRole('button')
|
|
await fireEvent.click(button)
|
|
expect(wrapper.emitted().toggleObservePost).toEqual([['123', false]])
|
|
})
|
|
})
|
|
|
|
describe('unobserved', () => {
|
|
let wrapper
|
|
|
|
beforeEach(() => {
|
|
wrapper = Wrapper(1, '123', false)
|
|
})
|
|
|
|
it('renders', () => {
|
|
expect(wrapper.container).toMatchSnapshot()
|
|
})
|
|
|
|
it('emits toggleObservePost with true when clicked', async () => {
|
|
const button = screen.getByRole('button')
|
|
await fireEvent.click(button)
|
|
expect(wrapper.emitted().toggleObservePost).toEqual([['123', true]])
|
|
})
|
|
})
|
|
})
|