Commit 6d4e3734 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'winh-service-desk-clipboard' into 'master'

Replace clipboard icon in Service Desk settings

Closes #6988

See merge request gitlab-org/gitlab-ee!6643
parents 6ac88596 dbc6cfb6
<script> <script>
import tooltip from '~/vue_shared/directives/tooltip'; import tooltip from '~/vue_shared/directives/tooltip';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
export default { export default {
...@@ -7,6 +8,11 @@ ...@@ -7,6 +8,11 @@
directives: { directives: {
tooltip, tooltip,
}, },
components: {
ClipboardButton,
},
props: { props: {
isEnabled: { isEnabled: {
type: Boolean, type: Boolean,
...@@ -59,18 +65,11 @@ ...@@ -59,18 +65,11 @@
> >
{{ incomingEmail }} {{ incomingEmail }}
</span> </span>
<button <clipboard-button
v-tooltip :title="__('Copy incoming email address to clipboard')"
:data-clipboard-text="incomingEmail" :text="incomingEmail"
type="button" css-class="btn btn-clipboard btn-transparent"
class="btn btn-clipboard btn-transparent" />
title="Copy incoming email address to clipboard"
>
<i
class="fa fa-clipboard"
aria-hidden="true">
</i>
</button>
</template> </template>
<template v-else> <template v-else>
<i <i
......
---
title: Replace clipboard icon in Service Desk settings
merge_request: 6643
author:
type: changed
...@@ -44,20 +44,28 @@ describe('ServiceDeskSetting', () => { ...@@ -44,20 +44,28 @@ describe('ServiceDeskSetting', () => {
}); });
describe('with incomingEmail', () => { describe('with incomingEmail', () => {
const incomingEmail = 'foo@bar.com';
beforeEach(() => { beforeEach(() => {
vm = new ServiceDeskSetting({ vm = new ServiceDeskSetting({
propsData: { propsData: {
isEnabled: true, isEnabled: true,
incomingEmail: 'foo@bar.com', incomingEmail,
}, },
}).$mount(); }).$mount();
}); });
it('should see email', () => { it('should see email', () => {
expect(vm.$refs['service-desk-incoming-email'].textContent.trim()).toEqual('foo@bar.com'); expect(vm.$refs['service-desk-incoming-email'].textContent.trim()).toEqual(incomingEmail);
expect(vm.$el.querySelector('.fa-spinner')).toBeNull(); expect(vm.$el.querySelector('.fa-spinner')).toBeNull();
expect(vm.$el.querySelector('.fa-exclamation-circle')).toBeNull(); expect(vm.$el.querySelector('.fa-exclamation-circle')).toBeNull();
}); });
it('renders a copy to clipboard button', () => {
const button = vm.$el.querySelector('.btn-clipboard');
expect(button).not.toBe(null);
expect(button.dataset.clipboardText).toBe(incomingEmail);
});
}); });
}); });
......
...@@ -2054,6 +2054,9 @@ msgstr "" ...@@ -2054,6 +2054,9 @@ msgstr ""
msgid "Copy file path to clipboard" msgid "Copy file path to clipboard"
msgstr "" msgstr ""
msgid "Copy incoming email address to clipboard"
msgstr ""
msgid "Copy reference to clipboard" msgid "Copy reference to clipboard"
msgstr "" msgstr ""
......
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