diff options
Diffstat (limited to 'spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js | 46 |
1 files changed, 42 insertions, 4 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 97fcdc67791..6ae405017c9 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 @@ -63,21 +63,59 @@ describe('SuggestionDiffRow', () => { it('renders the plain text when it is available but rich text is not', () => { factory({ propsData: { - line: Object.assign({}, newLine, { rich_text: undefined }), + line: { + ...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', () => { + it('switches to table-cell display when it has no plain or rich texts', () => { factory({ propsData: { - line: Object.assign({}, newLine, { rich_text: undefined, text: undefined }), + line: { + ...newLine, + text: undefined, + rich_text: undefined, + }, }, }); - expect(wrapper.find('td.line_content').text()).toEqual('\u200B'); + const lineContent = wrapper.find('td.line_content'); + + expect(lineContent.classes()).toContain('d-table-cell'); + expect(lineContent.text()).toEqual(''); + }); + + it('does not switch to table-cell display if it has either plain or rich texts', () => { + let lineContent; + + factory({ + propsData: { + line: { + ...newLine, + text: undefined, + }, + }, + }); + + lineContent = wrapper.find('td.line_content'); + expect(lineContent.classes()).not.toContain('d-table-cell'); + + factory({ + propsData: { + line: { + ...newLine, + rich_text: undefined, + }, + }, + }); + + lineContent = wrapper.find('td.line_content'); + expect(lineContent.classes()).not.toContain('d-table-cell'); }); }); |