mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
Rename removeMember -> removeMembersWithID
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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});
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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'}]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user