diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.js b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.js
index 3cbcbdd52c5..4998a47b691 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.js
+++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.js
@@ -26,9 +26,8 @@ export default {
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.js b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.js
index f2245a532f4..7beff1cb803 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.js
+++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.js
@@ -11,16 +11,15 @@ export default {
template: `
-
-
- Fast-forward merge is not possible.
- To merge this request, first rebase locally
-
-
+
+ Fast-forward merge is not possible.
+ To merge this request, first rebase locally
+
There are merge conflicts.
@@ -30,15 +29,13 @@ export default {
+ class="js-resolve-conflicts-button btn btn-default btn-xs">
Resolve conflicts
Merge locally
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
index e1c37add496..f83d3ca00dd 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
+++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
@@ -286,15 +286,14 @@ export default {
+ class="js-fast-forward-message">
Fast-forward merge without a merge commit
diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
index b2f4244671c..cc3d638dd06 100644
--- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
+++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
@@ -28,25 +28,29 @@ describe('MRWidgetConflicts', () => {
});
});
+ afterEach(() => {
+ vm.$destroy();
+ });
+
it('should tell you about conflicts without bothering other people', () => {
expect(vm.$el.textContent).toContain('There are merge conflicts');
expect(vm.$el.textContent).not.toContain('ask someone with write access');
});
it('should allow you to resolve the conflicts', () => {
- const resolveButton = vm.$refs.resolveConflictsButton;
+ const resolveButton = vm.$el.querySelector('.js-resolve-conflicts-button');
expect(resolveButton.textContent).toContain('Resolve conflicts');
expect(resolveButton.getAttribute('href')).toEqual(path);
});
it('should have merge buttons', () => {
- const mergeButton = vm.$refs.statusIcon.$refs.mergeButton;
- const mergeLocallyButton = vm.$refs.mergeLocallyButton;
+ const mergeButton = vm.$el.querySelector('.js-disabled-merge-button');
+ const mergeLocallyButton = vm.$el.querySelector('.js-merge-locally-button');
expect(mergeButton.textContent).toContain('Merge');
expect(mergeButton.disabled).toBeTruthy();
- expect(mergeButton.classList.contains('btn-success')).toBeTruthy();
+ expect(mergeButton.classList.contains('btn-success')).toEqual(true);
expect(mergeLocallyButton.textContent).toContain('Merge locally');
});
});
@@ -62,14 +66,18 @@ describe('MRWidgetConflicts', () => {
});
});
+ afterEach(() => {
+ vm.$destroy();
+ });
+
it('should show proper message', () => {
expect(vm.$el.textContent).toContain('ask someone with write access');
});
it('should not have action buttons', () => {
- expect(vm.$refs.statusIcon.$refs.mergeButton).toBeDefined();
- expect(vm.$refs.resolveConflictsButton).toBeUndefined();
- expect(vm.$refs.mergeLocallyButton).toBeUndefined();
+ expect(vm.$el.querySelector('.js-disabled-merge-button')).toBeDefined();
+ expect(vm.$el.querySelector('.js-resolve-conflicts-button')).toBeNull();
+ expect(vm.$el.querySelector('.js-merge-locally-button')).toBeNull();
});
});
@@ -84,6 +92,10 @@ describe('MRWidgetConflicts', () => {
});
});
+ afterEach(() => {
+ vm.$destroy();
+ });
+
it('should tell you to rebase locally', () => {
expect(vm.$el.textContent).toContain('Fast-forward merge is not possible.');
expect(vm.$el.textContent).toContain('To merge this request, first rebase locally');
diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
index f36b74c9e94..2422e844e97 100644
--- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
+++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
@@ -474,8 +474,8 @@ describe('MRWidgetReadyToMerge', () => {
mr: { ffOnlyEnabled: false },
});
- expect(customVm.$refs.fastForwardMessage).toBeUndefined();
- expect(customVm.$refs.modifyCommitMessageButton).toBeDefined();
+ expect(customVm.$el.querySelector('.js-fast-forward-message')).toBeNull();
+ expect(customVm.$el.querySelector('.js-modify-commit-message-button')).toBeDefined();
});
it('when fast-forward merge is enabled, only show fast-forward message', () => {
@@ -483,8 +483,8 @@ describe('MRWidgetReadyToMerge', () => {
mr: { ffOnlyEnabled: true },
});
- expect(customVm.$refs.fastForwardMessage).toBeDefined();
- expect(customVm.$refs.modifyCommitMessageButton).toBeUndefined();
+ expect(customVm.$el.querySelector('.js-fast-forward-message')).toBeDefined();
+ expect(customVm.$el.querySelector('.js-modify-commit-message-button')).toBeNull();
});
});
});