mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
* Add distance to group profile if location is defined * Fix snapshot tests in 'webapp/pages/groups/_id/_slug.spec.js' * Fix prop Vue warning in test 'webapp/pages/groups/_id/_slug.spec.js' * reuse locationFragement for groups * use better order on locationFragement parameters * moved LocationInfo Component to correct place as its used in Group & User related context * use size prop * reduce changeset * update snapshots * remove computed property & simplify component * more tests & updated snapshots --------- Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
import { render } from '@testing-library/vue'
|
|
import LocationInfo from './LocationInfo.vue'
|
|
|
|
const localVue = global.localVue
|
|
|
|
describe('LocationInfo', () => {
|
|
const Wrapper = ({ withDistance }) => {
|
|
return render(LocationInfo, {
|
|
localVue,
|
|
propsData: {
|
|
locationData: {
|
|
name: 'Paris',
|
|
distanceToMe: withDistance ? 100 : null,
|
|
},
|
|
},
|
|
mocks: {
|
|
$t: jest.fn((t) => t),
|
|
},
|
|
})
|
|
}
|
|
|
|
describe('distance', () => {
|
|
it('renders with distance', () => {
|
|
const wrapper = Wrapper({ withDistance: true })
|
|
expect(wrapper.container).toMatchSnapshot()
|
|
})
|
|
|
|
it('renders without distance', () => {
|
|
const wrapper = Wrapper({ withDistance: false })
|
|
expect(wrapper.container).toMatchSnapshot()
|
|
})
|
|
})
|
|
|
|
describe('size', () => {
|
|
it('renders in base size', () => {
|
|
const wrapper = Wrapper({ size: 'base' })
|
|
expect(wrapper.container).toMatchSnapshot()
|
|
})
|
|
|
|
it('renders in small size', () => {
|
|
const wrapper = Wrapper({ size: 'small' })
|
|
expect(wrapper.container).toMatchSnapshot()
|
|
})
|
|
})
|
|
})
|