summaryrefslogtreecommitdiff
path: root/spec/frontend/environments/environment_terminal_button_spec.js
blob: 058940c0e98ca1b02367ca820082b86f34a711bf (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
29
30
31
32
33
34
35
36
import { shallowMount } from '@vue/test-utils';
import TerminalComponent from '~/environments/components/environment_terminal_button.vue';

describe('Stop Component', () => {
  let wrapper;
  const terminalPath = '/path';

  const mountWithProps = props => {
    wrapper = shallowMount(TerminalComponent, {
      sync: false,
      attachToDocument: true,
      propsData: props,
    });
  };

  beforeEach(() => {
    mountWithProps({ terminalPath });
  });

  describe('computed', () => {
    it('title', () => {
      expect(wrapper.vm.title).toEqual('Terminal');
    });
  });

  it('should render a link to open a web terminal with the provided path', () => {
    expect(wrapper.is('a')).toBe(true);
    expect(wrapper.attributes('title')).toBe('Terminal');
    expect(wrapper.attributes('aria-label')).toBe('Terminal');
    expect(wrapper.attributes('href')).toBe(terminalPath);
  });

  it('should render a non-disabled button', () => {
    expect(wrapper.classes()).not.toContain('disabled');
  });
});