summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-08-09 14:30:23 +0100
committerFilipa Lacerda <filipa@gitlab.com>2017-08-09 14:30:23 +0100
commit18091353f4055fb8e7e9fb0839bcb941e7ba79fa (patch)
tree04354ed446c375494bfce542db881b5be83bde4d /spec/javascripts
parentd37881b75f15f407c4078ff98322df97f73199d0 (diff)
downloadgitlab-ce-18091353f4055fb8e7e9fb0839bcb941e7ba79fa.tar.gz
[ci skip] Adds tests for issue_note_edited_text component
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/notes/components/issue_note_edited_text_spec.js40
1 files changed, 35 insertions, 5 deletions
diff --git a/spec/javascripts/notes/components/issue_note_edited_text_spec.js b/spec/javascripts/notes/components/issue_note_edited_text_spec.js
index f7b4c49dfbe..6603241eb64 100644
--- a/spec/javascripts/notes/components/issue_note_edited_text_spec.js
+++ b/spec/javascripts/notes/components/issue_note_edited_text_spec.js
@@ -1,17 +1,47 @@
+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);
});
-}); \ No newline at end of file
+});