mr_widget_archived_spec.js 936 字节
Newer Older
F
Fatih Acet 已提交
1
import Vue from 'vue';
2
import archivedComponent from '~/vue_merge_request_widget/components/states/mr_widget_archived.vue';
3
import mountComponent from 'spec/helpers/vue_mount_component_helper';
F
Fatih Acet 已提交
4 5

describe('MRWidgetArchived', () => {
6
  let vm;
F
Fatih Acet 已提交
7

8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
  beforeEach(() => {
    const Component = Vue.extend(archivedComponent);
    vm = mountComponent(Component);
  });

  afterEach(() => {
    vm.$destroy();
  });

  it('renders a ci status failed icon', () => {
    expect(vm.$el.querySelector('.ci-status-icon')).not.toBeNull();
  });

  it('renders a disabled button', () => {
    expect(vm.$el.querySelector('button').getAttribute('disabled')).toEqual('disabled');
    expect(vm.$el.querySelector('button').textContent.trim()).toEqual('Merge');
  });

  it('renders information', () => {
    expect(
      vm.$el.querySelector('.bold').textContent.trim(),
    ).toEqual('This project is archived, write access has been disabled');
F
Fatih Acet 已提交
30 31
  });
});