diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-28 03:09:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-28 03:09:12 +0300 |
commit | 9869a443f843b6992981eecc5935d25e0f28aee4 (patch) | |
tree | ab3b6c631c283e410e9387598ddd769602a4f5d2 /spec | |
parent | 370edfec486da54278725de2853913c3d5456145 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/frontend/issues/show/components/header_actions_spec.js | 36 | ||||
-rw-r--r-- | spec/support/formatters/json_formatter.rb | 2 |
2 files changed, 35 insertions, 3 deletions
diff --git a/spec/frontend/issues/show/components/header_actions_spec.js b/spec/frontend/issues/show/components/header_actions_spec.js index 9a503a2d882..8a98b2b702a 100644 --- a/spec/frontend/issues/show/components/header_actions_spec.js +++ b/spec/frontend/issues/show/components/header_actions_spec.js @@ -1,12 +1,20 @@ import Vue, { nextTick } from 'vue'; -import { GlDropdownItem, GlLink, GlModal, GlButton } from '@gitlab/ui'; +import { GlDropdown, GlDropdownItem, GlLink, GlModal, GlButton } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import Vuex from 'vuex'; import VueApollo from 'vue-apollo'; import waitForPromises from 'helpers/wait_for_promises'; import { mockTracking } from 'helpers/tracking_helper'; import { createAlert, VARIANT_SUCCESS } from '~/alert'; -import { STATUS_CLOSED, STATUS_OPEN, TYPE_INCIDENT, TYPE_ISSUE } from '~/issues/constants'; +import { + STATUS_CLOSED, + STATUS_OPEN, + TYPE_INCIDENT, + TYPE_ISSUE, + TYPE_TEST_CASE, + TYPE_ALERT, + TYPE_MERGE_REQUEST, +} from '~/issues/constants'; import DeleteIssueModal from '~/issues/show/components/delete_issue_modal.vue'; import AbuseCategorySelector from '~/abuse_reports/components/abuse_category_selector.vue'; import HeaderActions from '~/issues/show/components/header_actions.vue'; @@ -14,6 +22,7 @@ import { ISSUE_STATE_EVENT_CLOSE, ISSUE_STATE_EVENT_REOPEN } from '~/issues/show import issuesEventHub from '~/issues/show/event_hub'; import promoteToEpicMutation from '~/issues/show/queries/promote_to_epic.mutation.graphql'; import * as urlUtility from '~/lib/utils/url_utility'; +import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; import eventHub from '~/notes/event_hub'; import createStore from '~/notes/stores'; import createMockApollo from 'helpers/mock_apollo_helper'; @@ -690,4 +699,27 @@ describe('HeaderActions component', () => { }, ); }); + + describe('issue type text', () => { + it.each` + issueType | expectedText + ${TYPE_ISSUE} | ${'issue'} + ${TYPE_INCIDENT} | ${'incident'} + ${TYPE_MERGE_REQUEST} | ${'merge request'} + ${TYPE_ALERT} | ${'alert'} + ${TYPE_TEST_CASE} | ${'test case'} + ${'unknown'} | ${'unknown'} + `('$issueType', ({ issueType, expectedText }) => { + wrapper = mountComponent({ + movedMrSidebarEnabled: true, + props: { issueType, issuableEmailAddress: 'mock-email-address' }, + }); + + expect(wrapper.findComponent(GlDropdown).attributes('text')).toBe( + `${capitalizeFirstCharacter(expectedText)} actions`, + ); + expect(findDropdownBy('copy-email').text()).toBe(`Copy ${expectedText} email address`); + expect(findDesktopDropdownItems().at(0).text()).toBe(`New related ${expectedText}`); + }); + }); }); diff --git a/spec/support/formatters/json_formatter.rb b/spec/support/formatters/json_formatter.rb index f477d5e9e6a..1fb0c7c91ec 100644 --- a/spec/support/formatters/json_formatter.rb +++ b/spec/support/formatters/json_formatter.rb @@ -29,7 +29,7 @@ module Support message: exception.message } - hash[:backtrace] = notification.formatted_backtrace if notification.respond_to?(:backtrace) + hash[:backtrace] = notification.formatted_backtrace if notification.respond_to?(:formatted_backtrace) if notification.respond_to?(:message_lines) hash[:message_lines] = strip_ansi_codes(notification.message_lines) |