summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-03-12 12:08:47 +0000
committerPhil Hughes <me@iamphill.com>2018-03-12 12:08:47 +0000
commit277fac40f10cf918d63ca558175c7b3e17fdd2e9 (patch)
tree7b0e6546487f8e90158e4f7c5b3999f974a43c9e /spec
parentbd26e012fcd50d0ff5c1ad7febc9d6355e43a6fc (diff)
downloadgitlab-ce-277fac40f10cf918d63ca558175c7b3e17fdd2e9.tar.gz
Fix removes source branch text being rendered in merged stateremoves-source-branch-widget-state
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/vue_mr_widget/mr_widget_options_spec.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
index 3e310980ffa..e04f844a702 100644
--- a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
+++ b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
@@ -82,6 +82,10 @@ describe('mrWidgetOptions', () => {
});
describe('shouldRenderSourceBranchRemovalStatus', () => {
+ beforeEach(() => {
+ vm.mr.state = 'readyToMerge';
+ });
+
it('should return true when cannot remove source branch and branch will be removed', () => {
vm.mr.canRemoveSourceBranch = false;
vm.mr.shouldRemoveSourceBranch = true;
@@ -102,6 +106,22 @@ describe('mrWidgetOptions', () => {
expect(vm.shouldRenderSourceBranchRemovalStatus).toEqual(false);
});
+
+ it('should return false when in merged state', () => {
+ vm.mr.canRemoveSourceBranch = false;
+ vm.mr.shouldRemoveSourceBranch = true;
+ vm.mr.state = 'merged';
+
+ expect(vm.shouldRenderSourceBranchRemovalStatus).toEqual(false);
+ });
+
+ it('should return false when in nothing to merge state', () => {
+ vm.mr.canRemoveSourceBranch = false;
+ vm.mr.shouldRemoveSourceBranch = true;
+ vm.mr.state = 'nothingToMerge';
+
+ expect(vm.shouldRenderSourceBranchRemovalStatus).toEqual(false);
+ });
});
describe('shouldRenderDeployments', () => {
@@ -419,5 +439,18 @@ describe('mrWidgetOptions', () => {
done();
});
});
+
+ it('does not render in merged state', (done) => {
+ vm.mr.canRemoveSourceBranch = false;
+ vm.mr.shouldRemoveSourceBranch = true;
+ vm.mr.state = 'merged';
+
+ vm.$nextTick(() => {
+ expect(vm.$el.textContent).toContain('The source branch has been removed');
+ expect(vm.$el.textContent).not.toContain('Removes source branch');
+
+ done();
+ });
+ });
});
});