Fix change summary calculation after restoring

We can't rely on identity equality here due to how
restoring works, and don't want to anyway -- the summary
should ignore net-no-op tag changes.

Fixes #1915.
This commit is contained in:
John Firebaugh
2013-10-23 17:35:35 -07:00
parent 0a3d2161cd
commit fbf2118c76
2 changed files with 14 additions and 2 deletions
+2 -2
View File
@@ -118,8 +118,8 @@ iD.Difference = function(base, head) {
addEntity(change.base, base, 'deleted');
} else if (change.base && change.head) { // modified vertex
var moved = change.base.loc !== change.head.loc,
retagged = change.base.tags !== change.head.tags;
var moved = !_.isEqual(change.base.loc, change.head.loc),
retagged = !_.isEqual(change.base.tags, change.head.tags);
if (moved) {
addParents(change.head);
+12
View File
@@ -265,6 +265,18 @@ describe("iD.Difference", function () {
}]);
});
it("does not report a vertex as modified when it is moved and has no-op tag changes", function() {
var vertex = base.entity('b').update({tags: {}, loc: [1, 2]}),
head = base.replace(vertex),
diff = iD.Difference(base, head);
expect(diff.summary()).to.eql([{
changeType: 'modified',
entity: head.entity('-'),
graph: head
}]);
});
it("reports a vertex as deleted when it had tags", function() {
var vertex = base.entity('v'),
head = base.remove(vertex),