Merge branch 'winh-princess-mononospace' into 'master'

Make commit IDs in merge request discussion header monospace

See merge request gitlab-org/gitlab-ce!23562
This commit is contained in:
Fatih Acet 2018-12-11 10:22:00 +00:00
commit 7c4940b702
3 changed files with 54 additions and 3 deletions

View file

@ -160,10 +160,14 @@ export default {
return expanded || this.alwaysExpanded || isResolvedNonDiffDiscussion;
},
actionText() {
const commitId = this.discussion.commit_id ? truncateSha(this.discussion.commit_id) : '';
const linkStart = `<a href="${_.escape(this.discussion.discussion_path)}">`;
const linkEnd = '</a>';
let { commit_id: commitId } = this.discussion;
if (commitId) {
commitId = `<span class="commit-sha">${truncateSha(commitId)}</span>`;
}
let text = s__('MergeRequests|started a discussion');
if (this.discussion.for_commit) {

View file

@ -0,0 +1,5 @@
---
title: Make commit IDs in merge request discussion header monospace
merge_request: 23562
author:
type: changed

View file

@ -42,12 +42,14 @@ describe('noteable_discussion component', () => {
const discussion = { ...discussionMock };
discussion.diff_file = mockDiffFile;
discussion.diff_discussion = true;
const diffDiscussionVm = new Component({
vm.$destroy();
vm = new Component({
store,
propsData: { discussion },
}).$mount();
expect(diffDiscussionVm.$el.querySelector('.discussion-header')).not.toBeNull();
expect(vm.$el.querySelector('.discussion-header')).not.toBeNull();
});
describe('actions', () => {
@ -130,4 +132,44 @@ describe('noteable_discussion component', () => {
expect(note).toEqual(data);
});
});
describe('commit discussion', () => {
const commitId = 'razupaltuff';
beforeEach(() => {
vm.$destroy();
store.state.diffs = {
projectPath: 'something',
};
vm.$destroy();
vm = new Component({
propsData: {
discussion: {
...discussionMock,
for_commit: true,
commit_id: commitId,
diff_discussion: true,
diff_file: {
...mockDiffFile,
},
},
renderDiffFile: true,
},
store,
}).$mount();
});
it('displays a monospace started a discussion on commit', () => {
const truncatedCommitId = commitId.substr(0, 8);
expect(vm.$el).toContainText(`started a discussion on commit ${truncatedCommitId}`);
const commitElement = vm.$el.querySelector('.commit-sha');
expect(commitElement).not.toBe(null);
expect(commitElement).toHaveText(truncatedCommitId);
});
});
});