mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-10 05:06:01 +00:00
Pass entities to actions via id; this allows safe composition of actions that modify the same entity. Fix remaining ghost node cases (#213). Create more logical undo states when drawing.
16 lines
649 B
JavaScript
16 lines
649 B
JavaScript
describe("iD.actions.AddWayNode", function () {
|
|
it("adds a node to the end of a way", function () {
|
|
var way = iD.Way(),
|
|
node = iD.Node({id: "n1"}),
|
|
graph = iD.actions.AddWayNode(way.id, node.id)(iD.Graph([way, node]));
|
|
expect(graph.entity(way.id).nodes).to.eql(["n1"]);
|
|
});
|
|
|
|
it("adds a node to a way at the specified index", function () {
|
|
var way = iD.Way({nodes: ["n1", "n3"]}),
|
|
node = iD.Node({id: "n2"}),
|
|
graph = iD.actions.AddWayNode(way.id, node.id, 1)(iD.Graph([way, node]));
|
|
expect(graph.entity(way.id).nodes).to.eql(["n1", "n2", "n3"]);
|
|
});
|
|
});
|