Commit eb95fe01 authored by Frédéric Caplette's avatar Frédéric Caplette

Merge branch '352128-fix-identifiers-validation' into 'master'

Fix vulnerability validation bug

See merge request gitlab-org/gitlab!81509
parents 151e980c 063baf20
...@@ -21,6 +21,11 @@ export default { ...@@ -21,6 +21,11 @@ export default {
identifiers: [{ identifierCode: '', identifierUrl: '' }], identifiers: [{ identifierCode: '', identifierUrl: '' }],
}; };
}, },
watch: {
identifiers() {
this.emitChanges();
},
},
methods: { methods: {
emitChanges() { emitChanges() {
this.$emit('change', { this.$emit('change', {
...@@ -35,7 +40,6 @@ export default { ...@@ -35,7 +40,6 @@ export default {
}, },
removeIdentifier(index) { removeIdentifier(index) {
this.identifiers.splice(index, 1); this.identifiers.splice(index, 1);
this.emitChanges();
}, },
// null is when the user didn't input anything yet // null is when the user didn't input anything yet
// false when the user provided invalid input and // false when the user provided invalid input and
......
...@@ -80,6 +80,13 @@ describe('New vulnerability - Section Identifiers', () => { ...@@ -80,6 +80,13 @@ describe('New vulnerability - Section Identifiers', () => {
expect(findIdentifierRows()).toHaveLength(2); expect(findIdentifierRows()).toHaveLength(2);
expect(wrapper.emitted('change')[0][0]).toEqual({
identifiers: [
{ name: '', url: '' },
{ name: '', url: '' },
],
});
wrapper.findByLabelText('Remove identifier row').trigger('click'); wrapper.findByLabelText('Remove identifier row').trigger('click');
await nextTick(); 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