Rename removeMember -> removeMembersWithID

This commit is contained in:
John Firebaugh
2013-05-16 14:06:10 -07:00
parent 4e5c18c0ac
commit affdc987e4
6 changed files with 10 additions and 10 deletions

View File

@@ -15,7 +15,7 @@ iD.actions.DeleteNode = function(nodeId) {
graph.parentRelations(node)
.forEach(function(parent) {
graph = graph.replace(parent.removeMember(nodeId));
graph = graph.replace(parent.removeMembersWithID(nodeId));
});
return graph.remove(node);

View File

@@ -11,11 +11,11 @@ iD.actions.DeleteRelation = function(relationId) {
graph.parentRelations(relation)
.forEach(function(parent) {
graph = graph.replace(parent.removeMember(relationId));
graph = graph.replace(parent.removeMembersWithID(relationId));
});
_.uniq(_.pluck(relation.members, 'id')).forEach(function(memberId) {
graph = graph.replace(relation.removeMember(memberId));
graph = graph.replace(relation.removeMembersWithID(memberId));
var entity = graph.entity(memberId);
if (deleteEntity(entity, graph)) {

View File

@@ -11,7 +11,7 @@ iD.actions.DeleteWay = function(wayId) {
graph.parentRelations(way)
.forEach(function(parent) {
graph = graph.replace(parent.removeMember(wayId));
graph = graph.replace(parent.removeMembersWithID(wayId));
});
_.uniq(way.nodes).forEach(function(nodeId) {

View File

@@ -73,7 +73,7 @@ _.extend(iD.Relation.prototype, {
return this.update({members: members});
},
removeMember: function(id) {
removeMembersWithID: function(id) {
var members = _.reject(this.members, function(m) { return m.id === id; });
return this.update({members: members});
},

View File

@@ -179,7 +179,7 @@ describe('iD.Graph', function() {
it("avoids re-adding a modified relation as a parent relation", function() {
var n = iD.Node({id: 'n'}),
r1 = iD.Relation({id: 'r1', members: [{id: 'n'}]}),
r2 = r1.removeMember('n'),
r2 = r1.removeMembersWithID('n'),
graph = iD.Graph([n, r1]),
graph2 = graph.replace(r2);

View File

@@ -128,10 +128,10 @@ describe('iD.Relation', function () {
});
});
describe("#removeMember", function () {
it("removes a member", function () {
var r = iD.Relation({members: [{id: 'a'}]});
expect(r.removeMember('a').members).to.eql([]);
describe("#removeMembersWithID", function () {
it("removes members with the given ID", function () {
var r = iD.Relation({members: [{id: 'a'}, {id: 'b'}, {id: 'a'}]});
expect(r.removeMembersWithID('a').members).to.eql([{id: 'b'}]);
});
});