summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/notes/components/issue_placeholder_note.vue19
-rw-r--r--app/assets/javascripts/notes/components/issue_placeholder_system_note.vue1
-rw-r--r--spec/javascripts/notes/components/issue_placeholder_note_spec.js43
-rw-r--r--spec/javascripts/notes/components/issue_placeholder_system_note_spec.js25
4 files changed, 81 insertions, 7 deletions
diff --git a/app/assets/javascripts/notes/components/issue_placeholder_note.vue b/app/assets/javascripts/notes/components/issue_placeholder_note.vue
index fec60d9667b..4c089d755c8 100644
--- a/app/assets/javascripts/notes/components/issue_placeholder_note.vue
+++ b/app/assets/javascripts/notes/components/issue_placeholder_note.vue
@@ -1,14 +1,20 @@
<script>
+ import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
+
export default {
+ name: 'issuePlaceholderNote',
props: {
note: {
type: Object,
required: true,
},
},
+ components: {
+ userAvatarLink,
+ },
data() {
return {
- currentUser: window.gl.currentUserData,
+ currentUser: this.$store.getters.getUserData,
};
},
};
@@ -18,12 +24,11 @@
<li class="note being-posted fade-in-half timeline-entry">
<div class="timeline-entry-inner">
<div class="timeline-icon">
- <a :href="currentUser.path">
- <img
- :src="currentUser.avatar_url"
- class="avatar s40"
- />
- </a>
+ <user-avatar-link
+ :link-href="currentUser.path"
+ :img-src="currentUser.avatar_url"
+ :size="40"
+ />
</div>
<div
:class="{ discussion: !note.individual_note }"
diff --git a/app/assets/javascripts/notes/components/issue_placeholder_system_note.vue b/app/assets/javascripts/notes/components/issue_placeholder_system_note.vue
index b0d442c1a87..9c041728047 100644
--- a/app/assets/javascripts/notes/components/issue_placeholder_system_note.vue
+++ b/app/assets/javascripts/notes/components/issue_placeholder_system_note.vue
@@ -1,5 +1,6 @@
<script>
export default {
+ name: 'placeholderSystemNote',
props: {
note: {
type: Object,
diff --git a/spec/javascripts/notes/components/issue_placeholder_note_spec.js b/spec/javascripts/notes/components/issue_placeholder_note_spec.js
new file mode 100644
index 00000000000..f4d8e01bfe6
--- /dev/null
+++ b/spec/javascripts/notes/components/issue_placeholder_note_spec.js
@@ -0,0 +1,43 @@
+import Vue from 'vue';
+import placeholderNote from '~/notes/components/issue_placeholder_note.vue';
+
+describe('issue placeholder system note component', () => {
+ let mountComponent;
+ beforeEach(() => {
+ const PlaceholderNote = Vue.extend(placeholderNote);
+
+ mountComponent = props => new PlaceholderNote({
+ propsData: {
+ note: props,
+ },
+ }).$mount();
+ });
+
+ describe('user information', () => {
+ it('should render user avatar with link', () => {
+
+ });
+ });
+
+ describe('note content', () => {
+ it('should render note header information', () => {
+
+ });
+
+ it('should render note body', () => {
+
+ });
+
+ it('should render system note placeholder with markdown', () => {
+
+ });
+
+ it('should render emojis', () => {
+
+ });
+
+ it('should render slash commands', () => {
+
+ });
+ });
+});
diff --git a/spec/javascripts/notes/components/issue_placeholder_system_note_spec.js b/spec/javascripts/notes/components/issue_placeholder_system_note_spec.js
new file mode 100644
index 00000000000..fd28b33d60b
--- /dev/null
+++ b/spec/javascripts/notes/components/issue_placeholder_system_note_spec.js
@@ -0,0 +1,25 @@
+import Vue from 'vue';
+import placeholderSystemNote from '~/notes/components/issue_placeholder_system_note.vue';
+
+describe('issue placeholder system note component', () => {
+ let mountComponent;
+ beforeEach(() => {
+ const PlaceholderSystemNote = Vue.extend(placeholderSystemNote);
+
+ mountComponent = props => new PlaceholderSystemNote({
+ propsData: {
+ note: {
+ body: props,
+ },
+ },
+ }).$mount();
+ });
+
+ it('should render system note placeholder with plain text', () => {
+ const vm = mountComponent('This is a placeholder');
+
+ expect(vm.$el.tagName).toEqua('LI');
+
+ expect(vm.$el.querySelector('.timeline-content i').textContent.trim()).toEqua('This is a placeholder');
+ });
+});