diff options
Diffstat (limited to 'spec/frontend/tags/components/delete_tag_modal_spec.js')
-rw-r--r-- | spec/frontend/tags/components/delete_tag_modal_spec.js | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/spec/frontend/tags/components/delete_tag_modal_spec.js b/spec/frontend/tags/components/delete_tag_modal_spec.js index 5a3104fad9b..682145c8d6c 100644 --- a/spec/frontend/tags/components/delete_tag_modal_spec.js +++ b/spec/frontend/tags/components/delete_tag_modal_spec.js @@ -5,6 +5,7 @@ import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; import DeleteTagModal from '~/tags/components/delete_tag_modal.vue'; import eventHub from '~/tags/event_hub'; +import { I18N_DELETE_TAG_MODAL } from '~/tags/constants'; let wrapper; @@ -52,18 +53,17 @@ const findForm = () => wrapper.find('form'); describe('Delete tag modal', () => { describe('Deleting a regular tag', () => { - const expectedTitle = 'Delete tag. Are you ABSOLUTELY SURE?'; - const expectedMessage = "You're about to permanently delete the tag test-tag."; + const expectedMessage = 'Deleting the test-tag tag cannot be undone.'; beforeEach(() => { createComponent(); }); it('renders the modal correctly', () => { - expect(findModal().props('title')).toBe(expectedTitle); + expect(findModal().props('title')).toBe(I18N_DELETE_TAG_MODAL.modalTitle); expect(findModalMessage().text()).toMatchInterpolatedText(expectedMessage); - expect(findCancelButton().text()).toBe('Cancel, keep tag'); - expect(findDeleteButton().text()).toBe('Yes, delete tag'); + expect(findCancelButton().text()).toBe(I18N_DELETE_TAG_MODAL.cancelButtonText); + expect(findDeleteButton().text()).toBe(I18N_DELETE_TAG_MODAL.deleteButtonText); expect(findForm().attributes('action')).toBe(path); }); @@ -92,11 +92,8 @@ describe('Delete tag modal', () => { }); describe('Deleting a protected tag (for owner or maintainer)', () => { - const expectedTitleProtected = 'Delete protected tag. Are you ABSOLUTELY SURE?'; - const expectedMessageProtected = - "You're about to permanently delete the protected tag test-tag."; - const expectedConfirmationText = - 'After you confirm and select Yes, delete protected tag, you cannot recover this tag. Please type the following to confirm: test-tag'; + const expectedMessage = 'Deleting the test-tag protected tag cannot be undone.'; + const expectedConfirmationText = 'Please type the following to confirm: test-tag'; beforeEach(() => { createComponent({ isProtected: true }); @@ -104,11 +101,11 @@ describe('Delete tag modal', () => { describe('rendering the modal correctly for a protected tag', () => { it('sets the modal title for a protected tag', () => { - expect(findModal().props('title')).toBe(expectedTitleProtected); + expect(findModal().props('title')).toBe(I18N_DELETE_TAG_MODAL.modalTitleProtectedTag); }); it('renders the correct text in the modal message', () => { - expect(findModalMessage().text()).toMatchInterpolatedText(expectedMessageProtected); + expect(findModalMessage().text()).toMatchInterpolatedText(expectedMessage); }); it('renders the protected tag name confirmation form with expected text and action', () => { @@ -117,8 +114,8 @@ describe('Delete tag modal', () => { }); it('renders the buttons with the correct button text', () => { - expect(findCancelButton().text()).toBe('Cancel, keep tag'); - expect(findDeleteButton().text()).toBe('Yes, delete protected tag'); + expect(findCancelButton().text()).toBe(I18N_DELETE_TAG_MODAL.cancelButtonText); + expect(findDeleteButton().text()).toBe(I18N_DELETE_TAG_MODAL.deleteButtonTextProtectedTag); }); }); |