debian-mirror-gitlab/spec/frontend/notes/components/note_signed_out_widget_spec.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-03-17 18:26:18 +05:30
import Vue from 'vue';
import noteSignedOut from '~/notes/components/note_signed_out_widget.vue';
2018-11-08 19:23:39 +05:30
import createStore from '~/notes/stores';
2018-03-17 18:26:18 +05:30
import { notesDataMock } from '../mock_data';
describe('note_signed_out_widget component', () => {
2018-11-08 19:23:39 +05:30
let store;
2018-03-17 18:26:18 +05:30
let vm;
beforeEach(() => {
const Component = Vue.extend(noteSignedOut);
2018-11-08 19:23:39 +05:30
store = createStore();
2018-03-17 18:26:18 +05:30
store.dispatch('setNotesData', notesDataMock);
vm = new Component({
store,
}).$mount();
});
afterEach(() => {
vm.$destroy();
});
it('should render sign in link provided in the store', () => {
2018-11-08 19:23:39 +05:30
expect(vm.$el.querySelector(`a[href="${notesDataMock.newSessionPath}"]`).textContent).toEqual(
'sign in',
);
2018-03-17 18:26:18 +05:30
});
it('should render register link provided in the store', () => {
2018-11-08 19:23:39 +05:30
expect(vm.$el.querySelector(`a[href="${notesDataMock.registerPath}"]`).textContent).toEqual(
'register',
);
2018-03-17 18:26:18 +05:30
});
it('should render information text', () => {
2018-11-08 19:23:39 +05:30
expect(vm.$el.textContent.replace(/\s+/g, ' ').trim()).toEqual(
'Please register or sign in to reply',
);
2018-03-17 18:26:18 +05:30
});
});