Commit e331ca13 authored by Filipa Lacerda's avatar Filipa Lacerda

Add tooltip missing to clipboard component

Adds tests
parent dae93ef1
<script> <script>
import tooltip from '../directives/tooltip';
/** /**
* Falls back to the code used in `copy_to_clipboard.js` * Falls back to the code used in `copy_to_clipboard.js`
*/ */
export default { export default {
name: 'ClipboardButton', name: 'ClipboardButton',
directives: {
tooltip,
},
props: { props: {
text: { text: {
type: String, type: String,
...@@ -22,8 +26,9 @@ ...@@ -22,8 +26,9 @@
<button <button
type="button" type="button"
class="btn btn-transparent btn-clipboard" class="btn btn-transparent btn-clipboard"
:data-title="title" :title="title"
:data-clipboard-text="text" :data-clipboard-text="text"
v-tooltip
> >
<i <i
aria-hidden="true" aria-hidden="true"
......
import Vue from 'vue';
import clipboardButton from '~/vue_shared/components/clipboard_button.vue';
import mountComponent from '../../helpers/vue_mount_component_helper';
describe('clipboard button', () => {
let vm;
beforeEach(() => {
const Component = Vue.extend(clipboardButton);
vm = mountComponent(Component, {
text: 'copy me',
title: 'Copy this value into Clipboard!',
});
});
afterEach(() => {
vm.$destroy();
});
it('renders a button for clipboard with a tooltip', () => {
expect(vm.$el.tagName).toEqual('BUTTON');
expect(vm.$el.getAttribute('data-clipboard-text')).toEqual('copy me');
expect(vm.$el.getAttribute('data-original-title')).toEqual('Copy this value into Clipboard!');
});
});
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