mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-16 13:59:27 +02:00
Create method history.hasChanges
This commit is contained in:
@@ -109,6 +109,12 @@ iD.History = function() {
|
||||
};
|
||||
},
|
||||
|
||||
hasChanges: function() {
|
||||
return !!d3.sum(d3.values(this.changes()).map(function(c) {
|
||||
return c.length;
|
||||
}));;
|
||||
},
|
||||
|
||||
imagery_used: function(source) {
|
||||
if (source) imagery_used = source;
|
||||
else return _.without(
|
||||
|
||||
@@ -126,6 +126,18 @@ describe("iD.History", function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#hasChanges", function() {
|
||||
it("is true when any of change's values are nonempty", function() {
|
||||
var node = iD.Node();
|
||||
history.perform(function (graph) { return graph.replace(node); });
|
||||
expect(history.hasChanges()).to.eql(true);
|
||||
});
|
||||
|
||||
it("is false when any of change's values are empty", function() {
|
||||
expect(history.hasChanges()).to.eql(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#reset", function () {
|
||||
it("clears the version stack", function () {
|
||||
history.perform(action, "annotation");
|
||||
|
||||
Reference in New Issue
Block a user