From 5b49bb208a21fa96d0ae1bb93506725deee6c5b5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 22 Dec 2014 16:42:26 +0200 Subject: [PATCH] Fix issueable context update and fix tests Signed-off-by: Dmitriy Zaporozhets --- app/assets/javascripts/issue.js.coffee | 4 ++-- app/assets/javascripts/merge_request.js.coffee | 4 ++-- app/views/projects/issues/show.html.haml | 2 +- app/views/projects/issues/update.js.haml | 2 +- app/views/projects/merge_requests/_show.html.haml | 2 +- app/views/projects/merge_requests/update.js.haml | 2 +- features/steps/project/merge_requests.rb | 10 +++------- features/steps/shared/active_tab.rb | 8 ++++---- features/steps/shared/issuable.rb | 2 +- 9 files changed, 16 insertions(+), 20 deletions(-) diff --git a/app/assets/javascripts/issue.js.coffee b/app/assets/javascripts/issue.js.coffee index 597b4695a6d..45c248e6fb6 100644 --- a/app/assets/javascripts/issue.js.coffee +++ b/app/assets/javascripts/issue.js.coffee @@ -1,9 +1,9 @@ class @Issue constructor: -> $('.edit-issue.inline-update input[type="submit"]').hide() - $(".issue-box .inline-update").on "change", "select", -> + $(".context .inline-update").on "change", "select", -> $(this).submit() - $(".issue-box .inline-update").on "change", "#issue_assignee_id", -> + $(".context .inline-update").on "change", "#issue_assignee_id", -> $(this).submit() if $("a.btn-close").length diff --git a/app/assets/javascripts/merge_request.js.coffee b/app/assets/javascripts/merge_request.js.coffee index 46e06424e5a..fba933ddab5 100644 --- a/app/assets/javascripts/merge_request.js.coffee +++ b/app/assets/javascripts/merge_request.js.coffee @@ -26,9 +26,9 @@ class @MergeRequest initContextWidget: -> $('.edit-merge_request.inline-update input[type="submit"]').hide() - $(".issue-box .inline-update").on "change", "select", -> + $(".context .inline-update").on "change", "select", -> $(this).submit() - $(".issue-box .inline-update").on "change", "#merge_request_assignee_id", -> + $(".context .inline-update").on "change", "#merge_request_assignee_id", -> $(this).submit() initMergeWidget: -> diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index 5e5098b73ef..1c9af4c4501 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -48,7 +48,7 @@ - else = link_to 'Close', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-block btn-close", title: "Close Issue" - = link_to edit_project_issue_path(@project, @issue), class: "btn btn-block" do + = link_to edit_project_issue_path(@project, @issue), class: "btn btn-block issuable-edit" do %i.fa.fa-pencil-square-o Edit .clearfix diff --git a/app/views/projects/issues/update.js.haml b/app/views/projects/issues/update.js.haml index 5199e9fc61f..6e50667b084 100644 --- a/app/views/projects/issues/update.js.haml +++ b/app/views/projects/issues/update.js.haml @@ -3,7 +3,7 @@ :plain $("##{dom_id(@issue)}").fadeOut(); - elsif params[:issue_context] - $('.issue-box .context').effect('highlight'); + $('.context').effect('highlight'); - if @issue.milestone $('.milestone-nav-link').replaceWith("| Milestone #{escape_javascript(link_to @issue.milestone.title, project_milestone_path(@issue.project, @issue.milestone))}") - else diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml index fd45ca87b8e..a05c78bc3e9 100644 --- a/app/views/projects/merge_requests/_show.html.haml +++ b/app/views/projects/merge_requests/_show.html.haml @@ -67,7 +67,7 @@ %li= link_to "Email Patches", project_merge_request_path(@project, @merge_request, format: :patch) %li= link_to "Plain Diff", project_merge_request_path(@project, @merge_request, format: :diff) = link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: { state_event: :close }), method: :put, class: "btn btn-block btn-close", title: "Close merge request" - = link_to edit_project_merge_request_path(@project, @merge_request), class: "btn btn-block", id:"edit_merge_request" do + = link_to edit_project_merge_request_path(@project, @merge_request), class: "btn btn-block issuable-edit", id: "edit_merge_request" do %i.fa.fa-pencil-square-o Edit - if @merge_request.closed? diff --git a/app/views/projects/merge_requests/update.js.haml b/app/views/projects/merge_requests/update.js.haml index 6452cc6382d..6f4c5dd7a3b 100644 --- a/app/views/projects/merge_requests/update.js.haml +++ b/app/views/projects/merge_requests/update.js.haml @@ -1,2 +1,2 @@ - if params[:merge_request_context] - $('.issue-box .context').effect('highlight'); + $('.context').effect('highlight'); diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index d5e060bdbe8..b00f610cfae 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -57,9 +57,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I click link "Close"' do - within '.page-title' do - click_link "Close" - end + first(:css, '.close-mr-link').click end step 'I submit new merge request "Wiki Feature"' do @@ -181,13 +179,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I click link "Reopen"' do - within '.page-title' do - click_link "Reopen" - end + first(:css, '.reopen-mr-link').click end step 'I should see reopened merge request "Bug NS-04"' do - within '.state-label' do + within '.issue-box' do page.should have_content "Open" end end diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb index d7c7053edbd..c229864bc83 100644 --- a/features/steps/shared/active_tab.rb +++ b/features/steps/shared/active_tab.rb @@ -2,7 +2,7 @@ module SharedActiveTab include Spinach::DSL def ensure_active_main_tab(content) - find('.sidebar-wrapper li.active').should have_content(content) + find('.nav-sidebar > li.active').should have_content(content) end def ensure_active_sub_tab(content) @@ -10,11 +10,11 @@ module SharedActiveTab end def ensure_active_sub_nav(content) - find('div.content ul.nav-stacked-menu li.active').should have_content(content) + find('.sidebar-subnav > li.active').should have_content(content) end step 'no other main tabs should be active' do - page.should have_selector('.sidebar-wrapper li.active', count: 1) + page.should have_selector('.nav-sidebar > li.active', count: 1) end step 'no other sub tabs should be active' do @@ -22,7 +22,7 @@ module SharedActiveTab end step 'no other sub navs should be active' do - page.should have_selector('div.content ul.nav-stacked-menu li.active', count: 1) + page.should have_selector('.sidebar-subnav > li.active', count: 1) end step 'the active main tab should be Home' do diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb index a0150e90380..41db2612f26 100644 --- a/features/steps/shared/issuable.rb +++ b/features/steps/shared/issuable.rb @@ -2,7 +2,7 @@ module SharedIssuable include Spinach::DSL def edit_issuable - find('.issue-btn-group').click_link 'Edit' + find(:css, '.issuable-edit').click end step 'I click link "Edit" for the merge request' do