pull/4748/head
manuschiller 8 years ago
parent 951dc43901
commit d9289fdae4
  1. 3
      frontend/app/components/wp-relations/wp-relations-create/empty-parents.template.html
  2. 2
      frontend/app/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.directive.ts
  3. 6
      frontend/app/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.service.ts
  4. 44
      spec/features/work_packages/details/details_relations_spec.rb

@ -22,8 +22,7 @@
</div>
<div class="grid-content medium-2 collapse wp-relations-controls-section relation-row">
<accessible-by-keyboard
execute="$ctrl.createRelation()"
class="wp-relations--save">
execute="$ctrl.createRelation()">
<icon-wrapper icon-name="checkmark"
icon-title="{{ ::$ctrl.text.save }}">
</icon-wrapper>

@ -55,8 +55,6 @@ export class WorkPackageRelationsHierarchyController {
if (this.workPackage.children) {
this.loadChildren();
}
console.log('wp hierarchy', this.workPackage.addRelation);
}
public text = {

@ -48,13 +48,13 @@ export class WorkPackageRelationsHierarchyService {
}
public addExistingChildWp(workPackage, childWpId) {
let deferred = this.$q.defer();
var deferred = this.$q.defer();
this.wpCacheService.loadWorkPackage(childWpId)
.take(1)
.subscribe(wpToBecomeChild => {
wpToBecomeChild.parentId = workPackage.id;
deferred.resolve(wpToBecomeChild.save());
deferred.resolve(this.changeParent(wpToBecomeChild, workPackage.id));
});
return deferred.promise;
}

@ -51,7 +51,7 @@ describe 'Work package relations tab', js: true, selenium: true do
it 'activates the change parent form' do
find('.wp-inline-create--add-link').click
find('.wp-inline-create--add-link', text: I18n.t('js.relation_buttons.add_parent')).click
find('.inplace-edit--select').click
input = find(:css, ".ui-select-search")
@ -61,7 +61,7 @@ describe 'Work package relations tab', js: true, selenium: true do
input.send_keys [:down, :return]
save_button = find('.wp-relations--save a')
save_button = find(:xpath, ".//a[.//span//span[contains(concat(' ',@class,' '), ' icon-checkmark ')]]")
save_button.click
expect(page).to have_selector('.wp-relations-hierarchy-subject a',
@ -69,4 +69,44 @@ describe 'Work package relations tab', js: true, selenium: true do
end
end
end
describe 'create child relationship' do
let(:child) { FactoryGirl.create(:work_package, project: project) }
include_context 'ui-select helpers'
let(:user_role) do
FactoryGirl.create :role, permissions: permissions
end
let(:user) do
FactoryGirl.create :user,
member_in_project: project,
member_through_role: user_role
end
context 'with permissions' do
let(:permissions) { %i(view_work_packages manage_subtasks) }
it 'activates the add existing child form' do
find('.wp-inline-create--add-link', text: I18n.t('js.relation_buttons.add_existing_child')).click
find('.inplace-edit--select').click
input = find(:css, ".ui-select-search")
input.set(child.id)
sleep(2)
input.send_keys [:down, :return]
save_button = find(:xpath, ".//a[.//span//span[contains(concat(' ',@class,' '), ' icon-checkmark ')]]")
save_button.click
sleep(2)
expect(page).to have_selector('.wp-relations-hierarchy-subject a',
text: "#{child.subject}")
end
end
end
end

Loading…
Cancel
Save