environment_stop_spec.js.es6 813 字节
Newer Older
1
require('../spec_helper');
2 3 4
require('vue');
require('environments/components/environment_stop');

F
Filipa Lacerda 已提交
5
describe('Stop Component', () => {
6
  preloadFixtures('static/environments/element.html.raw');
F
Filipa Lacerda 已提交
7 8 9 10

  let stopURL;
  let component;

F
Filipa Lacerda 已提交
11
  beforeEach(() => {
12
    loadFixtures('static/environments/element.html.raw');
F
Filipa Lacerda 已提交
13

F
Filipa Lacerda 已提交
14 15
    stopURL = '/stop';
    component = new window.gl.environmentsList.StopComponent({
F
Filipa Lacerda 已提交
16 17
      el: document.querySelector('.test-dom-element'),
      propsData: {
F
Filipa Lacerda 已提交
18
        stopUrl: stopURL,
F
Filipa Lacerda 已提交
19 20 21
      },
    });
  });
F
Filipa Lacerda 已提交
22

F
Filipa Lacerda 已提交
23 24 25
  it('should link to the provided URL', () => {
    expect(component.$el.getAttribute('href')).toEqual(stopURL);
  });
F
Filipa Lacerda 已提交
26

F
Filipa Lacerda 已提交
27 28
  it('should have a data-confirm attribute', () => {
    expect(component.$el.getAttribute('data-confirm')).toEqual('Are you sure you want to stop this environment?');
F
Filipa Lacerda 已提交
29
  });
F
Filipa Lacerda 已提交
30
});