Welcome to mirror list, hosted at ThFree Co, Russian Federation.

issue_note_signed_out_widget_spec.js « components « notes « javascripts « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f20d9ce9268385bbd4b3ffc2e30050f30b42af35 (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
37
import Vue from 'vue';
import issueNoteSignedOut from '~/notes/components/issue_note_signed_out_widget.vue';
import store from '~/notes/stores';
import { notesDataMock } from '../mock_data';

describe('issue_note_signed_out_widget component', () => {
  let vm;

  beforeEach(() => {
    const Component = Vue.extend(issueNoteSignedOut);
    store.dispatch('setNotesData', notesDataMock);

    vm = new Component({
      store,
    }).$mount();
  });

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

  it('should render sign in link provided in the store', () => {
    expect(
      vm.$el.querySelector(`a[href="${notesDataMock.newSessionPath}"]`).textContent,
    ).toEqual('sign in');
  });

  it('should render register link provided in the store', () => {
    expect(
      vm.$el.querySelector(`a[href="${notesDataMock.registerPath}"]`).textContent,
    ).toEqual('register');
  });

  it('should render information text', () => {
    expect(vm.$el.textContent.replace(/\s+/g, ' ').trim()).toEqual('Please register or sign in to reply');
  });
});