Merge pull request #7491 from opf/fix/highlighting-parsing

Fix highlighting parsing

[ci skip]
pull/7499/head
Oliver Günther 5 years ago committed by GitHub
commit bd4875eebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/services/api/v3/parse_query_params_service.rb
  2. 17
      spec/features/work_packages/highlighting_spec.rb
  3. 6
      spec/services/api/v3/parse_query_params_service_spec.rb

@ -131,7 +131,7 @@ module API
return unless highlighted_attributes.present?
highlighted_attributes.map do |attr|
highlighted_attributes.map do |href|
attr = href.split('/').last
convert_attribute(attr)
end

@ -17,6 +17,7 @@ describe 'Work Package highlighting fields',
FactoryBot.create :work_package,
project: project,
status: status1,
subject: 'B',
due_date: (Date.today - 1.days),
priority: priority1
end
@ -25,13 +26,14 @@ describe 'Work Package highlighting fields',
FactoryBot.create :work_package,
project: project,
status: status2,
subject: 'A',
due_date: Date.today,
priority: priority_no_color
end
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:highlighting) { ::Components::WorkPackages::Highlighting.new }
let!(:work_package) { FactoryBot.create :work_package, project: project }
let(:sort_by) { ::Components::WorkPackages::SortBy.new }
let!(:query) do
query = FactoryBot.build(:query, user: user, project: project)
@ -186,4 +188,17 @@ describe 'Work Package highlighting fields',
expect(page).to have_selector(".wp-status-button .__hl_background_status_#{status1.id}")
expect(page).to have_selector(".__hl_inline_priority_#{priority1.id}")
end
it 'correctly parses custom selected inline attributes' do
# Highlight only one attribute
highlighting.switch_inline_attribute_highlight "Priority"
# Regression test, resort table
sort_by.sort_via_header 'Subject'
wp_table.expect_work_package_order wp_2, wp_1
# Regression test, resort table
sort_by.sort_via_header 'Subject', descending: true
wp_table.expect_work_package_order wp_1, wp_2
end
end

@ -133,6 +133,12 @@ describe ::API::V3::ParseQueryParamsService,
# Please note, that dueDate is expected to get translated to due_date.
let(:expected) { { highlighted_attributes: %w(status type priority due_date) } }
end
it_behaves_like 'transforms' do
let(:params) { { highlightedAttributes: %w(/api/v3/columns/status /api/v3/columns/type) } }
# Please note, that dueDate is expected to get translated to due_date.
let(:expected) { { highlighted_attributes: %w(status type) } }
end
end
context 'without highlighted_attributes' do

Loading…
Cancel
Save