Fix text form
This commit is contained in:
parent
f7ecb82cda
commit
a37387db5e
File diff suppressed because it is too large
Load Diff
|
|
@ -18,6 +18,10 @@
|
||||||
validator(value) {
|
validator(value) {
|
||||||
return value.hasOwnProperty('text');
|
return value.hasOwnProperty('text');
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
index: {
|
||||||
|
type: Number,
|
||||||
|
default: -1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
import {createLocalVue, shallowMount} from '@vue/test-utils'
|
||||||
|
import TextForm from '@/components/content-forms/TextForm';
|
||||||
|
|
||||||
|
const localVue = createLocalVue()
|
||||||
|
|
||||||
|
describe('TextForm.vue', () => {
|
||||||
|
|
||||||
|
it('should emit user input and its index', async () => {
|
||||||
|
const inputText = 'some value';
|
||||||
|
const props = {
|
||||||
|
value: { text: '' },
|
||||||
|
index: 1
|
||||||
|
};
|
||||||
|
const wrapper = shallowMount(TextForm, {
|
||||||
|
propsData: props,
|
||||||
|
localVue
|
||||||
|
});
|
||||||
|
|
||||||
|
const textInput = wrapper.find('[data-cy="text-form-input"]');
|
||||||
|
await textInput.setValue(inputText);
|
||||||
|
|
||||||
|
expect(wrapper.emitted()['text-change-value'][0]).toEqual([inputText, props.index]);
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
10225
client/yarn.lock
10225
client/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue