mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 14:45:12 +02:00
Prevent duplicate consecutive nodes (#1296)
This commit is contained in:
@@ -221,6 +221,15 @@ describe('iD.Way', function() {
|
||||
expect(w.removeNode('a').nodes).to.eql([]);
|
||||
});
|
||||
|
||||
it("prevents duplicate consecutive nodes", function () {
|
||||
var a = iD.Node({id: 'a'}),
|
||||
b = iD.Node({id: 'b'}),
|
||||
c = iD.Node({id: 'c'}),
|
||||
w = iD.Way({nodes: ['a', 'b', 'c', 'b']});
|
||||
|
||||
expect(w.removeNode('c').nodes).to.eql(['a', 'b']);
|
||||
});
|
||||
|
||||
it("preserves circularity", function () {
|
||||
var a = iD.Node({id: 'a'}),
|
||||
b = iD.Node({id: 'b'}),
|
||||
@@ -230,6 +239,16 @@ describe('iD.Way', function() {
|
||||
|
||||
expect(w.removeNode('a').nodes).to.eql(['b', 'c', 'd', 'b']);
|
||||
});
|
||||
|
||||
it("prevents duplicate consecutive nodes when preserving circularity", function () {
|
||||
var a = iD.Node({id: 'a'}),
|
||||
b = iD.Node({id: 'b'}),
|
||||
c = iD.Node({id: 'c'}),
|
||||
d = iD.Node({id: 'd'}),
|
||||
w = iD.Way({nodes: ['a', 'b', 'c', 'd', 'b', 'a']});
|
||||
|
||||
expect(w.removeNode('a').nodes).to.eql(['b', 'c', 'd', 'b']);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#asJXON", function () {
|
||||
|
||||
Reference in New Issue
Block a user