diff --git a/webapp/components/Select/ActionRadiusSelect.spec.js b/webapp/components/Select/ActionRadiusSelect.spec.js new file mode 100644 index 000000000..7629ac788 --- /dev/null +++ b/webapp/components/Select/ActionRadiusSelect.spec.js @@ -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']) + }) + }) + }) +})