2019-03-02 22:35:43 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import urlComponent from '~/serverless/components/url.vue';
|
2019-07-07 11:18:12 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2019-09-04 21:01:54 +05:30
|
|
|
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
|
2019-05-30 16:15:17 +05:30
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
const createComponent = uri =>
|
|
|
|
shallowMount(Vue.extend(urlComponent), {
|
|
|
|
propsData: {
|
|
|
|
uri,
|
|
|
|
},
|
|
|
|
sync: false,
|
2019-09-04 21:01:54 +05:30
|
|
|
});
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
describe('urlComponent', () => {
|
|
|
|
it('should render correctly', () => {
|
|
|
|
const uri = 'http://testfunc.apps.example.com';
|
2019-09-04 21:01:54 +05:30
|
|
|
const wrapper = createComponent(uri);
|
|
|
|
const { vm } = wrapper;
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
expect(vm.$el.classList.contains('clipboard-group')).toBe(true);
|
2019-09-04 21:01:54 +05:30
|
|
|
expect(wrapper.find(ClipboardButton).attributes('text')).toEqual(uri);
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
expect(vm.$el.querySelector('.url-text-field').innerHTML).toEqual(uri);
|
|
|
|
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
});
|