diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-04 21:09:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-04 21:09:51 +0300 |
commit | bd979acf95124119d41f75d34cab231229f4dd81 (patch) | |
tree | a7ce5127c8ab6d42b27aa8342889c54d2f0090b2 /spec/frontend/notes | |
parent | 4bdfcf93f224edb9c4daff90d95b0c6c92766ea3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/notes')
-rw-r--r-- | spec/frontend/notes/components/comment_form_spec.js | 4 | ||||
-rw-r--r-- | spec/frontend/notes/components/note_actions_spec.js | 35 | ||||
-rw-r--r-- | spec/frontend/notes/components/note_form_spec.js | 4 |
3 files changed, 24 insertions, 19 deletions
diff --git a/spec/frontend/notes/components/comment_form_spec.js b/spec/frontend/notes/components/comment_form_spec.js index fb64551c76b..70f25afc5ba 100644 --- a/spec/frontend/notes/components/comment_form_spec.js +++ b/spec/frontend/notes/components/comment_form_spec.js @@ -264,13 +264,13 @@ describe('issue_comment_form component', () => { it('hides content editor switcher if feature flag content_editor_on_issues is off', () => { mountComponent({ mountFunction: mount, features: { contentEditorOnIssues: false } }); - expect(wrapper.text()).not.toContain('Rich text'); + expect(wrapper.text()).not.toContain('Switch to rich text'); }); it('shows content editor switcher if feature flag content_editor_on_issues is on', () => { mountComponent({ mountFunction: mount, features: { contentEditorOnIssues: true } }); - expect(wrapper.text()).toContain('Rich text'); + expect(wrapper.text()).toContain('Switch to rich text'); }); describe('textarea', () => { diff --git a/spec/frontend/notes/components/note_actions_spec.js b/spec/frontend/notes/components/note_actions_spec.js index 63286927d53..879bada4aee 100644 --- a/spec/frontend/notes/components/note_actions_spec.js +++ b/spec/frontend/notes/components/note_actions_spec.js @@ -1,9 +1,10 @@ -import { mount, createWrapper } from '@vue/test-utils'; +import { GlDisclosureDropdown, GlDisclosureDropdownItem } from '@gitlab/ui'; +import { mount } from '@vue/test-utils'; import AxiosMockAdapter from 'axios-mock-adapter'; import { nextTick } from 'vue'; +import { stubComponent } from 'helpers/stub_component'; import { TEST_HOST } from 'spec/test_constants'; import axios from '~/lib/utils/axios_utils'; -import { BV_HIDE_TOOLTIP } from '~/lib/utils/constants'; import noteActions from '~/notes/components/note_actions.vue'; import { NOTEABLE_TYPE_MAPPING } from '~/notes/constants'; import TimelineEventButton from '~/notes/components/note_actions/timeline_event_button.vue'; @@ -19,6 +20,8 @@ describe('noteActions', () => { let actions; let axiosMock; + const mockCloseDropdown = jest.fn(); + const findUserAccessRoleBadge = (idx) => wrapper.findAllComponents(UserAccessRoleBadge).at(idx); const findUserAccessRoleBadgeText = (idx) => findUserAccessRoleBadge(idx).text().trim(); const findTimelineButton = () => wrapper.findComponent(TimelineEventButton); @@ -45,6 +48,14 @@ describe('noteActions', () => { store, propsData, computed, + stubs: { + GlDisclosureDropdown: stubComponent(GlDisclosureDropdown, { + methods: { + close: mockCloseDropdown, + }, + }), + GlDisclosureDropdownItem, + }, }); }; @@ -144,17 +155,6 @@ describe('noteActions', () => { expect(wrapper.find('.js-note-delete').exists()).toBe(true); }); - it('closes tooltip when dropdown opens', async () => { - wrapper.find('.more-actions-toggle').trigger('click'); - - const rootWrapper = createWrapper(wrapper.vm.$root); - - await nextTick(); - const emitted = Object.keys(rootWrapper.emitted()); - - expect(emitted).toEqual([BV_HIDE_TOOLTIP]); - }); - it('should not be possible to assign or unassign the comment author in a merge request', () => { const assignUserButton = wrapper.find('[data-testid="assign-user"]'); expect(assignUserButton.exists()).toBe(false); @@ -175,6 +175,11 @@ describe('noteActions', () => { const { resolveButton } = wrapper.vm.$refs; expect(resolveButton.$el.getAttribute('title')).toBe(`Resolved by ${complexUnescapedName}`); }); + + it('closes the dropdown', () => { + findReportAbuseButton().vm.$emit('action'); + expect(mockCloseDropdown).toHaveBeenCalled(); + }); }); }); @@ -401,13 +406,13 @@ describe('noteActions', () => { }); it('opens the drawer when report abuse button is clicked', async () => { - await findReportAbuseButton().trigger('click'); + await findReportAbuseButton().vm.$emit('action'); expect(findAbuseCategorySelector().props('showDrawer')).toEqual(true); }); it('closes the drawer', async () => { - await findReportAbuseButton().trigger('click'); + await findReportAbuseButton().vm.$emit('action'); findAbuseCategorySelector().vm.$emit('close-drawer'); await nextTick(); diff --git a/spec/frontend/notes/components/note_form_spec.js b/spec/frontend/notes/components/note_form_spec.js index 9423af4f058..b5b33607282 100644 --- a/spec/frontend/notes/components/note_form_spec.js +++ b/spec/frontend/notes/components/note_form_spec.js @@ -66,13 +66,13 @@ describe('issue_note_form component', () => { it('hides content editor switcher if feature flag content_editor_on_issues is off', () => { createComponentWrapper({}, { contentEditorOnIssues: false }); - expect(wrapper.text()).not.toContain('Rich text'); + expect(wrapper.text()).not.toContain('Switch to rich text'); }); it('shows content editor switcher if feature flag content_editor_on_issues is on', () => { createComponentWrapper({}, { contentEditorOnIssues: true }); - expect(wrapper.text()).toContain('Rich text'); + expect(wrapper.text()).toContain('Switch to rich text'); }); describe('conflicts editing', () => { |