Commit 4685ef7f authored by Bryce Johnson's avatar Bryce Johnson

Properly enable/disable merge button, fix tests.

parent 925d5df7
......@@ -23,7 +23,7 @@
initWidgetState() {
this.assignToData('showApprovals', false);
this.assignToData('disableAcceptance', false);
this.assignToData('disableAcceptance', Boolean(this.rootEl.dataset.approvalPending));
}
initApprovals() {
......
- content_for :page_specific_javascripts do
= page_specific_javascript_tag('merge_request_widget/widget_bundle.js')
#merge-request-widget-app.mr-state-widget{ 'data-endpoint'=> merge_request_path(@merge_request) }
- approval_pending = @merge_request.requires_approve? && !@merge_request.approved?
#merge-request-widget-app.mr-state-widget{ 'data-endpoint'=> merge_request_path(@merge_request), 'data-approval-pending' => approval_pending }
= render 'projects/merge_requests/widget/heading'
.mr-widget-body
-# After conflicts are resolved, the user is redirected back to the MR page.
......
......@@ -334,14 +334,14 @@ Feature: Project Merge Requests
And I visit project "Shop" merge requests page
And merge request 'Bug NS-04' must be approved
And I click link "Bug NS-04"
And I should not see merge button
And I should see merge button disabled
When I click link "Approve"
Then I should see approved merge request "Bug NS-04"
Scenario: I can not approve merge request if I am not an approver
Given merge request 'Bug NS-04' must be approved by some user
And I click link "Bug NS-04"
And I should not see merge button
And I should see the merge button disabled
When I should not see Approve button
And I should see message that MR require an approval
......
......@@ -608,12 +608,19 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
end
step 'I should not see merge button' do
step 'I should see the merge button disabled' do
page.within '.mr-state-widget' do
wait_for_ajax
expect(page).to have_button('Accept Merge Request', disabled: true)
end
end
step 'I should not see merge button' do
page.within '.mr-state-widget' do
expect(page).not_to have_button('Accept Merge Request')
end
end
step 'I should not see Approve button' do
page.within '.mr-state-widget' do
expect(page).not_to have_button("Approve")
......
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