2018-01-10 08:24:00 -05:00
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
2018-01-11 06:17:02 -05:00
|
|
|
it('renders a button for clipboard', () => {
|
2018-01-10 08:24:00 -05:00
|
|
|
expect(vm.$el.tagName).toEqual('BUTTON');
|
|
|
|
expect(vm.$el.getAttribute('data-clipboard-text')).toEqual('copy me');
|
2018-01-11 06:17:02 -05:00
|
|
|
expect(vm.$el.querySelector('i').className).toEqual('fa fa-clipboard');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have a tooltip with default values', () => {
|
2018-01-10 08:24:00 -05:00
|
|
|
expect(vm.$el.getAttribute('data-original-title')).toEqual('Copy this value into Clipboard!');
|
2018-01-11 06:17:02 -05:00
|
|
|
expect(vm.$el.getAttribute('data-placement')).toEqual('top');
|
|
|
|
expect(vm.$el.getAttribute('data-container')).toEqual(null);
|
2018-01-10 08:24:00 -05:00
|
|
|
});
|
|
|
|
});
|