Skip to content
Snippets Groups Projects
Commit 54baf5eb authored by Coung Ngo's avatar Coung Ngo
Browse files

Merge branch '408404-Update-work-item-note-actions.vue-to-GlDisclosure' into 'master'

Migrate "work_item_note_actions.vue" to GlDisclosure"

See merge request !118420



Merged-by: default avatarCoung Ngo <cngo@gitlab.com>
Approved-by: default avatarCoung Ngo <cngo@gitlab.com>
Approved-by: Deepika Guliani's avatarDeepika Guliani <dguliani@gitlab.com>
Reviewed-by: default avatarCoung Ngo <cngo@gitlab.com>
Co-authored-by: default avatarMughees Pervaiz <mr.mb@tuta.io>
parents 27069807 b3b5b5ee
No related branches found
No related tags found
2 merge requests!120936Draft: Debugging commit to trigger pipeline (DO NOT MERGE),!118420Migrate "work_item_note_actions.vue" to GlDisclosure"
Pipeline #869479940 passed with warnings
Pipeline: E2E Omnibus GitLab EE

#869499285

    Pipeline: GitLab

    #869499263

      Pipeline: E2E GDK

      #869488472

        <script>
        import { GlButton, GlIcon, GlTooltipDirective, GlDropdown, GlDropdownItem } from '@gitlab/ui';
        import {
        GlButton,
        GlIcon,
        GlTooltipDirective,
        GlDisclosureDropdown,
        GlDisclosureDropdownItem,
        } from '@gitlab/ui';
        import * as Sentry from '@sentry/browser';
        import { __, s__ } from '~/locale';
        import ReplyButton from '~/notes/components/note_actions/reply_button.vue';
        ......@@ -20,9 +26,9 @@ export default {
        components: {
        GlButton,
        GlIcon,
        GlDisclosureDropdown,
        GlDisclosureDropdownItem,
        ReplyButton,
        GlDropdown,
        GlDropdownItem,
        EmojiPicker: () => import('~/emoji/components/picker.vue'),
        },
        directives: {
        ......@@ -75,6 +81,7 @@ export default {
        : this.$options.i18n.assignUserText;
        },
        },
        methods: {
        async setAwardEmoji(name) {
        try {
        ......@@ -98,6 +105,10 @@ export default {
        Sentry.captureException(error);
        }
        },
        emitEvent(eventName) {
        this.$emit(eventName);
        this.$refs.dropdown.close();
        },
        },
        };
        </script>
        ......@@ -135,46 +146,54 @@ export default {
        :aria-label="$options.i18n.editButtonText"
        @click="$emit('startEditing')"
        />
        <gl-dropdown
        <gl-disclosure-dropdown
        ref="dropdown"
        v-gl-tooltip
        data-testid="work-item-note-actions"
        icon="ellipsis_v"
        text-sr-only
        right
        :text="$options.i18n.moreActionsText"
        placement="right"
        :toggle-text="$options.i18n.moreActionsText"
        :title="$options.i18n.moreActionsText"
        category="tertiary"
        no-caret
        >
        <gl-dropdown-item
        <gl-disclosure-dropdown-item
        v-if="canReportAbuse"
        data-testid="abuse-note-action"
        @click="$emit('reportAbuse')"
        @action="emitEvent('reportAbuse')"
        >
        {{ $options.i18n.reportAbuseText }}
        </gl-dropdown-item>
        <gl-dropdown-item
        <template #list-item>
        {{ $options.i18n.reportAbuseText }}
        </template>
        </gl-disclosure-dropdown-item>
        <gl-disclosure-dropdown-item
        data-testid="copy-link-action"
        :data-clipboard-text="noteUrl"
        @click="$emit('notifyCopyDone')"
        @action="emitEvent('notifyCopyDone')"
        >
        <span>{{ $options.i18n.copyLinkText }}</span>
        </gl-dropdown-item>
        <gl-dropdown-item
        <template #list-item>
        {{ $options.i18n.copyLinkText , }}
        </template>
        </gl-disclosure-dropdown-item>
        <gl-disclosure-dropdown-item
        v-if="showAssignUnassign"
        data-testid="assign-note-action"
        @click="$emit('assignUser')"
        @action="emitEvent('assignUser')"
        >
        {{ assignUserActionText }}
        </gl-dropdown-item>
        <gl-dropdown-item
        <template #list-item>
        {{ assignUserActionText }}
        </template>
        </gl-disclosure-dropdown-item>
        <gl-disclosure-dropdown-item
        v-if="showEdit"
        variant="danger"
        data-testid="delete-note-action"
        @click="$emit('deleteNote')"
        @action="emitEvent('deleteNote')"
        >
        {{ $options.i18n.deleteNoteText }}
        </gl-dropdown-item>
        </gl-dropdown>
        <template #list-item>
        <span class="gl-text-red-500">{{ $options.i18n.deleteNoteText }}</span>
        </template>
        </gl-disclosure-dropdown-item>
        </gl-disclosure-dropdown>
        </div>
        </template>
        import { GlDropdown } from '@gitlab/ui';
        import { GlDisclosureDropdown } from '@gitlab/ui';
        import { shallowMount } from '@vue/test-utils';
        import Vue from 'vue';
        import VueApollo from 'vue-apollo';
        ......@@ -18,7 +18,7 @@ describe('Work Item Note Actions', () => {
        const findReplyButton = () => wrapper.findComponent(ReplyButton);
        const findEditButton = () => wrapper.find('[data-testid="edit-work-item-note"]');
        const findEmojiButton = () => wrapper.find('[data-testid="note-emoji-button"]');
        const findDropdown = () => wrapper.findComponent(GlDropdown);
        const findDropdown = () => wrapper.findComponent(GlDisclosureDropdown);
        const findDeleteNoteButton = () => wrapper.find('[data-testid="delete-note-action"]');
        const findCopyLinkButton = () => wrapper.find('[data-testid="copy-link-action"]');
        const findAssignUnassignButton = () => wrapper.find('[data-testid="assign-note-action"]');
        ......@@ -61,6 +61,7 @@ describe('Work Item Note Actions', () => {
        },
        apolloProvider: createMockApollo([[addAwardEmojiMutation, addEmojiMutationResolver]]),
        });
        wrapper.vm.$refs.dropdown.close = jest.fn();
        };
        describe('reply button', () => {
        ......@@ -152,7 +153,7 @@ describe('Work Item Note Actions', () => {
        showEdit: true,
        });
        findDeleteNoteButton().vm.$emit('click');
        findDeleteNoteButton().vm.$emit('action');
        expect(wrapper.emitted('deleteNote')).toEqual([[]]);
        });
        ......@@ -167,7 +168,7 @@ describe('Work Item Note Actions', () => {
        });
        it('should emit `notifyCopyDone` event when copy link note action is clicked', () => {
        findCopyLinkButton().vm.$emit('click');
        findCopyLinkButton().vm.$emit('action');
        expect(wrapper.emitted('notifyCopyDone')).toEqual([[]]);
        });
        ......@@ -193,7 +194,7 @@ describe('Work Item Note Actions', () => {
        showAssignUnassign: true,
        });
        findAssignUnassignButton().vm.$emit('click');
        findAssignUnassignButton().vm.$emit('action');
        expect(wrapper.emitted('assignUser')).toEqual([[]]);
        });
        ......@@ -219,7 +220,7 @@ describe('Work Item Note Actions', () => {
        canReportAbuse: true,
        });
        findReportAbuseToAdminButton().vm.$emit('click');
        findReportAbuseToAdminButton().vm.$emit('action');
        expect(wrapper.emitted('reportAbuse')).toEqual([[]]);
        });
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment