mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 23:14:47 +02:00
Dispatch a change event on merge
This commit is contained in:
@@ -35,6 +35,8 @@ iD.History = function() {
|
||||
for (var i = 0; i < stack.length; i++) {
|
||||
stack[i].graph.rebase(entities);
|
||||
}
|
||||
|
||||
dispatch.change();
|
||||
},
|
||||
|
||||
perform: function () {
|
||||
|
||||
@@ -102,7 +102,6 @@ iD.Map = function(context) {
|
||||
|
||||
function connectionLoad(err, result) {
|
||||
context.history().merge(result);
|
||||
redraw(Object.keys(result));
|
||||
}
|
||||
|
||||
function zoomPan() {
|
||||
|
||||
@@ -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({});
|
||||
|
||||
Reference in New Issue
Block a user