Merge pull request #6788 from opf/feature/inline-create-referencable
Allow inline-create component to receive dynamic component to reference existing work packages [ci skip]pull/6795/head
commit
9f51ec29f0
@ -1,18 +1,42 @@ |
||||
<tr *ngIf="!isHidden && isAllowed" |
||||
class="wp-inline-create-button-row hide-when-print"> |
||||
<td [attr.colspan]="colspan" |
||||
class="wp-inline-create-button-td -no-highlighting"> |
||||
<div class="wp-inline-create-button"> |
||||
<a class="wp-inline-create--add-link" |
||||
href |
||||
role="link" |
||||
[focus]="focus" |
||||
(accessibleClick)="handleAddRowClick()" |
||||
[attr.disabled]="!isAllowed || undefined" |
||||
[attr.aria-label]="text.create" |
||||
aria-haspopup="true"> |
||||
<op-icon icon-classes="icon icon-add"></op-icon> |
||||
</a> |
||||
</div> |
||||
</td> |
||||
</tr> |
||||
<ng-container *ngIf="canAdd || canReference"> |
||||
<tr *ngIf="mode === 'inactive'" |
||||
class="wp-inline-create-button-row hide-when-print"> |
||||
<td [attr.colspan]="colspan" |
||||
class="wp-inline-create-button-td -no-highlighting"> |
||||
<div class="wp-inline-create-button"> |
||||
<a class="wp-inline-create--add-link" |
||||
href |
||||
role="link" |
||||
[focus]="focus" |
||||
*ngIf="canAdd" |
||||
[ngClass]="{'wp-inline-create--split-link': hasReferenceClass }" |
||||
(accessibleClick)="handleAddRowClick()" |
||||
[attr.disabled]="!isAllowed || undefined" |
||||
[attr.aria-label]="text.create" |
||||
aria-haspopup="true"> |
||||
<op-icon icon-classes="icon icon-add"></op-icon> |
||||
<span [textContent]="text.create"></span> |
||||
</a> |
||||
<ng-container *ngIf="canReference"> |
||||
<a class="wp-inline-create--reference-link wp-inline-create--split-link" |
||||
href |
||||
role="link" |
||||
(accessibleClick)="handleReferenceClick()" |
||||
[attr.disabled]="!isAllowed || undefined" |
||||
[attr.aria-label]="text.create" |
||||
aria-haspopup="true"> |
||||
<op-icon icon-classes="icon icon-add"></op-icon> |
||||
<span [textContent]="text.reference"></span> |
||||
</a> |
||||
</ng-container> |
||||
</div> |
||||
</td> |
||||
</tr> |
||||
<tr *ngIf="hasReferenceClass && mode === 'reference'" |
||||
class="wp-inline-create-button-row hide-when-print"> |
||||
<td [attr.colspan]="colspan" |
||||
class="wp-inline-reference-row-td -no-highlighting"> |
||||
<ng-container *ngComponentOutlet="referenceClass; injector: injector"></ng-container> |
||||
</td> |
||||
</tr> |
||||
</ng-container> |
||||
|
@ -0,0 +1,29 @@ |
||||
<div class="loading-indicator--location" |
||||
data-indicator-name="relationAddChild"> |
||||
<div class="v-align wp-relations-create--form wp-relations--child-form"> |
||||
<div class="grid-content medium-10"> |
||||
<wp-relations-autocomplete-upgraded |
||||
[workPackage]="workPackage" |
||||
(onWorkPackageIdSelected)="updateSelectedId($event)" |
||||
loadingPromiseName="relationAddChild" |
||||
filterCandidatesFor="children"> |
||||
</wp-relations-autocomplete-upgraded> |
||||
</div> |
||||
<div class="grid-content medium-2 collapse wp-relations-controls-section relation-row"> |
||||
<accessible-by-keyboard |
||||
linkClass="wp-create-relation--save" |
||||
[isDisabled]="isDisabled" |
||||
(execute)="addExistingChild()" |
||||
aria-hidden="false"> |
||||
<op-icon icon-classes="icon-checkmark" [icon-title]="text.save"></op-icon> |
||||
</accessible-by-keyboard> |
||||
|
||||
<accessible-by-keyboard |
||||
linkClass="wp-create-relation--cancel" |
||||
(execute)="cancel()" |
||||
aria-hidden="false"> |
||||
<op-icon icon-classes="icon-remove" [icon-title]="text.abort"></op-icon> |
||||
</accessible-by-keyboard> |
||||
</div> |
||||
</div> |
||||
</div> |
@ -0,0 +1,96 @@ |
||||
// -- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License version 3.
|
||||
//
|
||||
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||
// Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
// Copyright (C) 2010-2013 the ChiliProject Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// See doc/COPYRIGHT.rdoc for more details.
|
||||
// ++
|
||||
|
||||
import {Component} from '@angular/core'; |
||||
import {I18nService} from 'core-app/modules/common/i18n/i18n.service'; |
||||
import {WorkPackageInlineCreateService} from "core-components/wp-inline-create/wp-inline-create.service"; |
||||
import {WorkPackageInlineCreateComponent} from "core-components/wp-inline-create/wp-inline-create.component"; |
||||
import {WorkPackageRelationsService} from "core-components/wp-relations/wp-relations.service"; |
||||
import {WorkPackageRelationsHierarchyService} from "core-components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.service"; |
||||
import {WorkPackageNotificationService} from "core-components/wp-edit/wp-notification.service"; |
||||
import {WorkPackageCacheService} from "core-components/work-packages/work-package-cache.service"; |
||||
|
||||
@Component({ |
||||
templateUrl: './wp-inline-add-existing-child.component.html' |
||||
}) |
||||
export class WorkPackageInlineAddExistingChildComponent { |
||||
public selectedWpId:string; |
||||
public isDisabled = false; |
||||
|
||||
public text = { |
||||
save: this.I18n.t('js.relation_buttons.save'), |
||||
abort: this.I18n.t('js.relation_buttons.abort'), |
||||
addNewChild: this.I18n.t('js.relation_buttons.add_new_child'), |
||||
addExistingChild: this.I18n.t('js.relation_buttons.add_existing_child') |
||||
}; |
||||
|
||||
constructor(protected readonly parent:WorkPackageInlineCreateComponent, |
||||
protected readonly wpInlineCreate:WorkPackageInlineCreateService, |
||||
protected wpCacheService:WorkPackageCacheService, |
||||
protected wpRelations:WorkPackageRelationsService, |
||||
protected wpRelationsHierarchyService:WorkPackageRelationsHierarchyService, |
||||
protected wpNotificationsService:WorkPackageNotificationService, |
||||
protected readonly I18n:I18nService) { |
||||
} |
||||
|
||||
public addExistingChild() { |
||||
if (_.isNil(this.selectedWpId)) { |
||||
return; |
||||
} |
||||
|
||||
const newChildId = this.selectedWpId; |
||||
this.isDisabled = true; |
||||
|
||||
this.wpRelationsHierarchyService |
||||
.addExistingChildWp(this.workPackage, newChildId) |
||||
.then(() => { |
||||
this.wpCacheService.loadWorkPackage(this.workPackage.id, true); |
||||
this.isDisabled = false; |
||||
this.wpInlineCreate.newInlineWorkPackageReferenced.next(newChildId); |
||||
this.cancel(); |
||||
}) |
||||
.catch((err:any) => { |
||||
this.wpNotificationsService.handleRawError(err, this.workPackage); |
||||
this.isDisabled = false; |
||||
this.cancel(); |
||||
}); |
||||
} |
||||
|
||||
public updateSelectedId(workPackageId:string) { |
||||
this.selectedWpId = workPackageId; |
||||
} |
||||
|
||||
public get workPackage() { |
||||
return this.wpInlineCreate.referenceTarget!; |
||||
} |
||||
|
||||
|
||||
public cancel() { |
||||
this.parent.resetRow(); |
||||
} |
||||
} |
@ -0,0 +1,78 @@ |
||||
// -- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License version 3.
|
||||
//
|
||||
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||
// Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
// Copyright (C) 2010-2013 the ChiliProject Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// See doc/COPYRIGHT.rdoc for more details.
|
||||
// ++
|
||||
|
||||
import {Injectable, OnDestroy} from '@angular/core'; |
||||
import {WorkPackageResource} from 'core-app/modules/hal/resources/work-package-resource'; |
||||
import {Subject} from "rxjs"; |
||||
import {WorkPackageInlineCreateService} from "core-components/wp-inline-create/wp-inline-create.service"; |
||||
import {WorkPackageInlineAddExistingChildComponent} from "core-components/wp-relations/wp-relation-add-child/wp-inline-add-existing-child.component"; |
||||
|
||||
@Injectable() |
||||
export class WorkPackageInlineAddExistingChildService extends WorkPackageInlineCreateService implements OnDestroy { |
||||
|
||||
/** |
||||
* A separate reference pane for the inline create component |
||||
*/ |
||||
public readonly referenceComponentClass = WorkPackageInlineAddExistingChildComponent; |
||||
|
||||
/** |
||||
* A related work package for the inline create context |
||||
*/ |
||||
public referenceTarget:WorkPackageResource|null = null; |
||||
|
||||
public get canAdd() { |
||||
return !!(this.referenceTarget && this.referenceTarget.addChild); |
||||
} |
||||
|
||||
public get canReference() { |
||||
return !!(this.referenceTarget && !this.referenceTarget.isMilestone && this.referenceTarget.changeParent); |
||||
} |
||||
|
||||
/** |
||||
* Reference button text |
||||
*/ |
||||
public readonly buttonTexts = { |
||||
reference: this.I18n.t('js.relation_buttons.add_existing_child'), |
||||
create: this.I18n.t('js.relation_buttons.add_new_child') |
||||
}; |
||||
|
||||
/** Allow callbacks to happen on newly created inline work packages */ |
||||
public newInlineWorkPackageCreated = new Subject<string>(); |
||||
|
||||
/** Allow callbacks to happen on newly created inline work packages */ |
||||
public newInlineWorkPackageReferenced = new Subject<string>(); |
||||
|
||||
/** |
||||
* Ensure hierarchical injected versions of this service correctly unregister |
||||
*/ |
||||
ngOnDestroy() { |
||||
this.newInlineWorkPackageCreated.complete(); |
||||
this.newInlineWorkPackageReferenced.complete(); |
||||
} |
||||
|
||||
} |
@ -1,60 +0,0 @@ |
||||
<div> |
||||
<div class="wp-relations-create-button -full-width" |
||||
*ngIf="!showRelationsCreateForm"> |
||||
<div class="grid-block"> |
||||
<div class="grid-content collapse hide-when-print" |
||||
*ngIf="canAddChildren"> |
||||
<a class="wp-inline-create--add-link relation-create" |
||||
(click)="createNewChildWorkPackage()" |
||||
role="button" |
||||
id="hierarchy--add-new-child"> |
||||
<op-icon icon-classes="icon icon-add"></op-icon> |
||||
<span [textContent]="text.addNewChild"></span> |
||||
</a> |
||||
</div> |
||||
<div class="grid-content collapse hide-when-print" |
||||
*ngIf="canLinkChildren"> |
||||
<a class="wp-inline-create--add-link relation-create -focus-after-save" |
||||
(click)="toggleRelationsCreateForm()" |
||||
role="button" |
||||
id="hierarchy--add-exisiting-child"> |
||||
<op-icon icon-classes="icon icon-add"></op-icon> |
||||
<span [textContent]="text.addExistingChild"></span> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="loading-indicator--location" |
||||
data-indicator-name="relationAddChild"> |
||||
<div class="v-align wp-relations-create--form wp-relations--child-form" |
||||
*ngIf="showRelationsCreateForm"> |
||||
<div class="grid-content medium-10"> |
||||
<wp-relations-autocomplete-upgraded |
||||
[workPackage]="workPackage" |
||||
(onWorkPackageIdSelected)="updateSelectedId($event)" |
||||
loadingPromiseName="relationAddChild" |
||||
filterCandidatesFor="children"> |
||||
</wp-relations-autocomplete-upgraded> |
||||
</div> |
||||
<div class="grid-content medium-2 collapse wp-relations-controls-section relation-row"> |
||||
<accessible-by-keyboard |
||||
linkClass="wp-create-relation--save" |
||||
[isDisabled]="isDisabled" |
||||
(execute)="addExistingChild()" |
||||
aria-hidden="false"> |
||||
<op-icon icon-classes="icon-checkmark" [icon-title]="text.save"></op-icon> |
||||
</accessible-by-keyboard> |
||||
<accessible-by-keyboard |
||||
linkClass="wp-create-relation--cancel" |
||||
(execute)="toggleRelationsCreateForm()" |
||||
aria-hidden="false"> |
||||
<op-icon icon-classes="icon-remove" [icon-title]="text.abort"></op-icon> |
||||
</accessible-by-keyboard> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
|
||||
|
@ -1,88 +0,0 @@ |
||||
import {WorkPackageCacheService} from '../../work-packages/work-package-cache.service'; |
||||
import {WorkPackageNotificationService} from '../../wp-edit/wp-notification.service'; |
||||
import {WorkPackageRelationsHierarchyService} from '../wp-relations-hierarchy/wp-relations-hierarchy.service'; |
||||
import {WorkPackageRelationsService} from '../wp-relations.service'; |
||||
import {Component, ElementRef, EventEmitter, Inject, Input, OnInit, Output} from '@angular/core'; |
||||
import {I18nService} from 'core-app/modules/common/i18n/i18n.service'; |
||||
import {WorkPackageResource} from 'core-app/modules/hal/resources/work-package-resource'; |
||||
|
||||
@Component({ |
||||
selector: 'wp-relation-add-child', |
||||
templateUrl: './wp-relation-add-child.html' |
||||
}) |
||||
export class WpRelationAddChildComponent implements OnInit { |
||||
@Input() public workPackage:WorkPackageResource; |
||||
@Output() public onAdded = new EventEmitter<string>(); |
||||
|
||||
public showRelationsCreateForm: boolean = false; |
||||
|
||||
public isDisabled = false; |
||||
public canAddChildren:boolean = false; |
||||
public canLinkChildren:boolean = false; |
||||
public selectedWpId:string|null = null; |
||||
|
||||
public text = { |
||||
save: this.I18n.t('js.relation_buttons.save'), |
||||
abort: this.I18n.t('js.relation_buttons.abort'), |
||||
addNewChild: this.I18n.t('js.relation_buttons.add_new_child'), |
||||
addExistingChild: this.I18n.t('js.relation_buttons.add_existing_child') |
||||
}; |
||||
|
||||
private $element:JQuery; |
||||
|
||||
constructor(readonly I18n:I18nService, |
||||
readonly elementRef:ElementRef, |
||||
protected wpRelations:WorkPackageRelationsService, |
||||
protected wpRelationsHierarchyService:WorkPackageRelationsHierarchyService, |
||||
protected wpNotificationsService:WorkPackageNotificationService, |
||||
protected wpCacheService:WorkPackageCacheService) { |
||||
} |
||||
|
||||
ngOnInit() { |
||||
this.$element = jQuery(this.elementRef.nativeElement); |
||||
this.canAddChildren = !!this.workPackage.addChild; |
||||
this.canLinkChildren = !!this.workPackage.changeParent; |
||||
} |
||||
|
||||
public updateSelectedId(workPackageId:string) { |
||||
this.selectedWpId = workPackageId; |
||||
} |
||||
|
||||
public addExistingChild() { |
||||
if (_.isNil(this.selectedWpId)) { |
||||
return; |
||||
} |
||||
|
||||
const newChildId = this.selectedWpId; |
||||
this.isDisabled = true; |
||||
|
||||
this.wpRelationsHierarchyService |
||||
.addExistingChildWp(this.workPackage, newChildId) |
||||
.then(() => { |
||||
this.wpCacheService.loadWorkPackage(this.workPackage.id, true); |
||||
this.isDisabled = false; |
||||
this.onAdded.emit(newChildId); |
||||
this.toggleRelationsCreateForm(); |
||||
}) |
||||
.catch(err => { |
||||
this.wpNotificationsService.handleRawError(err, this.workPackage); |
||||
this.isDisabled = false; |
||||
this.toggleRelationsCreateForm(); |
||||
}); |
||||
} |
||||
|
||||
public createNewChildWorkPackage() { |
||||
this.wpRelationsHierarchyService.addNewChildWp(this.workPackage); |
||||
} |
||||
|
||||
public toggleRelationsCreateForm() { |
||||
this.showRelationsCreateForm = !this.showRelationsCreateForm; |
||||
|
||||
setTimeout(() => { |
||||
if (!this.showRelationsCreateForm) { |
||||
this.selectedWpId = null; |
||||
this.$element.find('.-focus-after-save').first().focus(); |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -1,176 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'spec_helper' |
||||
|
||||
RSpec.feature 'Work package create children', js: true, selenium: true do |
||||
let(:tabs) { ::Components::WorkPackages::Tabs.new(original_work_package) } |
||||
let(:relations_tab) { find('.tabrow li', text: 'RELATIONS') } |
||||
let(:user) do |
||||
FactoryBot.create(:user, |
||||
member_in_project: project, |
||||
member_through_role: create_role) |
||||
end |
||||
let(:work_flow) do |
||||
FactoryBot.create(:workflow, |
||||
role: create_role, |
||||
type_id: original_work_package.type_id, |
||||
old_status: original_work_package.status, |
||||
new_status: FactoryBot.create(:status)) |
||||
end |
||||
let(:create_role) do |
||||
FactoryBot.create(:role, |
||||
permissions: [:view_work_packages, |
||||
:add_work_packages, |
||||
:edit_work_packages, |
||||
:manage_subtasks]) |
||||
end |
||||
let(:project) { FactoryBot.create(:project) } |
||||
let(:original_work_package) do |
||||
FactoryBot.build(:work_package, |
||||
project: project, |
||||
assigned_to: assignee, |
||||
responsible: responsible, |
||||
fixed_version: version, |
||||
priority: default_priority, |
||||
author: author, |
||||
status: default_status) |
||||
end |
||||
let(:default_priority) do |
||||
FactoryBot.build(:default_priority) |
||||
end |
||||
let(:default_status) do |
||||
FactoryBot.build(:default_status) |
||||
end |
||||
let(:role) { FactoryBot.build(:role, permissions: [:view_work_packages]) } |
||||
let(:assignee) do |
||||
FactoryBot.build(:user, |
||||
firstname: 'An', |
||||
lastname: 'assignee', |
||||
member_in_project: project, |
||||
member_through_role: role) |
||||
end |
||||
let(:responsible) do |
||||
FactoryBot.build(:user, |
||||
firstname: 'The', |
||||
lastname: 'responsible', |
||||
member_in_project: project, |
||||
member_through_role: role) |
||||
end |
||||
let(:author) do |
||||
FactoryBot.build(:user, |
||||
firstname: 'The', |
||||
lastname: 'author', |
||||
member_in_project: project, |
||||
member_through_role: role) |
||||
end |
||||
let(:version) do |
||||
FactoryBot.build(:version, |
||||
project: project) |
||||
end |
||||
|
||||
before do |
||||
login_as(user) |
||||
allow(user.pref).to receive(:warn_on_leaving_unsaved?).and_return(false) |
||||
original_work_package.save! |
||||
work_flow.save! |
||||
end |
||||
|
||||
scenario 'on fullscreen page' do |
||||
original_work_package_page = Pages::FullWorkPackage.new(original_work_package) |
||||
|
||||
child_work_package_page = original_work_package_page.add_child |
||||
expect_angular_frontend_initialized |
||||
|
||||
type_field = child_work_package_page.edit_field :type |
||||
|
||||
type_field.expect_active! |
||||
expect(type_field.input_element).to have_selector('option[selected]', text: 'Please select') |
||||
child_work_package_page.expect_current_path |
||||
|
||||
child_work_package_page.update_attributes Subject: 'Child work package', |
||||
Type: 'None' |
||||
|
||||
expect(type_field.input_element).to have_selector('option[selected]', text: 'None') |
||||
child_work_package_page.save! |
||||
|
||||
expect(page).to have_selector('.notification-box--content', |
||||
text: I18n.t('js.notice_successful_create')) |
||||
|
||||
# Relations counter in full view should equal 1 |
||||
tabs.expect_counter(relations_tab, 1) |
||||
|
||||
child_work_package = WorkPackage.order(created_at: 'desc').first |
||||
|
||||
expect(child_work_package).to_not eql original_work_package |
||||
|
||||
child_work_package_page = Pages::FullWorkPackage.new(child_work_package, project) |
||||
|
||||
child_work_package_page.ensure_page_loaded |
||||
child_work_package_page.expect_subject |
||||
child_work_package_page.expect_current_path |
||||
|
||||
child_work_package_page.expect_parent(original_work_package) |
||||
end |
||||
|
||||
scenario 'on split screen page' do |
||||
original_work_package_page = Pages::SplitWorkPackage.new(original_work_package, project) |
||||
|
||||
child_work_package_page = original_work_package_page.add_child |
||||
expect_angular_frontend_initialized |
||||
|
||||
type_field = child_work_package_page.edit_field :type |
||||
|
||||
expect(type_field.input_element).to have_selector('option[selected]', text: 'Please select') |
||||
child_work_package_page.expect_current_path |
||||
|
||||
child_work_package_page.update_attributes Subject: 'Child work package', |
||||
Type: 'None' |
||||
|
||||
expect(type_field.input_element).to have_selector('option[selected]', text: 'None') |
||||
child_work_package_page.save! |
||||
|
||||
expect(page).to have_selector('.notification-box--content', |
||||
text: I18n.t('js.notice_successful_create')) |
||||
|
||||
# # Relations counter in split view should equal 1 |
||||
tabs.expect_counter(relations_tab, 1) |
||||
|
||||
child_work_package = WorkPackage.order(created_at: 'desc').first |
||||
|
||||
expect(child_work_package).to_not eql original_work_package |
||||
|
||||
child_work_package_page = Pages::SplitWorkPackage.new(child_work_package, project) |
||||
|
||||
child_work_package_page.ensure_page_loaded |
||||
child_work_package_page.expect_subject |
||||
child_work_package_page.expect_current_path |
||||
|
||||
child_work_package_page.expect_parent(original_work_package) |
||||
end |
||||
end |
Loading…
Reference in new issue