diff --git a/app/models/query.rb b/app/models/query.rb index 36ed876829..fbb077cb19 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -82,9 +82,9 @@ class Query < ActiveRecord::Base sortable: "#{::Type.table_name}.position", groupable: true), QueryColumn.new(:parent, - sortable: ["#{WorkPackage.table_name}.root_id", + sortable: ["#{WorkPackage.table_name}.root_id ASC", "#{WorkPackage.table_name}.lft ASC"], - default_order: 'desc'), + default_order: 'asc'), QueryColumn.new(:status, sortable: "#{Status.table_name}.position", groupable: true), diff --git a/spec/features/accessibility/work_packages/work_package_query_spec.rb b/spec/features/accessibility/work_packages/work_package_query_spec.rb index 7d0c5245f0..fb05383498 100644 --- a/spec/features/accessibility/work_packages/work_package_query_spec.rb +++ b/spec/features/accessibility/work_packages/work_package_query_spec.rb @@ -170,24 +170,20 @@ describe 'Work package index accessibility', type: :feature, selenium: true do FactoryGirl.create(:work_package, project: project) } - let!(:yet_another_work_package) { - FactoryGirl.create(:work_package, - project: project) - } before do visit_index_page end context 'focus' do let(:first_link_selector) do - "#wp-row-#{yet_another_work_package.id} td.id a" + "#wp-row-#{work_package.id} td.id a" end let(:second_link_selector) do "#wp-row-#{another_work_package.id} td.id a" end it 'navigates with J and K' do - expect(page).to have_selector("#wp-row-#{yet_another_work_package.id}") + expect(page).to have_selector("#wp-row-#{work_package.id}") expect(page).to have_selector("#wp-row-#{another_work_package.id}") find('body').native.send_keys('j') diff --git a/spec/features/work_packages/export_spec.rb b/spec/features/work_packages/export_spec.rb index eb7c5fb78d..37d8a77cd0 100644 --- a/spec/features/work_packages/export_spec.rb +++ b/spec/features/work_packages/export_spec.rb @@ -87,8 +87,8 @@ describe 'work package export', type: :feature do expect(subject).to have_text(wp_3.description) expect(subject).to have_text(wp_4.description) - # results are ordered by ID (desc) and not grouped by type - expect(subject.scan(/Type (A|B)/).flatten).to eq %w(A B A A) + # results are ordered by ID (asc) and not grouped by type + expect(subject.scan(/Type (A|B)/).flatten).to eq %w(A A B A) end it 'shows all work packages grouped by ', js: true, retry: 2 do diff --git a/spec/features/work_packages/pagination_spec.rb b/spec/features/work_packages/pagination_spec.rb index 8fd6f67bd8..b2f8bfb3fb 100644 --- a/spec/features/work_packages/pagination_spec.rb +++ b/spec/features/work_packages/pagination_spec.rb @@ -51,8 +51,8 @@ RSpec.feature 'Work package pagination', js: true do expect(page).to have_content('Work packages') within('#work-packages-index') do - expect(page).to_not have_content(work_package_1.subject) - expect(page).to have_content(work_package_2.subject) + expect(page).to have_content(work_package_1.subject) + expect(page).to_not have_content(work_package_2.subject) end within('.pagination--pages') do @@ -60,8 +60,8 @@ RSpec.feature 'Work package pagination', js: true do end within('#work-packages-index') do - expect(page).to have_content(work_package_1.subject) - expect(page).to_not have_content(work_package_2.subject) + expect(page).to have_content(work_package_2.subject) + expect(page).to_not have_content(work_package_1.subject) end within('.pagination--options') do diff --git a/spec/features/work_packages/select_work_package_row_spec.rb b/spec/features/work_packages/select_work_package_row_spec.rb index e4302f6eaa..d3ef032f73 100644 --- a/spec/features/work_packages/select_work_package_row_spec.rb +++ b/spec/features/work_packages/select_work_package_row_spec.rb @@ -203,7 +203,7 @@ describe 'Select work package row', type: :feature, js:true, selenium: true do it do expect(page).to have_selector('.work-packages--details--subject', - text: work_package_3.subject) + text: work_package_1.subject) end end @@ -216,11 +216,11 @@ describe 'Select work package row', type: :feature, js:true, selenium: true do end it do - wp_page = Pages::FullWorkPackage.new(work_package_3) + wp_page = Pages::FullWorkPackage.new(work_package_1) subject_field = wp_page.edit_field :subject subject_field.expect_active! - expect(subject_field.input_element.value).to eq(work_package_3.subject) + expect(subject_field.input_element.value).to eq(work_package_1.subject) # Cancel edit find('#work-packages--edit-actions-cancel').click