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

27 lines
790 B
JavaScript
Raw Normal View History

2019-07-07 11:18:12 +05:30
import { shallowMount } from '@vue/test-utils';
2021-03-11 19:13:27 +05:30
import Vue from 'vue';
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
2021-03-08 18:12:59 +05:30
const createComponent = (uri) =>
2019-07-07 11:18:12 +05:30
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
2021-01-03 14:25:43 +05:30
expect(vm.$el.querySelector('[data-testid="url-text-field"]').innerHTML).toContain(uri);
2019-03-02 22:35:43 +05:30
vm.$destroy();
});
});