mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
add unit tests to action radius select
This commit is contained in:
parent
4e76f0c712
commit
28e92c25b7
37
webapp/components/Select/ActionRadiusSelect.spec.js
Normal file
37
webapp/components/Select/ActionRadiusSelect.spec.js
Normal file
@ -0,0 +1,37 @@
|
||||
import { shallowMount } from '@vue/test-utils'
|
||||
import ActionRadiusSelect from './ActionRadiusSelect'
|
||||
|
||||
const localVue = global.localVue
|
||||
const propsData = { value: 'regional' }
|
||||
|
||||
describe('ActionRadiusSelect.', () => {
|
||||
let wrapper
|
||||
let mocks
|
||||
|
||||
beforeEach(() => {
|
||||
mocks = {
|
||||
$t: jest.fn(),
|
||||
}
|
||||
})
|
||||
|
||||
describe('mount', () => {
|
||||
const Wrapper = () => {
|
||||
return shallowMount(ActionRadiusSelect, { propsData, mocks, localVue })
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
it('renders the select', () => {
|
||||
expect(wrapper.findComponent(ActionRadiusSelect).exists()).toBe(true)
|
||||
})
|
||||
|
||||
describe('when an option is selected', () => {
|
||||
it('emits a change event with the new value', () => {
|
||||
const select = wrapper.find('select')
|
||||
select.trigger('change')
|
||||
expect(wrapper.emitted().change[0]).toEqual(['regional'])
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user