mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
Merge tags without a space, fixes #941
This commit is contained in:
@@ -3,7 +3,9 @@ iD.Entity = function(attrs) {
|
||||
if (this instanceof iD.Entity) return;
|
||||
|
||||
// Create the appropriate subtype.
|
||||
if (attrs && attrs.type) return iD.Entity[attrs.type].apply(this, arguments);
|
||||
if (attrs && attrs.type) {
|
||||
return iD.Entity[attrs.type].apply(this, arguments);
|
||||
}
|
||||
|
||||
// Initialize a generic Entity (used only in tests).
|
||||
return (new iD.Entity()).initialize(arguments);
|
||||
@@ -71,7 +73,7 @@ iD.Entity.prototype = {
|
||||
var t1 = merged[k],
|
||||
t2 = tags[k];
|
||||
if (t1 && t1 !== t2) {
|
||||
merged[k] = t1 + "; " + t2;
|
||||
merged[k] = t1 + ';' + t2;
|
||||
} else {
|
||||
merged[k] = t2;
|
||||
}
|
||||
@@ -85,9 +87,9 @@ iD.Entity.prototype = {
|
||||
|
||||
hasInterestingTags: function() {
|
||||
return _.keys(this.tags).some(function(key) {
|
||||
return key != "attribution" &&
|
||||
key != "created_by" &&
|
||||
key != "source" &&
|
||||
return key != 'attribution' &&
|
||||
key != 'created_by' &&
|
||||
key != 'source' &&
|
||||
key != 'odbl' &&
|
||||
key.indexOf('tiger:') !== 0;
|
||||
});
|
||||
@@ -114,7 +116,7 @@ iD.Entity.prototype = {
|
||||
// Generate a string such as 'river' or 'Fred's House' for an entity.
|
||||
if (!this.tags || !Object.keys(this.tags).length) { return ''; }
|
||||
|
||||
var mainkeys = ['highway','amenity','railway','waterway','natural'],
|
||||
var mainkeys = ['highway', 'amenity', 'railway', 'waterway', 'natural'],
|
||||
n = [];
|
||||
|
||||
if (this.tags.name) n.push(this.tags.name);
|
||||
|
||||
@@ -152,7 +152,7 @@ describe("iD.actions.Join", function () {
|
||||
|
||||
graph = iD.actions.Join(['-', '='])(graph);
|
||||
|
||||
expect(graph.entity('-').tags).to.eql({a: 'a', b: '-; =', c: 'c', d: 'd'});
|
||||
expect(graph.entity('-').tags).to.eql({a: 'a', b: '-;=', c: 'c', d: 'd'});
|
||||
});
|
||||
|
||||
it("merges relations", function () {
|
||||
|
||||
@@ -86,7 +86,7 @@ describe('iD.Entity', function () {
|
||||
it("combines conflicting tags with semicolons", function () {
|
||||
var a = iD.Entity({tags: {a: 'a'}}),
|
||||
b = a.mergeTags({a: 'b'});
|
||||
expect(b.tags).to.eql({a: 'a; b'});
|
||||
expect(b.tags).to.eql({a: 'a;b'});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user