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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-24 12:07:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-24 12:07:44 +0300
commit6593f1f627938f22090dec5221476772d3ed581d (patch)
treeac5b9adf00f24f1d7cbc59c7d78f7c4fd06a0001 /spec/frontend/vue_shared
parent2f369bd95866b7f623387ce2b6acf646df3d5222 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared')
-rw-r--r--spec/frontend/vue_shared/components/markdown/suggestion_diff_row_spec.js52
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', () => {