diff --git a/js/id/actions/actions.js b/js/id/actions/actions.js
index 4cd5221f8..e40ab5bc5 100644
--- a/js/id/actions/actions.js
+++ b/js/id/actions/actions.js
@@ -37,9 +37,8 @@ iD.actions.addWayNode = function(way, node, index) {
iD.actions.removeWayNode = function(way, node) {
return function(graph) {
- return graph.replace(way.update({
- nodes: way.nodes.slice()
- })).remove(node, 'removed from a road');
+ var nodes = _.without(way.nodes, node.id);
+ return graph.replace(way.update({nodes: nodes}), 'removed from a road');
};
};
diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js
index 5ef8b59bb..a1abb2c16 100644
--- a/js/id/renderer/map.js
+++ b/js/id/renderer/map.js
@@ -367,7 +367,6 @@ iD.Map = function() {
history.graph().parents(entity.id)
.filter(function(d) { return d.type === 'way'; })
.forEach(function(parent) {
- parent.nodes = _.without(parent.nodes, entity.id);
history.perform(iD.actions.removeWayNode(parent, entity));
});
deselectClick();
diff --git a/test/index.html b/test/index.html
index 826fca117..1c70eb15b 100644
--- a/test/index.html
+++ b/test/index.html
@@ -64,6 +64,7 @@
+
diff --git a/test/index_packaged.html b/test/index_packaged.html
index 5237707b4..3cab98faa 100644
--- a/test/index_packaged.html
+++ b/test/index_packaged.html
@@ -26,6 +26,7 @@
+
diff --git a/test/spec/actions/remove_way_node.js b/test/spec/actions/remove_way_node.js
new file mode 100644
index 000000000..117dfb3bb
--- /dev/null
+++ b/test/spec/actions/remove_way_node.js
@@ -0,0 +1,8 @@
+describe("iD.actions.removeWayNode", function () {
+ it("removes a node from a way", function () {
+ var node = iD.Node({id: "n1"}),
+ way = iD.Way({id: "w1", nodes: ["n1"]}),
+ graph = iD.actions.removeWayNode(way, node)(iD.Graph({n1: node, w1: way}));
+ expect(graph.entity(way.id).nodes).to.eql([]);
+ });
+});