debian-mirror-gitlab/spec/frontend/serverless/components/url_spec.js

27 lines
771 B
JavaScript
Raw Normal View History

2019-03-02 22:35:43 +05:30
import Vue from 'vue';
2019-07-07 11:18:12 +05:30
import { shallowMount } from '@vue/test-utils';
2020-01-01 13:55:28 +05:30
import urlComponent from '~/serverless/components/url.vue';
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,
},
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();
});
});