Commit d215d688 authored by Sam Beckham's avatar Sam Beckham Committed by Vitaly Slobodin

Updates the design discussion buttons to match the design system

parent c9127868
<script> <script>
import { GlTooltipDirective, GlIcon, GlLoadingIcon, GlLink } from '@gitlab/ui'; import { GlButton, GlLink, GlTooltipDirective } from '@gitlab/ui';
import { ApolloMutation } from 'vue-apollo'; import { ApolloMutation } from 'vue-apollo';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
...@@ -26,15 +26,14 @@ export default { ...@@ -26,15 +26,14 @@ export default {
components: { components: {
ApolloMutation, ApolloMutation,
DesignNote, DesignNote,
DesignNotePin,
DesignNoteSignedOut, DesignNoteSignedOut,
ReplyPlaceholder,
DesignReplyForm, DesignReplyForm,
GlIcon, GlButton,
GlLoadingIcon,
GlLink, GlLink,
ToggleRepliesWidget, ReplyPlaceholder,
TimeAgoTooltip, TimeAgoTooltip,
DesignNotePin, ToggleRepliesWidget,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -239,18 +238,17 @@ export default { ...@@ -239,18 +238,17 @@ export default {
@error="$emit('update-note-error', $event)" @error="$emit('update-note-error', $event)"
> >
<template v-if="isLoggedIn && discussion.resolvable" #resolve-discussion> <template v-if="isLoggedIn && discussion.resolvable" #resolve-discussion>
<button <gl-button
v-gl-tooltip v-gl-tooltip
:class="{ 'is-active': discussion.resolved }"
:title="resolveCheckboxText"
:aria-label="resolveCheckboxText" :aria-label="resolveCheckboxText"
class="line-resolve-btn note-action-button gl-mr-3" :icon="resolveIconName"
:title="resolveCheckboxText"
:loading="isResolving"
category="tertiary"
data-testid="resolve-button" data-testid="resolve-button"
size="small"
@click.stop="toggleResolvedStatus" @click.stop="toggleResolvedStatus"
> />
<gl-icon v-if="!isResolving" :name="resolveIconName" data-testid="resolve-icon" />
<gl-loading-icon v-else size="sm" inline />
</button>
</template> </template>
<template v-if="discussion.resolved" #resolved-status> <template v-if="discussion.resolved" #resolved-status>
<p class="gl-text-gray-500 gl-font-sm gl-m-0 gl-mt-5" data-testid="resolved-message"> <p class="gl-text-gray-500 gl-font-sm gl-m-0 gl-mt-5" data-testid="resolved-message">
......
<script> <script>
import { import {
GlTooltipDirective,
GlIcon,
GlLink,
GlSafeHtmlDirective,
GlAvatar, GlAvatar,
GlAvatarLink, GlAvatarLink,
GlButton,
GlLink,
GlSafeHtmlDirective,
GlTooltipDirective,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { ApolloMutation } from 'vue-apollo'; import { ApolloMutation } from 'vue-apollo';
import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { getIdFromGraphQLId } from '~/graphql_shared/utils';
...@@ -22,14 +22,14 @@ export default { ...@@ -22,14 +22,14 @@ export default {
editCommentLabel: __('Edit comment'), editCommentLabel: __('Edit comment'),
}, },
components: { components: {
ApolloMutation,
DesignReplyForm,
GlAvatar, GlAvatar,
GlAvatarLink, GlAvatarLink,
TimelineEntryItem, GlButton,
TimeAgoTooltip,
DesignReplyForm,
ApolloMutation,
GlIcon,
GlLink, GlLink,
TimeAgoTooltip,
TimelineEntryItem,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -123,18 +123,17 @@ export default { ...@@ -123,18 +123,17 @@ export default {
</div> </div>
<div class="gl-display-flex gl-align-items-baseline"> <div class="gl-display-flex gl-align-items-baseline">
<slot name="resolve-discussion"></slot> <slot name="resolve-discussion"></slot>
<button <gl-button
v-if="isEditButtonVisible" v-if="isEditButtonVisible"
v-gl-tooltip v-gl-tooltip
type="button"
:title="$options.i18n.editCommentLabel"
:aria-label="$options.i18n.editCommentLabel" :aria-label="$options.i18n.editCommentLabel"
class="note-action-button btn btn-transparent qa-note-edit-button" :title="$options.i18n.editCommentLabel"
category="tertiary"
data-testid="note-edit" data-testid="note-edit"
icon="pencil"
size="small"
@click="isEditing = true" @click="isEditing = true"
> />
<gl-icon name="pencil" class="link-highlight" />
</button>
</div> </div>
</div> </div>
<template v-if="!isEditing"> <template v-if="!isEditing">
......
...@@ -31,7 +31,6 @@ describe('Design discussions component', () => { ...@@ -31,7 +31,6 @@ describe('Design discussions component', () => {
const findReplyForm = () => wrapper.find(DesignReplyForm); const findReplyForm = () => wrapper.find(DesignReplyForm);
const findRepliesWidget = () => wrapper.find(ToggleRepliesWidget); const findRepliesWidget = () => wrapper.find(ToggleRepliesWidget);
const findResolveButton = () => wrapper.find('[data-testid="resolve-button"]'); const findResolveButton = () => wrapper.find('[data-testid="resolve-button"]');
const findResolveIcon = () => wrapper.find('[data-testid="resolve-icon"]');
const findResolvedMessage = () => wrapper.find('[data-testid="resolved-message"]'); const findResolvedMessage = () => wrapper.find('[data-testid="resolved-message"]');
const findResolveLoadingIcon = () => wrapper.find(GlLoadingIcon); const findResolveLoadingIcon = () => wrapper.find(GlLoadingIcon);
const findResolveCheckbox = () => wrapper.find('[data-testid="resolve-checkbox"]'); const findResolveCheckbox = () => wrapper.find('[data-testid="resolve-checkbox"]');
...@@ -117,7 +116,7 @@ describe('Design discussions component', () => { ...@@ -117,7 +116,7 @@ describe('Design discussions component', () => {
}); });
it('does not render an icon to resolve a thread', () => { it('does not render an icon to resolve a thread', () => {
expect(findResolveIcon().exists()).toBe(false); expect(findResolveButton().exists()).toBe(false);
}); });
it('does not render a checkbox in reply form', async () => { it('does not render a checkbox in reply form', async () => {
...@@ -147,7 +146,7 @@ describe('Design discussions component', () => { ...@@ -147,7 +146,7 @@ describe('Design discussions component', () => {
}); });
it('renders a correct icon to resolve a thread', () => { it('renders a correct icon to resolve a thread', () => {
expect(findResolveIcon().props('name')).toBe('check-circle'); expect(findResolveButton().props('icon')).toBe('check-circle');
}); });
it('renders a checkbox with Resolve thread text in reply form', async () => { it('renders a checkbox with Resolve thread text in reply form', async () => {
...@@ -203,7 +202,7 @@ describe('Design discussions component', () => { ...@@ -203,7 +202,7 @@ describe('Design discussions component', () => {
}); });
it('renders a correct icon to resolve a thread', () => { it('renders a correct icon to resolve a thread', () => {
expect(findResolveIcon().props('name')).toBe('check-circle-filled'); expect(findResolveButton().props('icon')).toBe('check-circle-filled');
}); });
it('emit todo:toggle when discussion is resolved', async () => { it('emit todo:toggle when discussion is resolved', async () => {
......
...@@ -122,7 +122,7 @@ describe('Design note component', () => { ...@@ -122,7 +122,7 @@ describe('Design note component', () => {
}, },
}); });
findEditButton().trigger('click'); findEditButton().vm.$emit('click');
await nextTick(); await nextTick();
expect(findReplyForm().exists()).toBe(true); expect(findReplyForm().exists()).toBe(true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment