mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
Fix JavaScript error that could cause validation warnings to appear unexpectedly (close #7166)
Add code test to account for deprecated tags with no replacement
This commit is contained in:
@@ -205,7 +205,7 @@ osmEntity.prototype = {
|
||||
return vals.indexOf(d.old[key]) !== -1;
|
||||
} else {
|
||||
if (tags[key] === d.old[key]) {
|
||||
if (d.old[key] === d.replace[key]) {
|
||||
if (d.replace && d.old[key] === d.replace[key]) {
|
||||
return !Object.keys(d.replace).every(function(key) {
|
||||
return tags[key] === d.replace[key];
|
||||
});
|
||||
|
||||
@@ -55,7 +55,7 @@ describe('iD.validations.outdated_tags', function () {
|
||||
expect(issues).to.have.lengthOf(0);
|
||||
});
|
||||
|
||||
it('flags deprecated tags', function() {
|
||||
it('flags deprecated tag with replacement', function() {
|
||||
createWay({'highway': 'ford'});
|
||||
var issues = validate();
|
||||
expect(issues).to.have.lengthOf(1);
|
||||
@@ -67,6 +67,17 @@ describe('iD.validations.outdated_tags', function () {
|
||||
expect(issue.entityIds[0]).to.eql('w-1');
|
||||
});
|
||||
|
||||
it('flags deprecated tag with no replacement', function() {
|
||||
createWay({'highway': 'no'});
|
||||
var issues = validate();
|
||||
expect(issues).to.have.lengthOf(1);
|
||||
var issue = issues[0];
|
||||
expect(issue.type).to.eql('outdated_tags');
|
||||
expect(issue.subtype).to.eql('deprecated_tags');
|
||||
expect(issue.severity).to.eql('warning');
|
||||
expect(issue.entityIds).to.have.lengthOf(1);
|
||||
expect(issue.entityIds[0]).to.eql('w-1');
|
||||
});
|
||||
|
||||
it('ignores way with no relations', function() {
|
||||
createWay({});
|
||||
|
||||
Reference in New Issue
Block a user