[26794] Fix moving between relation links (#6078)

https://community.openproject.com/wp/26794

[ci skip]
pull/6080/merge
Oliver Günther 7 years ago committed by GitHub
parent a1e05d4a91
commit de7eca2d2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      frontend/app/components/routing/wp-details/wp-details.controller.ts
  2. 24
      spec/features/work_packages/details/details_relations_spec.rb
  3. 4
      spec/support/components/work_packages/relations.rb

@ -56,6 +56,8 @@ export class WorkPackageDetailsController extends WorkPackageViewController {
const isFirstRoute = firstRoute.name === 'work-packages.list.details.overview';
const isSameID = firstRoute.params && wpId === firstRoute.params.workPackageI;
this.wpTableFocus.updateFocus(wpId, (isFirstRoute && isSameID));
} else {
this.wpTableFocus.updateFocus(wpId, false);
}
if (this.wpTableSelection.isEmpty) {
@ -66,7 +68,8 @@ export class WorkPackageDetailsController extends WorkPackageViewController {
$scope,
this.wpTableFocus.whenChanged()
).subscribe(newId => {
if (wpId !== newId && $state.includes('work-packages.list.details')) {
const idSame = wpId.toString() === newId.toString();
if (!idSame && $state.includes('work-packages.list.details')) {
$state.go(
($state.current.name as string),
{workPackageId: newId, focus: false }

@ -232,6 +232,30 @@ describe 'Work package relations tab', js: true, selenium: true do
expect(page).to have_no_selector('.wp-relations--subject-field', text: relatable.subject)
end
it 'should follow the relation links (Regression #26794)' do
relations.add_relation(type: 'follows', to: relatable)
relations.click_relation(relatable)
subject = work_packages_page.edit_field(:subject)
subject.expect_state_text relatable.subject
relations.click_relation(work_package)
subject = work_packages_page.edit_field(:subject)
subject.expect_state_text work_package.subject
# Switch to full view
find('.work-packages--details-fullscreen-icon').click
full_page = ::Pages::FullWorkPackage.new(work_package)
relations.click_relation(relatable)
subject = full_page.edit_field(:subject)
subject.expect_state_text relatable.subject
relations.click_relation(work_package)
subject = full_page.edit_field(:subject)
subject.expect_state_text work_package.subject
end
it 'should allow to change relation descriptions' do
relations.add_relation(type: 'follows', to: relatable)

@ -45,6 +45,10 @@ module Components
page.find(".relation-row-#{relatable.id}")
end
def click_relation(relatable)
page.find(".relation-row-#{relatable.id} .wp-relations--subject-field").click
end
def hover_action(relatable, action)
retry_block do
# Focus type edit to expose buttons

Loading…
Cancel
Save