Merge pull request #2761 from hirtie-maxim/fix/19021_split_screen_own_parent

pull/2825/head
Jan Sandbrink 10 years ago
commit f82dad1b29
  1. 5
      frontend/app/work_packages/view_models/parent-relations-handler.js
  2. 3
      frontend/tests/integration/mocks/work-packages/819.json
  3. 4
      frontend/tests/integration/mocks/work-packages/819_patch.json
  4. 1045
      frontend/tests/integration/mocks/work-packages/820.json
  5. 5
      frontend/tests/integration/mocks/work-packages/822.json
  6. 3
      frontend/tests/integration/mocks/work-packages/822_form.json
  7. 66
      frontend/tests/integration/specs/work-packages/details-pane/relations/parent-relations-handler-spec.js
  8. 83
      frontend/tests/unit/tests/work_packages/view_models/parent-relations-handler-test.js

@ -28,7 +28,10 @@
module.exports = function(CommonRelationsHandler, WorkPackageService, ApiHelper) {
function ParentRelationsHandler(workPackage, parents, relationsId) {
var handler = new CommonRelationsHandler(workPackage, parents, relationsId);
var relations = parents.filter(function(parent) {
return parent.props.id !== workPackage.props.id;
}),
handler = new CommonRelationsHandler(workPackage, relations, relationsId);
handler.type = "parent";
handler.addRelation = undefined;

@ -96,7 +96,8 @@
"title": "Add comment"
},
"parent": {
"href": null
"href": "/api/v3/work_packages/820",
"title": "asd"
},
"timeEntries": {
"href": "/work_packages/819/time_entries",

@ -82,7 +82,7 @@
"title": "Add comment"
},
"parent": {
"href": "/api/v3/work_packages/54",
"href": "/api/v3/work_packages/820",
"title": "asd"
},
"timeEntries": {
@ -112,7 +112,7 @@
"estimatedTime": "PT0S",
"spentTime": "PT0S",
"percentageDone": 0,
"parentId": 54,
"parentId": 820,
"createdAt": "2014-11-05T15:56:53Z",
"updatedAt": "2014-11-21T08:48:57Z",
"customProperties": [

File diff suppressed because it is too large Load Diff

@ -85,10 +85,6 @@
"method": "post",
"title": "Add comment"
},
"parent": {
"href": "/api/v3/work_packages/54",
"title": "asdsadd"
},
"timeEntries": {
"href": "/work_packages/822/time_entries",
"type": "text/html",
@ -114,7 +110,6 @@
"estimatedTime": "PT0S",
"spentTime": "PT12H",
"percentageDone": 0,
"parentId": 54,
"createdAt": "2014-11-05T15:56:53Z",
"updatedAt": "2014-12-04T09:48:50Z",
"customProperties": [

@ -39,8 +39,7 @@
},
"lockVersion": 145,
"subject": "66666os=",
"rawDescription": "",
"parentId": 54
"rawDescription": ""
},
"schema": {
"_type": {

@ -0,0 +1,66 @@
//-- 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.
//++
var expect = require('../../../../spec_helper.js').expect,
detailsPaneHelper = require('../details-pane-helper.js');
describe('Details pane', function() {
describe('relations tab', function() {
context('has parent', function() {
var parentsSlide;
beforeEach(function () {
detailsPaneHelper.loadPane(819, 'relations');
parentsSlide = element(by.css('[handler="wpParent"] [execute-on-enter]'));
parentsSlide.click();
browser.waitForAngular();
});
it('shows', function() {
element(by.repeater('relation in handler.relations')).then(function(relation) {
expect(relation).to.be.defined;
});
});
});
context('does not have parent', function() {
var parentsSlide;
beforeEach(function () {
detailsPaneHelper.loadPane(822, 'relations');
parentsSlide = element(by.css('[handler="wpParent"] [execute-on-enter]'));
parentsSlide.click();
browser.waitForAngular();
});
iit('shows "No realtion exists"', function() {
element.all(by.repeater('relation in handler.relations')).count().then(function(count) {
expect(count).to.eq(0);
});
});
});
});
});

@ -0,0 +1,83 @@
//-- 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.
//++
/*jshint expr: true*/
describe('ParentRelationsHandler', function() {
var ParentRelationsHandler,
relationsHandler,
workPackage;
beforeEach(module('openproject'));
beforeEach(inject(function($injector) {
ParentRelationsHandler = $injector.get('ParentRelationsHandler');
}));
beforeEach(function() {
workPackage = {
links: {
delete: { href: 'deleteMeLink' },
update: { href: 'updateMeLink' },
log_time: { href: 'log_timeMeLink' },
},
props: {
id: 20
}
};
});
describe('initializing', function() {
it('does not contain itself in relations', function() {
var relations = [{
props: {
id: 20
}
}];
relationsHandler = new ParentRelationsHandler(workPackage, relations, 'parent');
expect(relationsHandler.relations.length).to.eq(0);
});
it('does contains only parents not itself', function() {
var relations = [{
props: {
id: 20
}
}, {
props: {
id: 21
}
}];
relationsHandler = new ParentRelationsHandler(workPackage, relations, 'parent');
expect(relationsHandler.relations.length).to.eq(1);
expect(relationsHandler.relations[0].props.id).to.eq(21);
});
});
});
Loading…
Cancel
Save