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>2020-08-20 21:42:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 21:42:06 +0300
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /spec/frontend/vue_mr_widget/mr_widget_options_spec.js
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/frontend/vue_mr_widget/mr_widget_options_spec.js')
-rw-r--r--spec/frontend/vue_mr_widget/mr_widget_options_spec.js43
1 files changed, 26 insertions, 17 deletions
diff --git a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js
index 93659fa54fb..0bbe040d031 100644
--- a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js
+++ b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js
@@ -62,6 +62,9 @@ describe('mrWidgetOptions', () => {
return axios.waitForAll();
};
+ const findSuggestPipeline = () => vm.$el.querySelector('[data-testid="mr-suggest-pipeline"]');
+ const findSuggestPipelineButton = () => findSuggestPipeline().querySelector('button');
+
describe('default', () => {
beforeEach(() => {
return createComponent();
@@ -804,42 +807,48 @@ describe('mrWidgetOptions', () => {
});
});
- it('should not suggest pipelines', () => {
- vm.mr.mergeRequestAddCiConfigPath = null;
-
- expect(vm.shouldSuggestPipelines).toBeFalsy();
+ it('should not suggest pipelines when feature flag is not present', () => {
+ expect(findSuggestPipeline()).toBeNull();
});
});
describe('given suggestPipeline feature flag is enabled', () => {
beforeEach(() => {
+ mock.onAny().reply(200);
+
// This is needed because some grandchildren Bootstrap components throw warnings
// https://gitlab.com/gitlab-org/gitlab/issues/208458
jest.spyOn(console, 'warn').mockImplementation();
gon.features = { suggestPipeline: true };
- return createComponent();
- });
- it('should suggest pipelines when none exist', () => {
- vm.mr.mergeRequestAddCiConfigPath = 'some/path';
+ createComponent();
+
vm.mr.hasCI = false;
+ });
- expect(vm.shouldSuggestPipelines).toBeTruthy();
+ it('should suggest pipelines when none exist', () => {
+ expect(findSuggestPipeline()).toEqual(expect.any(Element));
});
- it('should not suggest pipelines when they exist', () => {
- vm.mr.mergeRequestAddCiConfigPath = null;
- vm.mr.hasCI = false;
+ it.each([
+ { isDismissedSuggestPipeline: true },
+ { mergeRequestAddCiConfigPath: null },
+ { hasCI: true },
+ ])('with %s, should not suggest pipeline', async obj => {
+ Object.assign(vm.mr, obj);
+
+ await vm.$nextTick();
- expect(vm.shouldSuggestPipelines).toBeFalsy();
+ expect(findSuggestPipeline()).toBeNull();
});
- it('should not suggest pipelines hasCI is true', () => {
- vm.mr.mergeRequestAddCiConfigPath = 'some/path';
- vm.mr.hasCI = true;
+ it('should allow dismiss of the suggest pipeline message', async () => {
+ findSuggestPipelineButton().click();
+
+ await vm.$nextTick();
- expect(vm.shouldSuggestPipelines).toBeFalsy();
+ expect(findSuggestPipeline()).toBeNull();
});
});
});