update tests for iD.Difference fix

This commit is contained in:
Ansis Brammanis
2013-04-18 17:02:19 -04:00
parent e893f686ca
commit c6200931e1
2 changed files with 12 additions and 3 deletions
+11 -2
View File
@@ -18,7 +18,7 @@ describe("iD.Difference", function () {
it("includes modified entities", function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.update(),
n2 = n1.update({ tags: { yes: 'no' } }),
base = iD.Graph([n1]),
head = base.replace(n2),
diff = iD.Difference(base, head);
@@ -27,13 +27,22 @@ describe("iD.Difference", function () {
it("includes undone modified entities", function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.update(),
n2 = n1.update({ tags: { yes: 'no' } }),
base = iD.Graph([n1]),
head = base.replace(n2),
diff = iD.Difference(head, base);
expect(diff.changes()).to.eql({n: {base: n2, head: n1}});
});
it("doesn't include updated but identical entities", function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.update(),
base = iD.Graph([n1]),
head = base.replace(n2),
diff = iD.Difference(base, head);
expect(diff.changes()).to.eql({});
});
it("includes deleted entities", function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph([node]),
+1 -1
View File
@@ -184,7 +184,7 @@ describe("iD.History", function () {
it("includes modified entities", function () {
var node1 = iD.Node({id: "n1"}),
node2 = node1.update({});
node2 = node1.update({ tags: { yes: "no" } });
history.merge({ n1: node1});
history.perform(function (graph) { return graph.replace(node2); });
expect(history.changes().modified).to.eql([node2]);