mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-22 00:07:03 +02:00
Default relation members to empty array
This commit is contained in:
@@ -30,11 +30,11 @@ iD.Entity.prototype = {
|
||||
};
|
||||
|
||||
iD.Node = function(attrs) {
|
||||
return iD.Entity({tags: {}}, attrs || {}, {type: 'node'});
|
||||
return iD.Entity(attrs || {}, {type: 'node'});
|
||||
};
|
||||
|
||||
iD.Way = function(attrs) {
|
||||
return iD.Entity({tags: {}, nodes: []}, attrs || {}, {type: 'way'});
|
||||
return iD.Entity({nodes: []}, attrs || {}, {type: 'way'});
|
||||
};
|
||||
|
||||
iD.Way.isOneWay = function(d) {
|
||||
@@ -50,5 +50,5 @@ iD.Way.isArea = function(d) {
|
||||
};
|
||||
|
||||
iD.Relation = function(attrs) {
|
||||
return iD.Entity({tags: {}}, attrs || {}, {type: 'relation'});
|
||||
return iD.Entity({members: []}, attrs || {}, {type: 'relation'});
|
||||
};
|
||||
|
||||
@@ -131,6 +131,14 @@ describe('Relation', function () {
|
||||
expect(iD.Relation({id: 'r1234'}).modified()).not.to.be.ok;
|
||||
});
|
||||
|
||||
it("defaults members to an empty array", function () {
|
||||
expect(iD.Relation().members).to.eql([]);
|
||||
});
|
||||
|
||||
it("sets members as specified", function () {
|
||||
expect(iD.Relation({members: ["n-1"]}).members).to.eql(["n-1"]);
|
||||
});
|
||||
|
||||
it("defaults tags to an empty object", function () {
|
||||
expect(iD.Relation().tags).to.eql({});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user