mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
Add Relation#isRestriction
This commit is contained in:
@@ -38,6 +38,10 @@ iD.Relation = iD.Entity.extend({
|
||||
}
|
||||
},
|
||||
|
||||
isRestriction: function() {
|
||||
return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
|
||||
},
|
||||
|
||||
// Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
|
||||
// where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
|
||||
//
|
||||
|
||||
@@ -89,6 +89,21 @@ describe('iD.Relation', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#isRestriction", function () {
|
||||
it("returns true for 'restriction' type", function () {
|
||||
expect(iD.Relation({tags: {type: 'restriction'}}).isRestriction()).to.be.true;
|
||||
});
|
||||
|
||||
it("returns true for 'restriction:type' types", function () {
|
||||
expect(iD.Relation({tags: {type: 'restriction:bus'}}).isRestriction()).to.be.true;
|
||||
});
|
||||
|
||||
it("returns false otherwise", function () {
|
||||
expect(iD.Relation().isRestriction()).to.be.false;
|
||||
expect(iD.Relation({tags: {type: 'multipolygon'}}).isRestriction()).to.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
describe("#multipolygon", function () {
|
||||
specify("single polygon consisting of a single way", function () {
|
||||
var a = iD.Node(),
|
||||
|
||||
Reference in New Issue
Block a user