summaryrefslogtreecommitdiff
path: root/spec/javascripts/serverless/components/url_spec.js
blob: 21a879a49bb9205b818fa0661623b3c3e5b1ee9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Vue from 'vue';

import urlComponent from '~/serverless/components/url.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';

const createComponent = uri => {
  const component = Vue.extend(urlComponent);

  return mountComponent(component, {
    uri,
  });
};

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);
    expect(vm.$el.querySelector('.js-clipboard-btn').getAttribute('data-clipboard-text')).toEqual(
      uri,
    );

    expect(vm.$el.querySelector('.url-text-field').innerHTML).toEqual(uri);

    vm.$destroy();
  });
});