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>2021-07-01 15:08:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-01 15:08:37 +0300
commit098ec8c914f61780b33bb18e929e25ef59dfb175 (patch)
tree0c30ccc7d6488fec2c7610aed1b10e364b5c64df /spec/frontend/vue_mr_widget
parentf5eabcfa0e39e8212eb333d9e824294d14f530d5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_mr_widget')
-rw-r--r--spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js70
1 files changed, 35 insertions, 35 deletions
diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js
index 115f21d8b35..f44f0b98207 100644
--- a/spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js
+++ b/spec/frontend/vue_mr_widget/components/mr_widget_header_spec.js
@@ -1,4 +1,4 @@
-import { shallowMount } from '@vue/test-utils';
+import { shallowMount, mount } from '@vue/test-utils';
import { nextTick } from 'vue';
import Header from '~/vue_merge_request_widget/components/mr_widget_header.vue';
@@ -26,6 +26,15 @@ describe('MRWidgetHeader', () => {
expect(downloadPlainDiffEl.attributes('href')).toBe('/mr/plainDiffPath');
};
+ const commonMrProps = {
+ divergedCommitsCount: 1,
+ sourceBranch: 'mr-widget-refactor',
+ sourceBranchLink: '<a href="/foo/bar/mr-widget-refactor">Link</a>',
+ targetBranch: 'main',
+ targetBranchPath: '/foo/bar/main',
+ statusPath: 'abc',
+ };
+
describe('computed', () => {
describe('shouldShowCommitsBehindText', () => {
it('return true when there are divergedCommitsCount', () => {
@@ -59,36 +68,28 @@ describe('MRWidgetHeader', () => {
describe('commitsBehindText', () => {
it('returns singular when there is one commit', () => {
- createComponent({
- mr: {
- divergedCommitsCount: 1,
- sourceBranch: 'mr-widget-refactor',
- sourceBranchLink: '<a href="/foo/bar/mr-widget-refactor">Link</a>',
- targetBranch: 'main',
- targetBranchPath: '/foo/bar/main',
- statusPath: 'abc',
+ wrapper = mount(Header, {
+ propsData: {
+ mr: commonMrProps,
},
});
- expect(wrapper.vm.commitsBehindText).toBe(
- 'The source branch is <a href="/foo/bar/main">1 commit behind</a> the target branch',
+ expect(wrapper.find('.diverged-commits-count').element.innerHTML).toBe(
+ 'The source branch is <a href="/foo/bar/main" class="gl-link">1 commit behind</a> the target branch',
);
});
it('returns plural when there is more than one commit', () => {
- createComponent({
- mr: {
- divergedCommitsCount: 2,
- sourceBranch: 'mr-widget-refactor',
- sourceBranchLink: '<a href="/foo/bar/mr-widget-refactor">Link</a>',
- targetBranch: 'main',
- targetBranchPath: '/foo/bar/main',
- statusPath: 'abc',
+ wrapper = mount(Header, {
+ propsData: {
+ mr: {
+ ...commonMrProps,
+ divergedCommitsCount: 2,
+ },
},
});
-
- expect(wrapper.vm.commitsBehindText).toBe(
- 'The source branch is <a href="/foo/bar/main">2 commits behind</a> the target branch',
+ expect(wrapper.find('.diverged-commits-count').element.innerHTML).toBe(
+ 'The source branch is <a href="/foo/bar/main" class="gl-link">2 commits behind</a> the target branch',
);
});
});
@@ -273,19 +274,18 @@ describe('MRWidgetHeader', () => {
describe('with diverged commits', () => {
beforeEach(() => {
- createComponent({
- mr: {
- divergedCommitsCount: 12,
- sourceBranch: 'mr-widget-refactor',
- sourceBranchLink: '<a href="/foo/bar/mr-widget-refactor">mr-widget-refactor</a>',
- sourceBranchRemoved: false,
- targetBranchPath: 'foo/bar/commits-path',
- targetBranchTreePath: 'foo/bar/tree/path',
- targetBranch: 'main',
- isOpen: true,
- emailPatchesPath: '/mr/email-patches',
- plainDiffPath: '/mr/plainDiffPath',
- statusPath: 'abc',
+ wrapper = mount(Header, {
+ propsData: {
+ mr: {
+ ...commonMrProps,
+ divergedCommitsCount: 12,
+ sourceBranchRemoved: false,
+ targetBranchPath: 'foo/bar/commits-path',
+ targetBranchTreePath: 'foo/bar/tree/path',
+ isOpen: true,
+ emailPatchesPath: '/mr/email-patches',
+ plainDiffPath: '/mr/plainDiffPath',
+ },
},
});
});