Commit 18091353 authored by Filipa Lacerda's avatar Filipa Lacerda

[ci skip] Adds tests for issue_note_edited_text component

parent d37881b7
......@@ -2,6 +2,7 @@
import timeAgoTooltip from '../../vue_shared/components/time_ago_tooltip.vue';
export default {
name: 'editedNoteText',
props: {
actionText: {
type: String,
......@@ -37,7 +38,7 @@
by
<a
:href="editedBy.path"
class="author_link">
class="js-vue-author author_link">
{{editedBy.name}}
</a>
</div>
......
import Vue from 'vue';
import issueNoteEditedText from '~/notes/components/issue_note_edited_text.vue';
describe('issue_note_edited_text', () => {
it('should render block with provided className', () => {
let vm;
let props;
});
beforeEach(() => {
const Component = Vue.extend(issueNoteEditedText);
props = {
actionText: 'Edited',
className: 'foo-bar',
editedAt: '2017-08-04T09:52:31.062Z',
editedBy: {
avatar_url: 'path',
id: 1,
name: 'Root',
path: '/root',
state: 'active',
username: 'root',
},
};
it('should render provided actionText', () => {
vm = new Component({
propsData: props,
}).$mount();
});
afterEach(() => {
vm.$destroy();
});
it('should render time ago with provided timestamp', () => {
it('should render block with provided className', () => {
expect(vm.$el.className).toEqual(props.className);
});
it('should render provided actionText', () => {
expect(vm.$el.textContent).toContain(props.actionText);
});
it('should render provided user information', () => {
const authorLink = vm.$el.querySelector('.js-vue-author');
expect(authorLink.getAttribute('href')).toEqual(props.editedBy.path);
expect(authorLink.textContent.trim()).toEqual(props.editedBy.name);
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment