Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2018-10-03 13:17:26 +0300
committerFatih Acet <acetfatih@gmail.com>2018-10-03 14:29:14 +0300
commite3b96ad76bfc1a64218abb731029bd95584abe7f (patch)
tree9abc3c5db8c1aaab3e9151235a77f048ce181a25 /spec/javascripts
parent70f4a26b6ec6401a1cfaf620495a4209d503df7a (diff)
Fix placeholder note rendering
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/notes/components/noteable_discussion_spec.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/javascripts/notes/components/noteable_discussion_spec.js b/spec/javascripts/notes/components/noteable_discussion_spec.js
index 2a01bd85520..40b5f009ceb 100644
--- a/spec/javascripts/notes/components/noteable_discussion_spec.js
+++ b/spec/javascripts/notes/components/noteable_discussion_spec.js
@@ -133,4 +133,29 @@ describe('noteable_discussion component', () => {
});
});
});
+
+ describe('componentData', () => {
+ it('should return first note object for placeholder note', () => {
+ const data = {
+ isPlaceholderNote: true,
+ notes: [
+ { body: 'hello world!' },
+ ],
+ };
+
+ const note = vm.componentData(data);
+ expect(note).toEqual(data.notes[0]);
+ });
+
+ it('should return given note for nonplaceholder notes', () => {
+ const data = {
+ notes: [
+ { id: 12 },
+ ],
+ };
+
+ const note = vm.componentData(data);
+ expect(note).toEqual(data);
+ });
+ });
});