diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-01 18:09:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-01 18:09:44 +0000 |
commit | 68d5cc2d9d162def465657d4696eb58e9b3906a7 (patch) | |
tree | 519bd74d24a4cb97dea4c9041d192156eb6263a6 /spec/frontend/issuable | |
parent | dd5d37c7f69039a2f3bcca188cedcd95cae66139 (diff) | |
download | gitlab-ce-68d5cc2d9d162def465657d4696eb58e9b3906a7.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/issuable')
-rw-r--r-- | spec/frontend/issuable/components/csv_export_modal_spec.js | 32 | ||||
-rw-r--r-- | spec/frontend/issuable/components/csv_import_modal_spec.js | 4 |
2 files changed, 23 insertions, 13 deletions
diff --git a/spec/frontend/issuable/components/csv_export_modal_spec.js b/spec/frontend/issuable/components/csv_export_modal_spec.js index ad4abda6912..f798f87b6b2 100644 --- a/spec/frontend/issuable/components/csv_export_modal_spec.js +++ b/spec/frontend/issuable/components/csv_export_modal_spec.js @@ -1,7 +1,8 @@ -import { GlModal, GlIcon, GlButton } from '@gitlab/ui'; +import { GlModal, GlIcon } from '@gitlab/ui'; import { mount } from '@vue/test-utils'; import { stubComponent } from 'helpers/stub_component'; import CsvExportModal from '~/issuable/components/csv_export_modal.vue'; +import { __ } from '~/locale'; describe('CsvExportModal', () => { let wrapper; @@ -34,7 +35,6 @@ describe('CsvExportModal', () => { const findModal = () => wrapper.findComponent(GlModal); const findIcon = () => wrapper.findComponent(GlIcon); - const findButton = () => wrapper.findComponent(GlButton); describe('template', () => { describe.each` @@ -47,11 +47,25 @@ describe('CsvExportModal', () => { }); it('displays the modal title "$modalTitle"', () => { - expect(findModal().text()).toContain(modalTitle); + expect(findModal().props('title')).toBe(modalTitle); }); - it('displays the button with title "$modalTitle"', () => { - expect(findButton().text()).toBe(modalTitle); + it('displays the primary button with title "$modalTitle" and href', () => { + expect(findModal().props('actionPrimary')).toMatchObject({ + text: modalTitle, + attributes: { + href: 'export/csv/path', + variant: 'confirm', + 'data-method': 'post', + 'data-qa-selector': `export_${issuableType}_button`, + 'data-track-action': 'click_button', + 'data-track-label': `export_${issuableType}_csv`, + }, + }); + }); + + it('displays the cancel button', () => { + expect(findModal().props('actionCancel')).toEqual({ text: __('Cancel') }); }); }); @@ -72,13 +86,5 @@ describe('CsvExportModal', () => { ); }); }); - - describe('primary button', () => { - it('passes the exportCsvPath to the button', () => { - const exportCsvPath = '/gitlab-org/gitlab-test/-/issues/export_csv'; - wrapper = createComponent({ props: { exportCsvPath } }); - expect(findButton().attributes('href')).toBe(exportCsvPath); - }); - }); }); }); diff --git a/spec/frontend/issuable/components/csv_import_modal_spec.js b/spec/frontend/issuable/components/csv_import_modal_spec.js index f4636fd7e6a..6e954c91f46 100644 --- a/spec/frontend/issuable/components/csv_import_modal_spec.js +++ b/spec/frontend/issuable/components/csv_import_modal_spec.js @@ -76,6 +76,10 @@ describe('CsvImportModal', () => { expect(formSubmitSpy).toHaveBeenCalled(); }); + + it('displays the cancel button', () => { + expect(findModal().props('actionCancel')).toEqual({ text: __('Cancel') }); + }); }); }); }); |