Commit 2ded7029 authored by Michel Engelen's avatar Michel Engelen Committed by Michel Engelen

prettified noteable_discussion component and updated tests

parent 41694210
...@@ -176,9 +176,7 @@ export default { ...@@ -176,9 +176,7 @@ export default {
let text = s__('MergeRequests|started a thread'); let text = s__('MergeRequests|started a thread');
if (isForCommit) { if (isForCommit) {
text = s__( text = s__('MergeRequests|started a thread on commit %{linkStart}%{commitId}%{linkEnd}');
'MergeRequests|started a thread on commit %{linkStart}%{commitId}%{linkEnd}',
);
} else if (isDiffDiscussion && commitId) { } else if (isDiffDiscussion && commitId) {
text = isActive text = isActive
? s__('MergeRequests|started a thread on commit %{linkStart}%{commitId}%{linkEnd}') ? s__('MergeRequests|started a thread on commit %{linkStart}%{commitId}%{linkEnd}')
......
...@@ -39,11 +39,11 @@ describe('noteable_discussion component', () => { ...@@ -39,11 +39,11 @@ describe('noteable_discussion component', () => {
expect(wrapper.find('.user-avatar-link').exists()).toBe(true); expect(wrapper.find('.user-avatar-link').exists()).toBe(true);
}); });
it('should not render discussion header for non diff discussions', () => { it('should not render thread header for non diff threads', () => {
expect(wrapper.find('.discussion-header').exists()).toBe(false); expect(wrapper.find('.discussion-header').exists()).toBe(false);
}); });
it('should render discussion header', done => { it('should render thread header', done => {
const discussion = { ...discussionMock }; const discussion = { ...discussionMock };
discussion.diff_file = mockDiffFile; discussion.diff_file = mockDiffFile;
discussion.diff_discussion = true; discussion.diff_discussion = true;
...@@ -90,16 +90,16 @@ describe('noteable_discussion component', () => { ...@@ -90,16 +90,16 @@ describe('noteable_discussion component', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('does not render jump to discussion button', () => { it('does not render jump to thread button', () => {
expect( expect(
wrapper.find('*[data-original-title="Jump to next unresolved discussion"]').exists(), wrapper.find('*[data-original-title="Jump to next unresolved thread"]').exists(),
).toBe(false); ).toBe(false);
}); });
}); });
describe('methods', () => { describe('methods', () => {
describe('jumpToNextDiscussion', () => { describe('jumpToNextDiscussion', () => {
it('expands next unresolved discussion', done => { it('expands next unresolved thread', done => {
const discussion2 = getJSONFixture(discussionWithTwoUnresolvedNotes)[0]; const discussion2 = getJSONFixture(discussionWithTwoUnresolvedNotes)[0];
discussion2.resolved = false; discussion2.resolved = false;
discussion2.active = true; discussion2.active = true;
...@@ -162,20 +162,20 @@ describe('noteable_discussion component', () => { ...@@ -162,20 +162,20 @@ describe('noteable_discussion component', () => {
.catch(done.fail); .catch(done.fail);
}); });
describe('for commit discussions', () => { describe('for commit threads', () => {
it('should display a monospace started a discussion on commit', () => { it('should display a monospace started a thread on commit', () => {
expect(wrapper.text()).toContain(`started a discussion on commit ${truncatedCommitId}`); expect(wrapper.text()).toContain(`started a thread on commit ${truncatedCommitId}`);
expect(commitElement.exists()).toBe(true); expect(commitElement.exists()).toBe(true);
expect(commitElement.text()).toContain(truncatedCommitId); expect(commitElement.text()).toContain(truncatedCommitId);
}); });
}); });
describe('for diff discussion with a commit id', () => { describe('for diff thread with a commit id', () => {
it('should display started discussion on commit header', done => { it('should display started thread on commit header', done => {
wrapper.vm.discussion.for_commit = false; wrapper.vm.discussion.for_commit = false;
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
expect(wrapper.text()).toContain(`started a discussion on commit ${truncatedCommitId}`); expect(wrapper.text()).toContain(`started a thread on commit ${truncatedCommitId}`);
expect(commitElement).not.toBe(null); expect(commitElement).not.toBe(null);
...@@ -199,21 +199,21 @@ describe('noteable_discussion component', () => { ...@@ -199,21 +199,21 @@ describe('noteable_discussion component', () => {
}); });
}); });
describe('for diff discussions without a commit id', () => { describe('for diff threads without a commit id', () => {
it('should show started a discussion on the diff text', done => { it('should show started a thread on the diff text', done => {
Object.assign(wrapper.vm.discussion, { Object.assign(wrapper.vm.discussion, {
for_commit: false, for_commit: false,
commit_id: null, commit_id: null,
}); });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
expect(wrapper.text()).toContain('started a discussion on the diff'); expect(wrapper.text()).toContain('started a thread on the diff');
done(); done();
}); });
}); });
it('should show discussion on older version text', done => { it('should show thread on older version text', done => {
Object.assign(wrapper.vm.discussion, { Object.assign(wrapper.vm.discussion, {
for_commit: false, for_commit: false,
commit_id: null, commit_id: null,
...@@ -221,7 +221,7 @@ describe('noteable_discussion component', () => { ...@@ -221,7 +221,7 @@ describe('noteable_discussion component', () => {
}); });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
expect(wrapper.text()).toContain('started a discussion on an old version of the diff'); expect(wrapper.text()).toContain('started a thread on an old version of the diff');
done(); done();
}); });
...@@ -229,7 +229,7 @@ describe('noteable_discussion component', () => { ...@@ -229,7 +229,7 @@ describe('noteable_discussion component', () => {
}); });
}); });
describe('for resolved discussion', () => { describe('for resolved thread', () => {
beforeEach(() => { beforeEach(() => {
const discussion = getJSONFixture(discussionWithTwoUnresolvedNotes)[0]; const discussion = getJSONFixture(discussionWithTwoUnresolvedNotes)[0];
wrapper.setProps({ discussion }); wrapper.setProps({ discussion });
...@@ -242,7 +242,7 @@ describe('noteable_discussion component', () => { ...@@ -242,7 +242,7 @@ describe('noteable_discussion component', () => {
}); });
}); });
describe('for unresolved discussion', () => { describe('for unresolved thread', () => {
beforeEach(done => { beforeEach(done => {
const discussion = { const discussion = {
...getJSONFixture(discussionWithTwoUnresolvedNotes)[0], ...getJSONFixture(discussionWithTwoUnresolvedNotes)[0],
......
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