From 49ef44656188f7fe4b96c2ed22d886c17c09dbe3 Mon Sep 17 00:00:00 2001 From: Artur Fedorov <afedorov@gitlab.com> Date: Wed, 5 Mar 2025 18:23:55 +0100 Subject: [PATCH] Fix Vue 3 specs Correct data setting and store initialisation EE: true --- .../vulnerabilities/components/related_issues.vue | 5 +++-- ee/spec/frontend/vulnerabilities/related_issues_spec.js | 9 ++++++--- scripts/frontend/quarantined_vue3_specs.txt | 1 - 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ee/app/assets/javascripts/vulnerabilities/components/related_issues.vue b/ee/app/assets/javascripts/vulnerabilities/components/related_issues.vue index 987a27d2aac7..835a371be120 100644 --- a/ee/app/assets/javascripts/vulnerabilities/components/related_issues.vue +++ b/ee/app/assets/javascripts/vulnerabilities/components/related_issues.vue @@ -58,16 +58,17 @@ export default { }, }, data() { - this.store = new RelatedIssuesStore(); + const store = new RelatedIssuesStore(); return { isProcessingAction: false, - state: this.store.state, + state: store.state, isFetching: false, isSubmitting: false, isFormVisible: false, errorMessage: null, inputValue: '', + store, }; }, computed: { diff --git a/ee/spec/frontend/vulnerabilities/related_issues_spec.js b/ee/spec/frontend/vulnerabilities/related_issues_spec.js index 49658737ed41..84eebbec49bb 100644 --- a/ee/spec/frontend/vulnerabilities/related_issues_spec.js +++ b/ee/spec/frontend/vulnerabilities/related_issues_spec.js @@ -198,9 +198,10 @@ describe('Vulnerability related issues component', () => { data: { inputValue: 'some input value', isFormVisible: true, - state: { pendingReferences: ['135', '246'] }, + state: { pendingReferences: ['135', '246'], relatedIssues: [] }, }, }); + blockEmit('addIssuableFormCancel'); await nextTick(); @@ -215,7 +216,7 @@ describe('Vulnerability related issues component', () => { const pendingReferences = ['135', '246']; const untouchedRawReferences = ['357', '468']; const touchedReference = 'touchedReference'; - createWrapper({ data: { state: { pendingReferences } } }); + createWrapper({ data: { state: { pendingReferences, relatedIssues: [] } } }); blockEmit('addIssuableFormInput', { untouchedRawReferences, touchedReference }); await nextTick(); @@ -235,7 +236,9 @@ describe('Vulnerability related issues component', () => { }); it('removes pending reference', async () => { - createWrapper({ data: { state: { pendingReferences: ['135', '246', '357'] } } }); + createWrapper({ + data: { state: { pendingReferences: ['135', '246', '357'], relatedIssues: [] } }, + }); blockEmit('pendingIssuableRemoveRequest', 1); await nextTick(); diff --git a/scripts/frontend/quarantined_vue3_specs.txt b/scripts/frontend/quarantined_vue3_specs.txt index 00d8232eb6ac..c22bcee6b880 100644 --- a/scripts/frontend/quarantined_vue3_specs.txt +++ b/scripts/frontend/quarantined_vue3_specs.txt @@ -87,7 +87,6 @@ ee/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_containe ee/spec/frontend/vue_shared/components/groups_list/groups_list_item_spec.js ee/spec/frontend/vue_shared/components/projects_list/projects_list_item_spec.js ee/spec/frontend/vulnerabilities/generic_report/report_item_graphql_spec.js -ee/spec/frontend/vulnerabilities/related_issues_spec.js spec/frontend/__helpers__/vue_test_utils_helper_spec.js spec/frontend/access_tokens/index_spec.js spec/frontend/admin/abuse_report/components/reported_content_spec.js -- GitLab