2019-04-05 22:02:39 -04:00
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2021-02-14 13:09:20 -05:00
|
|
|
import Vue from 'vue';
|
2019-12-09 07:07:58 -05:00
|
|
|
import urlComponent from '~/serverless/components/url.vue';
|
2019-05-19 15:55:04 -04:00
|
|
|
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
|
2019-01-21 19:00:16 -05:00
|
|
|
|
2020-12-23 19:10:25 -05:00
|
|
|
const createComponent = (uri) =>
|
2019-04-05 22:02:39 -04:00
|
|
|
shallowMount(Vue.extend(urlComponent), {
|
|
|
|
propsData: {
|
|
|
|
uri,
|
|
|
|
},
|
2019-05-19 15:55:04 -04:00
|
|
|
});
|
2019-01-21 19:00:16 -05:00
|
|
|
|
|
|
|
describe('urlComponent', () => {
|
|
|
|
it('should render correctly', () => {
|
|
|
|
const uri = 'http://testfunc.apps.example.com';
|
2019-05-19 15:55:04 -04:00
|
|
|
const wrapper = createComponent(uri);
|
|
|
|
const { vm } = wrapper;
|
2019-01-21 19:00:16 -05:00
|
|
|
|
|
|
|
expect(vm.$el.classList.contains('clipboard-group')).toBe(true);
|
2019-05-19 15:55:04 -04:00
|
|
|
expect(wrapper.find(ClipboardButton).attributes('text')).toEqual(uri);
|
2019-01-21 19:00:16 -05:00
|
|
|
|
2020-10-06 11:08:33 -04:00
|
|
|
expect(vm.$el.querySelector('[data-testid="url-text-field"]').innerHTML).toContain(uri);
|
2019-01-21 19:00:16 -05:00
|
|
|
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
});
|