chore: Add an indicator for incoming emails (#1112)
This commit is contained in:
3
app/javascript/shared/constants/contentType.js
Normal file
3
app/javascript/shared/constants/contentType.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export const CONTENT_TYPES = {
|
||||
INCOMING_EMAIL: 'incoming_email',
|
||||
};
|
||||
9
app/javascript/shared/mixins/contentTypeMixin.js
Normal file
9
app/javascript/shared/mixins/contentTypeMixin.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import { CONTENT_TYPES } from '../constants/contentType';
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
isEmailContentType() {
|
||||
return this.contentType === CONTENT_TYPES.INCOMING_EMAIL;
|
||||
},
|
||||
},
|
||||
};
|
||||
32
app/javascript/shared/mixins/specs/contentTypeMixin.spec.js
Normal file
32
app/javascript/shared/mixins/specs/contentTypeMixin.spec.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import contentTypeMixin from '../contentTypeMixin';
|
||||
|
||||
describe('contentTypeMixin', () => {
|
||||
it('returns true if contentType is incoming_email', () => {
|
||||
const Component = {
|
||||
render() {},
|
||||
mixins: [contentTypeMixin],
|
||||
computed: {
|
||||
contentType() {
|
||||
return 'incoming_email';
|
||||
},
|
||||
},
|
||||
};
|
||||
const wrapper = shallowMount(Component);
|
||||
expect(wrapper.vm.isEmailContentType).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false if contentType is not incoming_email', () => {
|
||||
const Component = {
|
||||
render() {},
|
||||
mixins: [contentTypeMixin],
|
||||
computed: {
|
||||
contentType() {
|
||||
return 'input_select';
|
||||
},
|
||||
},
|
||||
};
|
||||
const wrapper = shallowMount(Component);
|
||||
expect(wrapper.vm.isEmailContentType).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user