mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
Upgrade legacy symbols in tests
- iD.Context -> iD.coreContext - iD.Graph -> iD.coreGraph - iD.Node -> iD.osmNode - iD.Way -> iD.osmWay - iD.Relation -> iD.osmRelation
This commit is contained in:
@@ -1,92 +1,92 @@
|
||||
describe('iD.Difference', function () {
|
||||
describe('#changes', function () {
|
||||
it('includes created entities', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
base = iD.Graph(),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
base = iD.coreGraph(),
|
||||
head = base.replace(node),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.changes()).to.eql({n: {base: undefined, head: node}});
|
||||
});
|
||||
|
||||
it('includes undone created entities', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
base = iD.Graph(),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
base = iD.coreGraph(),
|
||||
head = base.replace(node),
|
||||
diff = iD.Difference(head, base);
|
||||
expect(diff.changes()).to.eql({n: {base: node, head: undefined}});
|
||||
});
|
||||
|
||||
it('includes modified entities', function () {
|
||||
var n1 = iD.Node({id: 'n'}),
|
||||
var n1 = iD.osmNode({id: 'n'}),
|
||||
n2 = n1.update({ tags: { yes: 'no' } }),
|
||||
base = iD.Graph([n1]),
|
||||
base = iD.coreGraph([n1]),
|
||||
head = base.replace(n2),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.changes()).to.eql({n: {base: n1, head: n2}});
|
||||
});
|
||||
|
||||
it('includes undone modified entities', function () {
|
||||
var n1 = iD.Node({id: 'n'}),
|
||||
var n1 = iD.osmNode({id: 'n'}),
|
||||
n2 = n1.update({ tags: { yes: 'no' } }),
|
||||
base = iD.Graph([n1]),
|
||||
base = iD.coreGraph([n1]),
|
||||
head = base.replace(n2),
|
||||
diff = iD.Difference(head, base);
|
||||
expect(diff.changes()).to.eql({n: {base: n2, head: n1}});
|
||||
});
|
||||
|
||||
it('doesn\'t include updated but identical entities', function () {
|
||||
var n1 = iD.Node({id: 'n'}),
|
||||
var n1 = iD.osmNode({id: 'n'}),
|
||||
n2 = n1.update(),
|
||||
base = iD.Graph([n1]),
|
||||
base = iD.coreGraph([n1]),
|
||||
head = base.replace(n2),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.changes()).to.eql({});
|
||||
});
|
||||
|
||||
it('includes deleted entities', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
base = iD.Graph([node]),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
base = iD.coreGraph([node]),
|
||||
head = base.remove(node),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.changes()).to.eql({n: {base: node, head: undefined}});
|
||||
});
|
||||
|
||||
it('includes undone deleted entities', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
base = iD.Graph([node]),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
base = iD.coreGraph([node]),
|
||||
head = base.remove(node),
|
||||
diff = iD.Difference(head, base);
|
||||
expect(diff.changes()).to.eql({n: {base: undefined, head: node}});
|
||||
});
|
||||
|
||||
it('doesn\'t include created entities that were subsequently deleted', function () {
|
||||
var node = iD.Node(),
|
||||
base = iD.Graph(),
|
||||
var node = iD.osmNode(),
|
||||
base = iD.coreGraph(),
|
||||
head = base.replace(node).remove(node),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.changes()).to.eql({});
|
||||
});
|
||||
|
||||
it('doesn\'t include created entities that were subsequently reverted', function () {
|
||||
var node = iD.Node({id: 'n-1'}),
|
||||
base = iD.Graph(),
|
||||
var node = iD.osmNode({id: 'n-1'}),
|
||||
base = iD.coreGraph(),
|
||||
head = base.replace(node).revert('n-1'),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.changes()).to.eql({});
|
||||
});
|
||||
|
||||
it('doesn\'t include modified entities that were subsequently reverted', function () {
|
||||
var n1 = iD.Node({id: 'n'}),
|
||||
var n1 = iD.osmNode({id: 'n'}),
|
||||
n2 = n1.update({ tags: { yes: 'no' } }),
|
||||
base = iD.Graph([n1]),
|
||||
base = iD.coreGraph([n1]),
|
||||
head = base.replace(n2).revert('n'),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.changes()).to.eql({});
|
||||
});
|
||||
|
||||
it('doesn\'t include deleted entities that were subsequently reverted', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
base = iD.Graph([node]),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
base = iD.coreGraph([node]),
|
||||
head = base.remove(node).revert('n'),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.changes()).to.eql({});
|
||||
@@ -95,25 +95,25 @@ describe('iD.Difference', function () {
|
||||
|
||||
describe('#extantIDs', function () {
|
||||
it('includes the ids of created entities', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
base = iD.Graph(),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
base = iD.coreGraph(),
|
||||
head = base.replace(node),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.extantIDs()).to.eql(['n']);
|
||||
});
|
||||
|
||||
it('includes the ids of modified entities', function () {
|
||||
var n1 = iD.Node({id: 'n'}),
|
||||
var n1 = iD.osmNode({id: 'n'}),
|
||||
n2 = n1.move([1, 2]),
|
||||
base = iD.Graph([n1]),
|
||||
base = iD.coreGraph([n1]),
|
||||
head = base.replace(n2),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.extantIDs()).to.eql(['n']);
|
||||
});
|
||||
|
||||
it('omits the ids of deleted entities', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
base = iD.Graph([node]),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
base = iD.coreGraph([node]),
|
||||
head = base.remove(node),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.extantIDs()).to.eql([]);
|
||||
@@ -122,8 +122,8 @@ describe('iD.Difference', function () {
|
||||
|
||||
describe('#created', function () {
|
||||
it('returns an array of created entities', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
base = iD.Graph(),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
base = iD.coreGraph(),
|
||||
head = base.replace(node),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.created()).to.eql([node]);
|
||||
@@ -132,9 +132,9 @@ describe('iD.Difference', function () {
|
||||
|
||||
describe('#modified', function () {
|
||||
it('returns an array of modified entities', function () {
|
||||
var n1 = iD.Node({id: 'n'}),
|
||||
var n1 = iD.osmNode({id: 'n'}),
|
||||
n2 = n1.move([1, 2]),
|
||||
base = iD.Graph([n1]),
|
||||
base = iD.coreGraph([n1]),
|
||||
head = base.replace(n2),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.modified()).to.eql([n2]);
|
||||
@@ -143,8 +143,8 @@ describe('iD.Difference', function () {
|
||||
|
||||
describe('#deleted', function () {
|
||||
it('returns an array of deleted entities', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
base = iD.Graph([node]),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
base = iD.coreGraph([node]),
|
||||
head = base.remove(node),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.deleted()).to.eql([node]);
|
||||
@@ -152,15 +152,15 @@ describe('iD.Difference', function () {
|
||||
});
|
||||
|
||||
describe('#summary', function () {
|
||||
var base = iD.Graph([
|
||||
iD.Node({id: 'a', tags: {crossing: 'marked'}}),
|
||||
iD.Node({id: 'b'}),
|
||||
iD.Node({id: 'v'}),
|
||||
iD.Way({id: '-', nodes: ['a', 'b']})
|
||||
var base = iD.coreGraph([
|
||||
iD.osmNode({id: 'a', tags: {crossing: 'marked'}}),
|
||||
iD.osmNode({id: 'b'}),
|
||||
iD.osmNode({id: 'v'}),
|
||||
iD.osmWay({id: '-', nodes: ['a', 'b']})
|
||||
]);
|
||||
|
||||
it('reports a created way as created', function() {
|
||||
var way = iD.Way({id: '+'}),
|
||||
var way = iD.osmWay({id: '+'}),
|
||||
head = base.replace(way),
|
||||
diff = iD.Difference(base, head);
|
||||
|
||||
@@ -208,7 +208,7 @@ describe('iD.Difference', function () {
|
||||
});
|
||||
|
||||
it('reports a way as modified when a member vertex is added', function() {
|
||||
var vertex = iD.Node({id: 'c'}),
|
||||
var vertex = iD.osmNode({id: 'c'}),
|
||||
way = base.entity('-').addNode('c'),
|
||||
head = base.replace(vertex).replace(way),
|
||||
diff = iD.Difference(base, head);
|
||||
@@ -234,7 +234,7 @@ describe('iD.Difference', function () {
|
||||
|
||||
it('reports a created way containing a moved vertex as being created', function() {
|
||||
var vertex = base.entity('b').move([0,3]),
|
||||
way = iD.Way({id: '+', nodes: ['b']}),
|
||||
way = iD.osmWay({id: '+', nodes: ['b']}),
|
||||
head = base.replace(way).replace(vertex),
|
||||
diff = iD.Difference(base, head);
|
||||
|
||||
@@ -250,8 +250,8 @@ describe('iD.Difference', function () {
|
||||
});
|
||||
|
||||
it('reports a created way with a created vertex as being created', function() {
|
||||
var vertex = iD.Node({id: 'c'}),
|
||||
way = iD.Way({id: '+', nodes: ['c']}),
|
||||
var vertex = iD.osmNode({id: 'c'}),
|
||||
way = iD.osmWay({id: '+', nodes: ['c']}),
|
||||
head = base.replace(vertex).replace(way),
|
||||
diff = iD.Difference(base, head);
|
||||
|
||||
@@ -315,7 +315,7 @@ describe('iD.Difference', function () {
|
||||
});
|
||||
|
||||
it('reports a vertex as created when it has tags', function() {
|
||||
var vertex = iD.Node({id: 'c', tags: {crossing: 'marked'}}),
|
||||
var vertex = iD.osmNode({id: 'c', tags: {crossing: 'marked'}}),
|
||||
way = base.entity('-').addNode('c'),
|
||||
head = base.replace(way).replace(vertex),
|
||||
diff = iD.Difference(base, head);
|
||||
@@ -334,36 +334,36 @@ describe('iD.Difference', function () {
|
||||
|
||||
describe('#complete', function () {
|
||||
it('includes created entities', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
base = iD.Graph(),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
base = iD.coreGraph(),
|
||||
head = base.replace(node),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.complete().n).to.equal(node);
|
||||
});
|
||||
|
||||
it('includes modified entities', function () {
|
||||
var n1 = iD.Node({id: 'n'}),
|
||||
var n1 = iD.osmNode({id: 'n'}),
|
||||
n2 = n1.move([1, 2]),
|
||||
base = iD.Graph([n1]),
|
||||
base = iD.coreGraph([n1]),
|
||||
head = base.replace(n2),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.complete().n).to.equal(n2);
|
||||
});
|
||||
|
||||
it('includes deleted entities', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
base = iD.Graph([node]),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
base = iD.coreGraph([node]),
|
||||
head = base.remove(node),
|
||||
diff = iD.Difference(base, head);
|
||||
expect(diff.complete()).to.eql({n: undefined});
|
||||
});
|
||||
|
||||
it('includes nodes added to a way', function () {
|
||||
var n1 = iD.Node({id: 'n1'}),
|
||||
n2 = iD.Node({id: 'n2'}),
|
||||
w1 = iD.Way({id: 'w', nodes: ['n1']}),
|
||||
var n1 = iD.osmNode({id: 'n1'}),
|
||||
n2 = iD.osmNode({id: 'n2'}),
|
||||
w1 = iD.osmWay({id: 'w', nodes: ['n1']}),
|
||||
w2 = w1.addNode('n2'),
|
||||
base = iD.Graph([n1, n2, w1]),
|
||||
base = iD.coreGraph([n1, n2, w1]),
|
||||
head = base.replace(w2),
|
||||
diff = iD.Difference(base, head);
|
||||
|
||||
@@ -371,11 +371,11 @@ describe('iD.Difference', function () {
|
||||
});
|
||||
|
||||
it('includes nodes removed from a way', function () {
|
||||
var n1 = iD.Node({id: 'n1'}),
|
||||
n2 = iD.Node({id: 'n2'}),
|
||||
w1 = iD.Way({id: 'w', nodes: ['n1', 'n2']}),
|
||||
var n1 = iD.osmNode({id: 'n1'}),
|
||||
n2 = iD.osmNode({id: 'n2'}),
|
||||
w1 = iD.osmWay({id: 'w', nodes: ['n1', 'n2']}),
|
||||
w2 = w1.removeNode('n2'),
|
||||
base = iD.Graph([n1, n2, w1]),
|
||||
base = iD.coreGraph([n1, n2, w1]),
|
||||
head = base.replace(w2),
|
||||
diff = iD.Difference(base, head);
|
||||
|
||||
@@ -383,10 +383,10 @@ describe('iD.Difference', function () {
|
||||
});
|
||||
|
||||
it('includes parent ways of modified nodes', function () {
|
||||
var n1 = iD.Node({id: 'n'}),
|
||||
var n1 = iD.osmNode({id: 'n'}),
|
||||
n2 = n1.move([1, 2]),
|
||||
way = iD.Way({id: 'w', nodes: ['n']}),
|
||||
base = iD.Graph([n1, way]),
|
||||
way = iD.osmWay({id: 'w', nodes: ['n']}),
|
||||
base = iD.coreGraph([n1, way]),
|
||||
head = base.replace(n2),
|
||||
diff = iD.Difference(base, head);
|
||||
|
||||
@@ -394,10 +394,10 @@ describe('iD.Difference', function () {
|
||||
});
|
||||
|
||||
it('includes parent relations of modified entities', function () {
|
||||
var n1 = iD.Node({id: 'n'}),
|
||||
var n1 = iD.osmNode({id: 'n'}),
|
||||
n2 = n1.move([1, 2]),
|
||||
rel = iD.Relation({id: 'r', members: [{id: 'n'}]}),
|
||||
base = iD.Graph([n1, rel]),
|
||||
rel = iD.osmRelation({id: 'r', members: [{id: 'n'}]}),
|
||||
base = iD.coreGraph([n1, rel]),
|
||||
head = base.replace(n2),
|
||||
diff = iD.Difference(base, head);
|
||||
|
||||
@@ -405,11 +405,11 @@ describe('iD.Difference', function () {
|
||||
});
|
||||
|
||||
it('includes parent relations of modified entities, recursively', function () {
|
||||
var n1 = iD.Node({id: 'n'}),
|
||||
var n1 = iD.osmNode({id: 'n'}),
|
||||
n2 = n1.move([1, 2]),
|
||||
rel1 = iD.Relation({id: 'r1', members: [{id: 'n'}]}),
|
||||
rel2 = iD.Relation({id: 'r2', members: [{id: 'r1'}]}),
|
||||
base = iD.Graph([n1, rel1, rel2]),
|
||||
rel1 = iD.osmRelation({id: 'r1', members: [{id: 'n'}]}),
|
||||
rel2 = iD.osmRelation({id: 'r2', members: [{id: 'r1'}]}),
|
||||
base = iD.coreGraph([n1, rel1, rel2]),
|
||||
head = base.replace(n2),
|
||||
diff = iD.Difference(base, head);
|
||||
|
||||
@@ -417,11 +417,11 @@ describe('iD.Difference', function () {
|
||||
});
|
||||
|
||||
it('includes parent relations of parent ways of modified nodes', function () {
|
||||
var n1 = iD.Node({id: 'n'}),
|
||||
var n1 = iD.osmNode({id: 'n'}),
|
||||
n2 = n1.move([1, 2]),
|
||||
way = iD.Way({id: 'w', nodes: ['n']}),
|
||||
rel = iD.Relation({id: 'r', members: [{id: 'w'}]}),
|
||||
base = iD.Graph([n1, way, rel]),
|
||||
way = iD.osmWay({id: 'w', nodes: ['n']}),
|
||||
rel = iD.osmRelation({id: 'r', members: [{id: 'w'}]}),
|
||||
base = iD.coreGraph([n1, way, rel]),
|
||||
head = base.replace(n2),
|
||||
diff = iD.Difference(base, head);
|
||||
|
||||
@@ -429,10 +429,10 @@ describe('iD.Difference', function () {
|
||||
});
|
||||
|
||||
it('copes with recursive relations', function () {
|
||||
var node = iD.Node({id: 'n'}),
|
||||
rel1 = iD.Relation({id: 'r1', members: [{id: 'n'}, {id: 'r2'}]}),
|
||||
rel2 = iD.Relation({id: 'r2', members: [{id: 'r1'}]}),
|
||||
base = iD.Graph([node, rel1, rel2]),
|
||||
var node = iD.osmNode({id: 'n'}),
|
||||
rel1 = iD.osmRelation({id: 'r1', members: [{id: 'n'}, {id: 'r2'}]}),
|
||||
rel2 = iD.osmRelation({id: 'r2', members: [{id: 'r1'}]}),
|
||||
base = iD.coreGraph([node, rel1, rel2]),
|
||||
head = base.replace(node.move([1, 2])),
|
||||
diff = iD.Difference(base, head);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user