Commit 4d95fc09 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo Committed by Simon Knox

Fixes parameter names for code review analytics filters

Updates the parameters that are dispatched when
using the legacy filter bar
parent 99a7757c
...@@ -25,11 +25,11 @@ export default class FilteredSearchCodeReviewAnalytics extends FilteredSearchMan ...@@ -25,11 +25,11 @@ export default class FilteredSearchCodeReviewAnalytics extends FilteredSearchMan
*/ */
updateObject = path => { updateObject = path => {
const filters = urlParamsToObject(path); const filters = urlParamsToObject(path);
const { selectedLabels, selectedMilestone } = transformFilters(filters); const { selectedLabels: selectedLabelList, selectedMilestone } = transformFilters(filters);
store.dispatch('filters/setFilters', { store.dispatch('filters/setFilters', {
labelNames: selectedLabels, selectedLabelList,
milestoneTitle: selectedMilestone, selectedMilestone,
}); });
}; };
} }
...@@ -5,8 +5,8 @@ require 'spec_helper' ...@@ -5,8 +5,8 @@ require 'spec_helper'
RSpec.describe 'CodeReviewAnalytics Filtered Search', :js do RSpec.describe 'CodeReviewAnalytics Filtered Search', :js do
include FilteredSearchHelpers include FilteredSearchHelpers
let(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:project) { create(:project) } let_it_be(:project) { create(:project) }
before do before do
stub_licensed_features(code_review_analytics: true) stub_licensed_features(code_review_analytics: true)
...@@ -37,6 +37,24 @@ RSpec.describe 'CodeReviewAnalytics Filtered Search', :js do ...@@ -37,6 +37,24 @@ RSpec.describe 'CodeReviewAnalytics Filtered Search', :js do
expect(page).to have_content('Milestone') expect(page).to have_content('Milestone')
end end
end end
context 'with merge_requests' do
let(:label) { create(:label, title: 'awesome label', project: project) }
before do
create(:merge_request, title: "Bug fix-1", source_project: project, source_branch: "branch-1")
create(:labeled_merge_request, title: "Bug fix with label", source_project: project, source_branch: "branch-with-label", labels: [label])
create(:labeled_merge_request, title: "Bug fix with label#2", source_project: project, source_branch: "branch-with-label-2", labels: [label])
end
it 'filters the list of merge requests' do
has_merge_requests(3)
select_label_on_dropdown(label.title)
has_merge_requests(2)
end
end
end end
context 'when the "new search" feature is enabled' do context 'when the "new search" feature is enabled' do
...@@ -54,4 +72,8 @@ RSpec.describe 'CodeReviewAnalytics Filtered Search', :js do ...@@ -54,4 +72,8 @@ RSpec.describe 'CodeReviewAnalytics Filtered Search', :js do
end end
end end
end end
def has_merge_requests(num = 0)
expect(page).to have_text("Merge Requests in Review #{num}")
end
end end
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