diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-24 09:07:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-24 09:07:44 +0000 |
commit | 6593f1f627938f22090dec5221476772d3ed581d (patch) | |
tree | ac5b9adf00f24f1d7cbc59c7d78f7c4fd06a0001 /spec/frontend/vue_shared/components/markdown | |
parent | 2f369bd95866b7f623387ce2b6acf646df3d5222 (diff) | |
download | gitlab-ce-6593f1f627938f22090dec5221476772d3ed581d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared/components/markdown')
-rw-r--r-- | spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js b/spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js index c8deac1c086..8e6ac6a5fab 100644 --- a/spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js +++ b/spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js @@ -7,8 +7,8 @@ const oldLine = { meta_data: null, new_line: null, old_line: 5, - rich_text: '-oldtext', - text: '-oldtext', + rich_text: 'oldrichtext', + text: 'oldplaintext', type: 'old', }; @@ -18,8 +18,8 @@ const newLine = { meta_data: null, new_line: 6, old_line: null, - rich_text: '-newtext', - text: '-newtext', + rich_text: 'newrichtext', + text: 'newplaintext', type: 'new', }; @@ -42,14 +42,46 @@ describe('SuggestionDiffRow', () => { wrapper.destroy(); }); - it('renders correctly', () => { - factory({ - propsData: { - line: oldLine, - }, + describe('renders correctly', () => { + it('has the right classes on the wrapper', () => { + factory({ + propsData: { + line: oldLine, + }, + }); + + expect(wrapper.is('.line_holder')).toBe(true); + }); + + it('renders the rich text when it is available', () => { + factory({ + propsData: { + line: newLine, + }, + }); + + expect(wrapper.find('td.line_content').text()).toEqual('newrichtext'); }); - expect(wrapper.is('.line_holder')).toBe(true); + it('renders the plain text when it is available but rich text is not', () => { + factory({ + propsData: { + line: Object.assign({}, newLine, { rich_text: undefined }), + }, + }); + + expect(wrapper.find('td.line_content').text()).toEqual('newplaintext'); + }); + + it('renders a zero-width space when it has no plain or rich texts', () => { + factory({ + propsData: { + line: Object.assign({}, newLine, { rich_text: undefined, text: undefined }), + }, + }); + + expect(wrapper.find('td.line_content').text()).toEqual('\u200B'); + }); }); describe('when passed line has type old', () => { |