refactor isOneWay to properly support bidirectional ways (#10730)

This commit is contained in:
Kyℓe Hensel
2025-02-13 00:22:09 +11:00
committed by GitHub
parent 4e1c16efc7
commit 4747ae253c
12 changed files with 117 additions and 65 deletions
-1
View File
@@ -305,7 +305,6 @@ describe('iD.osmWay', function() {
it('returns true when the way has tag oneway=yes', function() {
expect(iD.osmWay({tags: { oneway: 'yes' }}).isOneWay(), 'oneway yes').to.be.true;
expect(iD.osmWay({tags: { oneway: '1' }}).isOneWay(), 'oneway 1').to.be.true;
expect(iD.osmWay({tags: { oneway: '-1' }}).isOneWay(), 'oneway -1').to.be.true;
});
+13
View File
@@ -7,3 +7,16 @@ describe('iD.utilObjectOmit', function() {
});
});
describe('iD.utilCheckTagDictionary', () => {
it('can search a standard tag-dictionary', () => {
expect(iD.utilCheckTagDictionary({}, iD.osmPavedTags)).toBeUndefined();
expect(iD.utilCheckTagDictionary({ surface: 'asphalt' }, iD.osmPavedTags)).toBe(true);
});
it('works for falsy values', () => {
const dictionary = { surface: { paved: 0 } };
expect(iD.utilCheckTagDictionary({}, dictionary)).toBeUndefined();
expect(iD.utilCheckTagDictionary({ surface: 'paved' }, dictionary)).toBe(0);
});
});