gitlab-org--gitlab-foss/spec/frontend/serverless/components/url_spec.js

27 lines
788 B
JavaScript
Raw Normal View History

import Vue from 'vue';
2019-04-05 22:02:39 -04:00
import { shallowMount } from '@vue/test-utils';
import urlComponent from '~/serverless/components/url.vue';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
2019-04-05 22:02:39 -04:00
const createComponent = uri =>
shallowMount(Vue.extend(urlComponent), {
propsData: {
uri,
},
});
describe('urlComponent', () => {
it('should render correctly', () => {
const uri = 'http://testfunc.apps.example.com';
const wrapper = createComponent(uri);
const { vm } = wrapper;
expect(vm.$el.classList.contains('clipboard-group')).toBe(true);
expect(wrapper.find(ClipboardButton).attributes('text')).toEqual(uri);
expect(vm.$el.querySelector('[data-testid="url-text-field"]').innerHTML).toContain(uri);
vm.$destroy();
});
});