diff --git a/js/iD/Entity.js b/js/iD/Entity.js index e6275a1e8..ab42a921a 100755 --- a/js/iD/Entity.js +++ b/js/iD/Entity.js @@ -37,10 +37,10 @@ iD.Entity = function () { }); }; entity.parentWays = function () { - return entity._parentObjectsOfClass('way'); + return _parentObjectsOfClass('way'); }; entity.parentRelations = function () { - return entity._parentObjectsOfClass('relation'); + return _parentObjectsOfClass('relation'); }; function _parentObjectsOfClass(_class) { return _.filter(entity.parentObjects(), function (p) { diff --git a/test/spec/Entity.js b/test/spec/Entity.js index 503b79d9c..34a052767 100644 --- a/test/spec/Entity.js +++ b/test/spec/Entity.js @@ -8,4 +8,20 @@ describe('Entity', function () { it('has no entity type', function () { expect(entity.entityType).toEqual(''); }); + + describe('#parentWays', function () { + it('returns an array of parents with entityType way', function () { + entity.addParent({_id: 1, entityType: 'way'}); + entity.addParent({_id: 2, entityType: 'node'}); + expect(entity.parentWays()).toEqual([{_id: 1, entityType: 'way'}]); + }); + }); + + describe('#parentRelations', function () { + it('returns an array of parents with entityType relation', function () { + entity.addParent({_id: 1, entityType: 'way'}); + entity.addParent({_id: 2, entityType: 'relation'}); + expect(entity.parentRelations()).toEqual([{_id: 2, entityType: 'relation'}]); + }); + }) });