Commit 063baf20 authored by Savas Vedova's avatar Savas Vedova Committed by Frédéric Caplette

Fix vulnerability validation bug

Emit changes when a new row is added so that validation works properly.
parent 9d954d9e
......@@ -21,6 +21,11 @@ export default {
identifiers: [{ identifierCode: '', identifierUrl: '' }],
};
},
watch: {
identifiers() {
this.emitChanges();
},
},
methods: {
emitChanges() {
this.$emit('change', {
......@@ -35,7 +40,6 @@ export default {
},
removeIdentifier(index) {
this.identifiers.splice(index, 1);
this.emitChanges();
},
// null is when the user didn't input anything yet
// false when the user provided invalid input and
......
......@@ -80,6 +80,13 @@ describe('New vulnerability - Section Identifiers', () => {
expect(findIdentifierRows()).toHaveLength(2);
expect(wrapper.emitted('change')[0][0]).toEqual({
identifiers: [
{ name: '', url: '' },
{ name: '', url: '' },
],
});
wrapper.findByLabelText('Remove identifier row').trigger('click');
await nextTick();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment