2017-08-09 05:16:29 -04:00
|
|
|
import Vue from 'vue';
|
|
|
|
import issuePlaceholderNote from '~/notes/components/issue_placeholder_note.vue';
|
|
|
|
import store from '~/notes/stores';
|
|
|
|
import { userDataMock } from '../mock_data';
|
|
|
|
|
2017-07-28 06:20:17 -04:00
|
|
|
describe('issue placeholder system note component', () => {
|
2017-08-09 05:16:29 -04:00
|
|
|
let vm;
|
|
|
|
|
2017-07-28 06:20:17 -04:00
|
|
|
beforeEach(() => {
|
2017-08-09 05:16:29 -04:00
|
|
|
const Component = Vue.extend(issuePlaceholderNote);
|
|
|
|
store.dispatch('setUserData', userDataMock);
|
|
|
|
vm = new Component({
|
|
|
|
store,
|
|
|
|
propsData: { note: { body: 'Foo' } },
|
|
|
|
}).$mount();
|
2017-07-28 06:20:17 -04:00
|
|
|
});
|
|
|
|
|
2017-08-09 09:18:43 -04:00
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
|
2017-07-28 06:20:17 -04:00
|
|
|
describe('user information', () => {
|
|
|
|
it('should render user avatar with link', () => {
|
2017-08-09 05:16:29 -04:00
|
|
|
expect(vm.$el.querySelector('.user-avatar-link').getAttribute('href')).toEqual(userDataMock.path);
|
|
|
|
expect(vm.$el.querySelector('.user-avatar-link img').getAttribute('src')).toEqual(userDataMock.avatar_url);
|
2017-07-28 06:20:17 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('note content', () => {
|
|
|
|
it('should render note header information', () => {
|
2017-08-09 05:16:29 -04:00
|
|
|
expect(vm.$el.querySelector('.note-header-info a').getAttribute('href')).toEqual(userDataMock.path);
|
|
|
|
expect(vm.$el.querySelector('.note-header-info .note-headline-light').textContent.trim()).toEqual(`@${userDataMock.username}`);
|
2017-07-28 06:20:17 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should render note body', () => {
|
2017-08-09 05:16:29 -04:00
|
|
|
expect(vm.$el.querySelector('.note-text p').textContent.trim()).toEqual('Foo');
|
2017-07-28 06:20:17 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|