2017-08-09 13:38:21 +00:00
|
|
|
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';
|
|
|
|
|
2017-08-04 15:51:35 +00:00
|
|
|
describe('issue_note_signed_out_widget component', () => {
|
2017-08-09 13:38:21 +00:00
|
|
|
let vm;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const Component = Vue.extend(issueNoteSignedOut);
|
|
|
|
store.dispatch('setNotesData', notesDataMock);
|
|
|
|
|
|
|
|
vm = new Component({
|
|
|
|
store,
|
|
|
|
}).$mount();
|
|
|
|
});
|
2017-07-28 09:50:32 +00:00
|
|
|
|
2017-08-09 13:38:21 +00:00
|
|
|
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');
|
2017-07-28 09:50:32 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should render register link provided in the store', () => {
|
2017-08-09 13:38:21 +00:00
|
|
|
expect(
|
|
|
|
vm.$el.querySelector(`a[href="${notesDataMock.registerPath}"]`).textContent,
|
|
|
|
).toEqual('register');
|
|
|
|
});
|
2017-07-28 09:50:32 +00:00
|
|
|
|
2017-08-09 13:38:21 +00:00
|
|
|
it('should render information text', () => {
|
|
|
|
expect(vm.$el.textContent.replace(/\s+/g, ' ').trim()).toEqual('Please register or sign in to reply');
|
2017-07-28 09:50:32 +00:00
|
|
|
});
|
|
|
|
});
|