feat: Custom fields in pre-chat form (#4189)
This commit is contained in:
@@ -16,6 +16,9 @@ export const getters = {
|
||||
getUIFlags(_state) {
|
||||
return _state.uiFlags;
|
||||
},
|
||||
getAttributes: _state => {
|
||||
return _state.records;
|
||||
},
|
||||
getAttributesByModel: _state => attributeModel => {
|
||||
return _state.records.filter(
|
||||
record => record.attribute_model === attributeModel
|
||||
|
||||
@@ -2,6 +2,26 @@ import { getters } from '../../attributes';
|
||||
import attributesList from './fixtures';
|
||||
|
||||
describe('#getters', () => {
|
||||
it('getAttributes', () => {
|
||||
const state = { records: attributesList };
|
||||
expect(getters.getAttributes(state)).toEqual([
|
||||
{
|
||||
attribute_display_name: 'Language',
|
||||
attribute_display_type: 1,
|
||||
attribute_description: 'The conversation language',
|
||||
attribute_key: 'language',
|
||||
attribute_model: 0,
|
||||
},
|
||||
{
|
||||
attribute_display_name: 'Language one',
|
||||
attribute_display_type: 2,
|
||||
attribute_description: 'The conversation language one',
|
||||
attribute_key: 'language_one',
|
||||
attribute_model: 1,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('getAttributesByModel', () => {
|
||||
const state = { records: attributesList };
|
||||
expect(getters.getAttributesByModel(state)(1)).toEqual([
|
||||
|
||||
Reference in New Issue
Block a user