2019-03-02 22:35:43 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import urlComponent from '~/serverless/components/url.vue';
|
2019-05-18 00:54:41 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2019-03-02 22:35:43 +05:30
|
|
|
|
2019-05-18 00:54:41 +05:30
|
|
|
const createComponent = uri =>
|
|
|
|
shallowMount(Vue.extend(urlComponent), {
|
|
|
|
propsData: {
|
|
|
|
uri,
|
|
|
|
},
|
|
|
|
sync: false,
|
|
|
|
}).vm;
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
describe('urlComponent', () => {
|
|
|
|
it('should render correctly', () => {
|
|
|
|
const uri = 'http://testfunc.apps.example.com';
|
|
|
|
const vm = createComponent(uri);
|
|
|
|
|
|
|
|
expect(vm.$el.classList.contains('clipboard-group')).toBe(true);
|
2019-05-18 00:54:41 +05:30
|
|
|
expect(vm.$el.querySelector('clipboardbutton-stub').getAttribute('text')).toEqual(uri);
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
expect(vm.$el.querySelector('.url-text-field').innerHTML).toEqual(uri);
|
|
|
|
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
});
|