Dispatch a change event on merge

This commit is contained in:
John Firebaugh
2013-02-02 19:44:47 -05:00
parent 1de05b518d
commit fc00f154a9
3 changed files with 16 additions and 1 deletions
+2
View File
@@ -35,6 +35,8 @@ iD.History = function() {
for (var i = 0; i < stack.length; i++) {
stack[i].graph.rebase(entities);
}
dispatch.change();
},
perform: function () {
-1
View File
@@ -102,7 +102,6 @@ iD.Map = function(context) {
function connectionLoad(err, result) {
context.history().merge(result);
redraw(Object.keys(result));
}
function zoomPan() {
+14
View File
@@ -13,6 +13,20 @@ describe("iD.History", function () {
});
});
describe("#merge", function () {
it("merges the entities into all graph versions", function () {
var n = iD.Node({id: 'n'});
history.merge({n: n});
expect(history.graph().entity('n')).to.equal(n);
});
it("emits a change event", function () {
history.on('change', spy);
history.merge({});
expect(spy).to.have.been.called;
});
});
describe("#perform", function () {
it("returns a difference", function () {
expect(history.perform(action).changes()).to.eql({});