mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
Smarter tag conflict merging (fixes #943)
This commit is contained in:
@@ -73,7 +73,7 @@ iD.Entity.prototype = {
|
||||
var t1 = merged[k],
|
||||
t2 = tags[k];
|
||||
if (t1 && t1 !== t2) {
|
||||
merged[k] = t1 + ';' + t2;
|
||||
merged[k] = _.union(t1.split(/;\s*/), t2.split(/;\s*/)).join(';');
|
||||
} else {
|
||||
merged[k] = t2;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,22 @@ describe('iD.Entity', function () {
|
||||
b = a.mergeTags({a: 'b'});
|
||||
expect(b.tags).to.eql({a: 'a;b'});
|
||||
});
|
||||
|
||||
it("combines combined tags", function () {
|
||||
var a = iD.Entity({tags: {a: 'a;b'}}),
|
||||
b = iD.Entity({tags: {a: 'b'}});
|
||||
|
||||
expect(a.mergeTags(b.tags).tags).to.eql({a: 'a;b'});
|
||||
expect(b.mergeTags(a.tags).tags).to.eql({a: 'b;a'});
|
||||
});
|
||||
|
||||
it("combines combined tags with whitespace", function () {
|
||||
var a = iD.Entity({tags: {a: 'a; b'}}),
|
||||
b = iD.Entity({tags: {a: 'b'}});
|
||||
|
||||
expect(a.mergeTags(b.tags).tags).to.eql({a: 'a;b'});
|
||||
expect(b.mergeTags(a.tags).tags).to.eql({a: 'b;a'});
|
||||
});
|
||||
});
|
||||
|
||||
describe("#osmId", function () {
|
||||
|
||||
Reference in New Issue
Block a user