Commit 8eb51dc0 authored by Douwe Maan's avatar Douwe Maan

Fix updating and disabling merge button when Merge Immediately is clicked

parent d89216ee
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
.accept-action .accept-action
- if @ci_commit && @ci_commit.active? - if @ci_commit && @ci_commit.active?
%span.btn-group %span.btn-group
= link_to "#", class: "btn btn-create merge_when_build_succeeds" do = button_tag class: "btn btn-create js-merge-button merge_when_build_succeeds" do
Merge When Build Succeeds Merge When Build Succeeds
%a.btn.btn-success.dropdown-toggle{ 'data-toggle' => 'dropdown' } = button_tag class: "btn btn-success dropdown-toggle", 'data-toggle' => 'dropdown' do
%span.caret %span.caret
%span.sr-only %span.sr-only
Select Merge Moment Select Merge Moment
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
= icon('warning fw') = icon('warning fw')
Merge Immediately Merge Immediately
- else - else
= f.button class: "btn btn-create btn-grouped accept_merge_request #{status_class}" do = f.button class: "btn btn-create btn-grouped js-merge-button accept_merge_request #{status_class}" do
Accept Merge Request Accept Merge Request
- if @merge_request.can_remove_source_branch?(current_user) - if @merge_request.can_remove_source_branch?(current_user)
.accept-control.checkbox .accept-control.checkbox
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
:javascript :javascript
$('.accept_merge_request').on('click', function() { $('.accept_merge_request').on('click', function() {
$(this).html("<i class='fa fa-spinner fa-spin'></i> Merge in progress"); $('.js-merge-button').html("<i class='fa fa-spinner fa-spin'></i> Merge in progress");
}); });
$('.accept-mr-form').on('ajax:send', function() { $('.accept-mr-form').on('ajax:send', function() {
......
...@@ -21,12 +21,12 @@ feature 'Merge When Build Succeeds', feature: true, js: true do ...@@ -21,12 +21,12 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
end end
it 'displays the Merge When Build Succeeds button' do it 'displays the Merge When Build Succeeds button' do
expect(page).to have_link "Merge When Build Succeeds" expect(page).to have_button "Merge When Build Succeeds"
end end
context "Merge When Build succeeds enabled" do context "Merge When Build succeeds enabled" do
before do before do
click_link "Merge When Build Succeeds" click_button "Merge When Build Succeeds"
end end
it 'activates Merge When Build Succeeds feature' do it 'activates Merge When Build Succeeds feature' do
...@@ -58,7 +58,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do ...@@ -58,7 +58,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
it 'cancels the automatic merge' do it 'cancels the automatic merge' do
click_link "Cancel Automatic Merge" click_link "Cancel Automatic Merge"
expect(page).to have_link "Merge When Build Succeeds" expect(page).to have_button "Merge When Build Succeeds"
visit_merge_request(merge_request) # Needed to refresh the page visit_merge_request(merge_request) # Needed to refresh the page
expect(page).to have_content "Canceled the automatic merge" expect(page).to have_content "Canceled the automatic merge"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment