From c4fe42653a49d5294c75a6f02eed6896c7cc2178 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 12 Feb 2019 21:18:25 -0500 Subject: [PATCH] s/coordinates/loc and replace legacy names in tests In iD codebase `loc` is usually a single coordinate pair and `coordinates` is usually an array of pairs --- modules/core/validator.js | 12 ++-- modules/validations/almost_junction.js | 2 +- modules/validations/crossing_ways.js | 4 +- test/spec/validations/almost_junction.js | 75 +++++++++++----------- test/spec/validations/crossing_ways.js | 71 ++++++++++---------- test/spec/validations/deprecated_tag.js | 10 ++- test/spec/validations/disconnected_way.js | 25 +++----- test/spec/validations/missing_tag.js | 21 +++--- test/spec/validations/tag_suggests_area.js | 10 ++- test/spec/validations/validator.js | 10 ++- 10 files changed, 112 insertions(+), 128 deletions(-) diff --git a/modules/core/validator.js b/modules/core/validator.js index 141f02c05..cf917f3bb 100644 --- a/modules/core/validator.js +++ b/modules/core/validator.js @@ -172,7 +172,7 @@ export function validationIssue(attrs) { this.message = attrs.message; // required - localized string this.tooltip = attrs.tooltip; // required - localized string this.entities = attrs.entities; // optional - array of entities - this.coordinates = attrs.coordinates; // optional - expect a [lon, lat] array + this.loc = attrs.loc; // optional - expect a [lon, lat] array this.info = attrs.info; // optional - object containing arbitrary extra information this.fixes = attrs.fixes; // optional - array of validationIssueFix objects this.hash = attrs.hash; // optional - string to further differentiate the issue @@ -191,18 +191,18 @@ export function validationIssue(attrs) { var entityKeys = this.entities.map(osmEntity.key); id += entityKeys.sort().join(); - // factor in coordinates since two separate issues can have an + // factor in loc since two separate issues can have an // idential type and entities, e.g. in crossing_ways - if (this.coordinates) { - id += this.coordinates.join(); + if (this.loc) { + id += this.loc.join(); } return id; }; this.extent = function(resolver) { - if (this.coordinates) { - return geoExtent(this.coordinates); + if (this.loc) { + return geoExtent(this.loc); } if (this.entities && this.entities.length) { return this.entities.reduce(function(extent, entity) { diff --git a/modules/validations/almost_junction.js b/modules/validations/almost_junction.js index 1b50b0e4f..31aeb9e88 100644 --- a/modules/validations/almost_junction.js +++ b/modules/validations/almost_junction.js @@ -182,7 +182,7 @@ export function validationAlmostJunction() { }), tooltip: t('issues.almost_junction.highway-highway.tip'), entities: [endHighway, node, edgeHighway], - coordinates: extendableNodeInfo.node.loc, + loc: extendableNodeInfo.node.loc, info: { edge: extendableNodeInfo.edge, cross_loc: extendableNodeInfo.cross_loc diff --git a/modules/validations/crossing_ways.js b/modules/validations/crossing_ways.js index 21248d9a6..5b3007b7d 100644 --- a/modules/validations/crossing_ways.js +++ b/modules/validations/crossing_ways.js @@ -361,7 +361,7 @@ export function validationCrossingWays() { fixes.push(new validationIssueFix({ title: t('issues.fix.add_connection_vertex.title'), onClick: function() { - var loc = this.issue.coordinates; + var loc = this.issue.loc; var connectionTags = this.issue.info.connectionTags; var edges = this.issue.info.edges; @@ -406,7 +406,7 @@ export function validationCrossingWays() { tooltip: t('issues.crossing_ways.'+crossingTypeID+'.tip'), entities: entities, info: { edges: crossing.edges, connectionTags: connectionTags }, - coordinates: crossing.crossPoint, + loc: crossing.crossPoint, fixes: fixes }); } diff --git a/test/spec/validations/almost_junction.js b/test/spec/validations/almost_junction.js index 5f8428ea5..80c19afef 100644 --- a/test/spec/validations/almost_junction.js +++ b/test/spec/validations/almost_junction.js @@ -2,14 +2,14 @@ describe('iD.validations.almost_junction', function () { var context; beforeEach(function() { - context = iD.Context(); + context = iD.coreContext(); }); function horizontalVertialCloserThanThd() { // horizontal road - var n1 = iD.Node({id: 'n-1', loc: [22.42357, 0]}); - var n2 = iD.Node({id: 'n-2', loc: [22.42367, 0]}); - var w1 = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); + var n1 = iD.osmNode({id: 'n-1', loc: [22.42357, 0]}); + var n2 = iD.osmNode({id: 'n-2', loc: [22.42367, 0]}); + var w1 = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n1), @@ -19,9 +19,9 @@ describe('iD.validations.almost_junction', function () { // vertical road to the west of w1 by 0.00001 logitude degree // 5th digit after decimal point has a resolution of ~1 meter - var n3 = iD.Node({id: 'n-3', loc: [22.42356, 0.001]}); - var n4 = iD.Node({id: 'n-4', loc: [22.42356, -0.001]}); - var w2 = iD.Way({id: 'w-2', nodes: ['n-3', 'n-4'], tags: { highway: 'residential' }}); + var n3 = iD.osmNode({id: 'n-3', loc: [22.42356, 0.001]}); + var n4 = iD.osmNode({id: 'n-4', loc: [22.42356, -0.001]}); + var w2 = iD.osmWay({id: 'w-2', nodes: ['n-3', 'n-4'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n3), @@ -32,9 +32,9 @@ describe('iD.validations.almost_junction', function () { function horizontalTiltedCloserThanThd() { // horizontal road - var n1 = iD.Node({id: 'n-1', loc: [22.42357, 0]}); - var n2 = iD.Node({id: 'n-2', loc: [22.42367, 0]}); - var w1 = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); + var n1 = iD.osmNode({id: 'n-1', loc: [22.42357, 0]}); + var n2 = iD.osmNode({id: 'n-2', loc: [22.42367, 0]}); + var w1 = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n1), @@ -43,9 +43,9 @@ describe('iD.validations.almost_junction', function () { ); // tilted road to the west of w1 by 0.00001 logitude degree - var n3 = iD.Node({id: 'n-3', loc: [22.423555, 0.001]}); - var n4 = iD.Node({id: 'n-4', loc: [22.423565, -0.001]}); - var w2 = iD.Way({id: 'w-2', nodes: ['n-3', 'n-4'], tags: { highway: 'residential' }}); + var n3 = iD.osmNode({id: 'n-3', loc: [22.423555, 0.001]}); + var n4 = iD.osmNode({id: 'n-4', loc: [22.423565, -0.001]}); + var w2 = iD.osmWay({id: 'w-2', nodes: ['n-3', 'n-4'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n3), @@ -56,9 +56,9 @@ describe('iD.validations.almost_junction', function () { function horizontalVertialFurtherThanThd() { // horizontal road - var n1 = iD.Node({id: 'n-1', loc: [22.42357, 0]}); - var n2 = iD.Node({id: 'n-2', loc: [22.42367, 0]}); - var w1 = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); + var n1 = iD.osmNode({id: 'n-1', loc: [22.42357, 0]}); + var n2 = iD.osmNode({id: 'n-2', loc: [22.42367, 0]}); + var w1 = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n1), @@ -67,9 +67,9 @@ describe('iD.validations.almost_junction', function () { ); // vertical road to the west of w1 by 0.00007 logitude degree - var n3 = iD.Node({id: 'n-3', loc: [22.42350, 0.001]}); - var n4 = iD.Node({id: 'n-4', loc: [22.42350, -0.001]}); - var w2 = iD.Way({id: 'w-2', nodes: ['n-3', 'n-4'], tags: { highway: 'residential' }}); + var n3 = iD.osmNode({id: 'n-3', loc: [22.42350, 0.001]}); + var n4 = iD.osmNode({id: 'n-4', loc: [22.42350, -0.001]}); + var w2 = iD.osmWay({id: 'w-2', nodes: ['n-3', 'n-4'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n3), @@ -80,9 +80,9 @@ describe('iD.validations.almost_junction', function () { function twoHorizontalCloserThanThd() { // horizontal road - var n1 = iD.Node({id: 'n-1', loc: [22.42357, 0]}); - var n2 = iD.Node({id: 'n-2', loc: [22.42367, 0]}); - var w1 = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); + var n1 = iD.osmNode({id: 'n-1', loc: [22.42357, 0]}); + var n2 = iD.osmNode({id: 'n-2', loc: [22.42367, 0]}); + var w1 = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n1), @@ -91,9 +91,9 @@ describe('iD.validations.almost_junction', function () { ); // another horizontal road to the north of w1 by 0.0001 latitude degree - var n3 = iD.Node({id: 'n-3', loc: [22.42357, 0.00001]}); - var n4 = iD.Node({id: 'n-4', loc: [22.42367, 0.00001]}); - var w2 = iD.Way({id: 'w-2', nodes: ['n-3', 'n-4'], tags: { highway: 'residential' }}); + var n3 = iD.osmNode({id: 'n-3', loc: [22.42357, 0.00001]}); + var n4 = iD.osmNode({id: 'n-4', loc: [22.42367, 0.00001]}); + var w2 = iD.osmWay({id: 'w-2', nodes: ['n-3', 'n-4'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n3), @@ -104,9 +104,9 @@ describe('iD.validations.almost_junction', function () { function horizontalVertialWithNoExit() { // horizontal road - var n1 = iD.Node({id: 'n-1', loc: [22.42357, 0], tags: { noexit: 'yes' }}); - var n2 = iD.Node({id: 'n-2', loc: [22.42367, 0]}); - var w1 = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); + var n1 = iD.osmNode({id: 'n-1', loc: [22.42357, 0], tags: { noexit: 'yes' }}); + var n2 = iD.osmNode({id: 'n-2', loc: [22.42367, 0]}); + var w1 = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n1), @@ -115,9 +115,9 @@ describe('iD.validations.almost_junction', function () { ); // vertical road to the west of w1 by 0.00001 logitude degree - var n3 = iD.Node({id: 'n-3', loc: [22.42356, 0.001]}); - var n4 = iD.Node({id: 'n-4', loc: [22.42356, -0.001]}); - var w2 = iD.Way({id: 'w-2', nodes: ['n-3', 'n-4'], tags: { highway: 'residential' }}); + var n3 = iD.osmNode({id: 'n-3', loc: [22.42356, 0.001]}); + var n4 = iD.osmNode({id: 'n-4', loc: [22.42356, -0.001]}); + var w2 = iD.osmWay({id: 'w-2', nodes: ['n-3', 'n-4'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n3), @@ -153,9 +153,9 @@ describe('iD.validations.almost_junction', function () { expect(issue.entities[1].id).to.eql('n-1'); expect(issue.entities[2].id).to.eql('w-2'); - expect(issue.coordinates).to.have.lengthOf(2); - expect(issue.coordinates[0]).to.eql(22.42357); - expect(issue.coordinates[1]).to.eql(0); + expect(issue.loc).to.have.lengthOf(2); + expect(issue.loc[0]).to.eql(22.42357); + expect(issue.loc[1]).to.eql(0); expect(issue.info.edge).to.have.lengthOf(2); expect(issue.info.edge[0]).to.eql('n-3'); @@ -182,9 +182,9 @@ describe('iD.validations.almost_junction', function () { expect(issue.entities[1].id).to.eql('n-1'); expect(issue.entities[2].id).to.eql('w-2'); - expect(issue.coordinates).to.have.lengthOf(2); - expect(issue.coordinates[0]).to.eql(22.42357); - expect(issue.coordinates[1]).to.eql(0); + expect(issue.loc).to.have.lengthOf(2); + expect(issue.loc[0]).to.eql(22.42357); + expect(issue.loc[1]).to.eql(0); expect(issue.info.edge).to.have.lengthOf(2); expect(issue.info.edge[0]).to.eql('n-3'); @@ -217,4 +217,5 @@ describe('iD.validations.almost_junction', function () { var issues = validate(); expect(issues).to.have.lengthOf(0); }); + }); diff --git a/test/spec/validations/crossing_ways.js b/test/spec/validations/crossing_ways.js index bee17b886..81b0e631c 100644 --- a/test/spec/validations/crossing_ways.js +++ b/test/spec/validations/crossing_ways.js @@ -2,13 +2,13 @@ describe('iD.validations.crossing_ways', function () { var context; beforeEach(function() { - context = iD.Context(); + context = iD.coreContext(); }); function createWaysWithOneCrossingPoint(tags1, tags2) { - var n1 = iD.Node({id: 'n-1', loc: [1,1]}); - var n2 = iD.Node({id: 'n-2', loc: [2,2]}); - var w1 = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: tags1}); + var n1 = iD.osmNode({id: 'n-1', loc: [1,1]}); + var n2 = iD.osmNode({id: 'n-2', loc: [2,2]}); + var w1 = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: tags1}); context.perform( iD.actionAddEntity(n1), @@ -16,9 +16,9 @@ describe('iD.validations.crossing_ways', function () { iD.actionAddEntity(w1) ); - var n3 = iD.Node({id: 'n-3', loc: [1,2]}); - var n4 = iD.Node({id: 'n-4', loc: [2,1]}); - var w2 = iD.Way({id: 'w-2', nodes: ['n-3', 'n-4'], tags: tags2}); + var n3 = iD.osmNode({id: 'n-3', loc: [1,2]}); + var n4 = iD.osmNode({id: 'n-4', loc: [2,1]}); + var w2 = iD.osmWay({id: 'w-2', nodes: ['n-3', 'n-4'], tags: tags2}); context.perform( iD.actionAddEntity(n3), @@ -28,9 +28,9 @@ describe('iD.validations.crossing_ways', function () { } function createWaysWithTwoCrossingPoint() { - var n1 = iD.Node({id: 'n-1', loc: [1,1]}); - var n2 = iD.Node({id: 'n-2', loc: [3,3]}); - var w1 = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); + var n1 = iD.osmNode({id: 'n-1', loc: [1,1]}); + var n2 = iD.osmNode({id: 'n-2', loc: [3,3]}); + var w1 = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n1), @@ -38,11 +38,11 @@ describe('iD.validations.crossing_ways', function () { iD.actionAddEntity(w1) ); - var n3 = iD.Node({id: 'n-3', loc: [1,2]}); - var n4 = iD.Node({id: 'n-4', loc: [2,1]}); - var n5 = iD.Node({id: 'n-5', loc: [3,2]}); - var n6 = iD.Node({id: 'n-6', loc: [2,3]}); - var w2 = iD.Way({id: 'w-2', nodes: ['n-3', 'n-4', 'n-5', 'n-6'], tags: { highway: 'residential' }}); + var n3 = iD.osmNode({id: 'n-3', loc: [1,2]}); + var n4 = iD.osmNode({id: 'n-4', loc: [2,1]}); + var n5 = iD.osmNode({id: 'n-5', loc: [3,2]}); + var n6 = iD.osmNode({id: 'n-6', loc: [2,3]}); + var w2 = iD.osmWay({id: 'w-2', nodes: ['n-3', 'n-4', 'n-5', 'n-6'], tags: { highway: 'residential' }}); context.perform( iD.actionAddEntity(n3), @@ -69,9 +69,9 @@ describe('iD.validations.crossing_ways', function () { expect(issue.type).to.eql('crossing_ways'); expect(issue.entities).to.have.lengthOf(2); - expect(issue.coordinates).to.have.lengthOf(2); - expect(issue.coordinates[0]).to.eql(1.5); - expect(issue.coordinates[1]).to.eql(1.5); + expect(issue.loc).to.have.lengthOf(2); + expect(issue.loc[0]).to.eql(1.5); + expect(issue.loc[1]).to.eql(1.5); } it('has no errors on init', function() { @@ -199,23 +199,23 @@ describe('iD.validations.crossing_ways', function () { expect(issue.type).to.eql('crossing_ways'); expect(issue.entities).to.have.lengthOf(2); - expect(issue.coordinates).to.have.lengthOf(2); - expect(issue.coordinates[0]).to.eql(1.5); - expect(issue.coordinates[1]).to.eql(1.5); + expect(issue.loc).to.have.lengthOf(2); + expect(issue.loc[0]).to.eql(1.5); + expect(issue.loc[1]).to.eql(1.5); issue = issues[1]; expect(issue.type).to.eql('crossing_ways'); expect(issue.entities).to.have.lengthOf(2); - expect(issue.coordinates).to.have.lengthOf(2); - expect(issue.coordinates[0]).to.eql(2.5); - expect(issue.coordinates[1]).to.eql(2.5); + expect(issue.loc).to.have.lengthOf(2); + expect(issue.loc[0]).to.eql(2.5); + expect(issue.loc[1]).to.eql(2.5); }); function createWayAndRelationWithOneCrossingPoint(wayTags, relTags) { - var n1 = iD.Node({id: 'n-1', loc: [1,1]}); - var n2 = iD.Node({id: 'n-2', loc: [2,2]}); - var w1 = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: wayTags}); + var n1 = iD.osmNode({id: 'n-1', loc: [1,1]}); + var n2 = iD.osmNode({id: 'n-2', loc: [2,2]}); + var w1 = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: wayTags}); context.perform( iD.actionAddEntity(n1), @@ -223,13 +223,13 @@ describe('iD.validations.crossing_ways', function () { iD.actionAddEntity(w1) ); - var n3 = iD.Node({id: 'n-3', loc: [1,2]}); - var n4 = iD.Node({id: 'n-4', loc: [2,1]}); - var n5 = iD.Node({id: 'n-5', loc: [3,2]}); - var n6 = iD.Node({id: 'n-6', loc: [2,3]}); - var w2 = iD.Way({id: 'w-2', nodes: ['n-3', 'n-4', 'n-5'], tags: {}}); - var w3 = iD.Way({id: 'w-3', nodes: ['n-5', 'n-6', 'n-3'], tags: {}}); - var r1 = iD.Relation({id: 'r-1', members: [{id: 'w-2'}, {id: 'w-3'}], tags: relTags}); + var n3 = iD.osmNode({id: 'n-3', loc: [1,2]}); + var n4 = iD.osmNode({id: 'n-4', loc: [2,1]}); + var n5 = iD.osmNode({id: 'n-5', loc: [3,2]}); + var n6 = iD.osmNode({id: 'n-6', loc: [2,3]}); + var w2 = iD.osmWay({id: 'w-2', nodes: ['n-3', 'n-4', 'n-5'], tags: {}}); + var w3 = iD.osmWay({id: 'w-3', nodes: ['n-5', 'n-6', 'n-3'], tags: {}}); + var r1 = iD.osmRelation({id: 'r-1', members: [{id: 'w-2'}, {id: 'w-3'}], tags: relTags}); context.perform( iD.actionAddEntity(n3), @@ -242,10 +242,9 @@ describe('iD.validations.crossing_ways', function () { ); } - - // warning crossing cases between way and relation it('one cross point between highway and building relation', function() { createWayAndRelationWithOneCrossingPoint({ highway: 'residential' }, { building: 'yes' }); verifySingleCrossingIssue(validate(), 'r-1'); }); + }); diff --git a/test/spec/validations/deprecated_tag.js b/test/spec/validations/deprecated_tag.js index 6881092b5..66cfdfd01 100644 --- a/test/spec/validations/deprecated_tag.js +++ b/test/spec/validations/deprecated_tag.js @@ -2,14 +2,13 @@ describe('iD.validations.deprecated_tag', function () { var context; beforeEach(function() { - context = iD.Context(); + context = iD.coreContext(); }); function createWay(tags) { - var n1 = iD.Node({id: 'n-1', loc: [4,4]}); - var n2 = iD.Node({id: 'n-2', loc: [4,5]}); - - var w = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: tags}); + var n1 = iD.osmNode({id: 'n-1', loc: [4,4]}); + var n2 = iD.osmNode({id: 'n-2', loc: [4,5]}); + var w = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: tags}); context.perform( iD.actionAddEntity(n1), @@ -51,5 +50,4 @@ describe('iD.validations.deprecated_tag', function () { expect(issue.entities[0].id).to.eql('w-1'); }); - }); diff --git a/test/spec/validations/disconnected_way.js b/test/spec/validations/disconnected_way.js index f63dbbe95..ddc9aa50d 100644 --- a/test/spec/validations/disconnected_way.js +++ b/test/spec/validations/disconnected_way.js @@ -2,14 +2,13 @@ describe('iD.validations.disconnected_way', function () { var context; beforeEach(function() { - context = iD.Context(); + context = iD.coreContext(); }); function createWay(tags) { - var n1 = iD.Node({id: 'n-1', loc: [4,4]}); - var n2 = iD.Node({id: 'n-2', loc: [4,5]}); - - var w = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: tags}); + var n1 = iD.osmNode({id: 'n-1', loc: [4,4]}); + var n2 = iD.osmNode({id: 'n-2', loc: [4,5]}); + var w = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: tags}); context.perform( iD.actionAddEntity(n1), @@ -19,16 +18,11 @@ describe('iD.validations.disconnected_way', function () { } function createConnectingWays() { - var n1 = iD.Node({id: 'n-1', loc: [4,4]}); - var n2 = iD.Node({id: 'n-2', loc: [4,5]}); - var n3 = iD.Node({id: 'n-3', loc: [5,5]}); - - var w = iD.Way( - {id: 'w-1', nodes: ['n-1', 'n-2'], - tags: {'highway': 'unclassified'}}); - var w2 = iD.Way({ - id: 'w-2', nodes: ['n-1', 'n-3'], - tags: {'highway': 'unclassified'}}); + var n1 = iD.osmNode({id: 'n-1', loc: [4,4]}); + var n2 = iD.osmNode({id: 'n-2', loc: [4,5]}); + var n3 = iD.osmNode({id: 'n-3', loc: [5,5]}); + var w = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: {'highway': 'unclassified'}}); + var w2 = iD.osmWay({id: 'w-2', nodes: ['n-1', 'n-3'], tags: {'highway': 'unclassified'}}); context.perform( iD.actionAddEntity(n1), @@ -72,5 +66,4 @@ describe('iD.validations.disconnected_way', function () { expect(issues).to.have.lengthOf(0); }); - }); diff --git a/test/spec/validations/missing_tag.js b/test/spec/validations/missing_tag.js index 8373e591f..ac02534dd 100644 --- a/test/spec/validations/missing_tag.js +++ b/test/spec/validations/missing_tag.js @@ -2,14 +2,13 @@ describe('iD.validations.missing_tag', function () { var context; beforeEach(function() { - context = iD.Context(); + context = iD.coreContext(); }); function createWay(tags) { - var n1 = iD.Node({id: 'n-1', loc: [4,4]}); - var n2 = iD.Node({id: 'n-2', loc: [4,5]}); - - var w = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: tags}); + var n1 = iD.osmNode({id: 'n-1', loc: [4,4]}); + var n2 = iD.osmNode({id: 'n-2', loc: [4,5]}); + var w = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: tags}); context.perform( iD.actionAddEntity(n1), @@ -19,12 +18,11 @@ describe('iD.validations.missing_tag', function () { } function createRelation(tags) { - var n1 = iD.Node({id: 'n-1', loc: [4,4]}); - var n2 = iD.Node({id: 'n-2', loc: [4,5]}); - var n3 = iD.Node({id: 'n-3', loc: [5,5]}); - - var w = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2', 'n-3', 'n-1']}); - var r = iD.Relation({id: 'r-1', members: [{id: 'w-1'}], tags: tags}); + var n1 = iD.osmNode({id: 'n-1', loc: [4,4]}); + var n2 = iD.osmNode({id: 'n-2', loc: [4,5]}); + var n3 = iD.osmNode({id: 'n-3', loc: [5,5]}); + var w = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2', 'n-3', 'n-1']}); + var r = iD.osmRelation({id: 'r-1', members: [{id: 'w-1'}], tags: tags}); context.perform( iD.actionAddEntity(n1), @@ -103,5 +101,4 @@ describe('iD.validations.missing_tag', function () { expect(issue.entities[0].id).to.eql('r-1'); }); - }); diff --git a/test/spec/validations/tag_suggests_area.js b/test/spec/validations/tag_suggests_area.js index 59c91c39e..8f6d2517f 100644 --- a/test/spec/validations/tag_suggests_area.js +++ b/test/spec/validations/tag_suggests_area.js @@ -6,10 +6,9 @@ describe('iD.validations.tag_suggests_area', function () { }); function createWay(tags) { - var n1 = iD.Node({id: 'n-1', loc: [4,4]}); - var n2 = iD.Node({id: 'n-2', loc: [4,5]}); - - var w = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2'], tags: tags}); + var n1 = iD.osmNode({id: 'n-1', loc: [4,4]}); + var n2 = iD.osmNode({id: 'n-2', loc: [4,5]}); + var w = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2'], tags: tags}); context.perform( iD.actionAddEntity(n1), @@ -19,7 +18,7 @@ describe('iD.validations.tag_suggests_area', function () { } function createPoint(tags) { - var n1 = iD.Node({id: 'n-1', loc: [4,4], tags: tags}); + var n1 = iD.osmNode({id: 'n-1', loc: [4,4], tags: tags}); context.perform( iD.actionAddEntity(n1) ); @@ -65,5 +64,4 @@ describe('iD.validations.tag_suggests_area', function () { expect(issue.entities[0].id).to.eql('w-1'); }); - }); diff --git a/test/spec/validations/validator.js b/test/spec/validations/validator.js index 820122bf7..6b241e46f 100644 --- a/test/spec/validations/validator.js +++ b/test/spec/validations/validator.js @@ -2,14 +2,13 @@ describe('iD.validations.validator', function () { var context; beforeEach(function() { - context = iD.Context(); + context = iD.coreContext(); }); function createInvalidWay() { - var n1 = iD.Node({id: 'n-1', loc: [4,4]}); - var n2 = iD.Node({id: 'n-2', loc: [4,5]}); - - var w = iD.Way({id: 'w-1', nodes: ['n-1', 'n-2']}); + var n1 = iD.osmNode({id: 'n-1', loc: [4,4]}); + var n2 = iD.osmNode({id: 'n-2', loc: [4,5]}); + var w = iD.osmWay({id: 'w-1', nodes: ['n-1', 'n-2']}); context.perform( iD.actionAddEntity(n1), @@ -39,5 +38,4 @@ describe('iD.validations.validator', function () { expect(issue.entities[0].id).to.eql('w-1'); }); - });