mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-17 22:24:49 +02:00
Don't write unsavable changes to localStorage (closes #2705)
This commit is contained in:
@@ -198,7 +198,7 @@ iD.History = function(context) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
toJSON: function() {
|
toJSON: function() {
|
||||||
if (stack.length <= 1) return;
|
if (!this.hasChanges()) return;
|
||||||
|
|
||||||
var allEntities = {},
|
var allEntities = {},
|
||||||
baseEntities = {},
|
baseEntities = {},
|
||||||
|
|||||||
@@ -272,6 +272,13 @@ describe("iD.History", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("#toJSON", function() {
|
describe("#toJSON", function() {
|
||||||
|
it("doesn't generate unsaveable changes", function() {
|
||||||
|
var node_1 = iD.Node({id: 'n-1'});
|
||||||
|
history.perform(iD.actions.AddEntity(node_1));
|
||||||
|
history.perform(iD.actions.DeleteNode('n-1'));
|
||||||
|
expect(history.toJSON()).to.be.not.ok;
|
||||||
|
});
|
||||||
|
|
||||||
it("generates v3 JSON", function() {
|
it("generates v3 JSON", function() {
|
||||||
var node_1 = iD.Node({id: 'n-1'}),
|
var node_1 = iD.Node({id: 'n-1'}),
|
||||||
node1 = iD.Node({id: 'n1'}),
|
node1 = iD.Node({id: 'n1'}),
|
||||||
|
|||||||
Reference in New Issue
Block a user