Differentiate between paved/unpaved roads (closes #2564)

Now `iD.svg.TagClasses` will add the class 'tag-unpaved' for unpaved roads.
This commit is contained in:
Bryan Housel
2015-11-25 15:28:37 -05:00
parent 093b2a5a60
commit b4628298d9
3 changed files with 105 additions and 0 deletions
+79
View File
@@ -82,6 +82,85 @@ describe("iD.svg.TagClasses", function () {
expect(selection.attr('class')).to.equal(null);
});
it('adds tag-unpaved for highway=track with no surface tagging', function() {
selection
.datum(iD.Entity({tags: {highway: 'track'}}))
.call(iD.svg.TagClasses());
expect(selection).to.be.classed('tag-unpaved');
});
it('does not add tag-unpaved for highway=track with explicit paved surface tagging', function() {
selection
.datum(iD.Entity({tags: {highway: 'track', surface: 'asphalt'}}))
.call(iD.svg.TagClasses());
expect(selection).not.to.be.classed('tag-unpaved');
selection
.datum(iD.Entity({tags: {highway: 'track', tracktype: 'grade1'}}))
.call(iD.svg.TagClasses());
expect(selection).not.to.be.classed('tag-unpaved');
});
it('adds tag-unpaved for highway=track with explicit unpaved surface tagging', function() {
selection
.datum(iD.Entity({tags: {highway: 'track', surface: 'dirt'}}))
.call(iD.svg.TagClasses());
expect(selection).to.be.classed('tag-unpaved');
selection
.datum(iD.Entity({tags: {highway: 'track', tracktype: 'grade3'}}))
.call(iD.svg.TagClasses());
expect(selection).to.be.classed('tag-unpaved');
});
it('does not add tag-unpaved for other highway types with no surface tagging', function() {
selection
.datum(iD.Entity({tags: {highway: 'tertiary'}}))
.call(iD.svg.TagClasses());
expect(selection).not.to.be.classed('tag-unpaved');
selection
.datum(iD.Entity({tags: {highway: 'foo'}}))
.call(iD.svg.TagClasses());
expect(selection).not.to.be.classed('tag-unpaved');
});
it('does not add tag-unpaved for other highway types with explicit paved surface tagging', function() {
selection
.datum(iD.Entity({tags: {highway: 'tertiary', surface: 'asphalt'}}))
.call(iD.svg.TagClasses());
expect(selection).not.to.be.classed('tag-unpaved');
selection
.datum(iD.Entity({tags: {highway: 'foo', tracktype: 'grade1'}}))
.call(iD.svg.TagClasses());
expect(selection).not.to.be.classed('tag-unpaved');
});
it('adds tag-unpaved for other highway types with explicit unpaved surface tagging', function() {
selection
.datum(iD.Entity({tags: {highway: 'tertiary', surface: 'dirt'}}))
.call(iD.svg.TagClasses());
expect(selection).to.be.classed('tag-unpaved');
selection
.datum(iD.Entity({tags: {highway: 'foo', tracktype: 'grade3'}}))
.call(iD.svg.TagClasses());
expect(selection).to.be.classed('tag-unpaved');
});
it('does not add tag-unpaved for non-highways', function() {
selection
.datum(iD.Entity({tags: {railway: 'abandoned', surface: 'gravel'}}))
.call(iD.svg.TagClasses());
expect(selection).not.to.be.classed('tag-unpaved');
selection
.datum(iD.Entity({tags: {amenity: 'parking', surface: 'dirt'}}))
.call(iD.svg.TagClasses());
expect(selection).not.to.be.classed('tag-unpaved');
});
it('adds tags based on the result of the `tags` accessor', function() {
selection
.datum(iD.Entity())