Label route relations with directions and waypoints

This commit is contained in:
Minh Nguyễn
2020-12-31 16:50:47 -08:00
parent ea4b30d12b
commit 6e30e61ade
4 changed files with 75 additions and 6 deletions
+27
View File
@@ -225,4 +225,31 @@ describe('iD.util', function() {
expect(iD.utilUnicodeCharsTruncated('😎😬😆😵😴😄🙂🤔', 255)).to.eql('😎😬😆😵😴😄🙂🤔');
});
});
describe('utilDisplayName', function() {
it('returns the name if tagged with a name', function() {
expect(iD.utilDisplayName({tags: {name: 'East Coast Greenway'}})).to.eql('East Coast Greenway');
});
it('distinguishes unnamed features by ref', function() {
expect(iD.utilDisplayName({tags: {ref: '66'}})).to.eql('66');
});
it('distinguishes unnamed features by network or cycle_network', function() {
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X'}})).to.eql('SORTA 3X');
expect(iD.utilDisplayName({tags: {network: 'ncn', cycle_network: 'US:US', ref: '76'}})).to.eql('US:US 76');
});
it('distinguishes unnamed routes by direction', function() {
expect(iD.utilDisplayName({tags: {network: 'US:US', ref: '66', direction: 'west'}})).to.eql('US:US 66 west');
// Marguerite X: Counter-Clockwise
expect(iD.utilDisplayName({tags: {network: 'Marguerite', ref: 'X', direction: 'anticlockwise'}})).to.eql('Marguerite X anticlockwise');
});
it('distinguishes unnamed routes by waypoints', function() {
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X', from: 'Downtown'}})).to.eql('SORTA 3X');
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X', to: 'Kings Island'}})).to.eql('SORTA 3X');
expect(iD.utilDisplayName({tags: {network: 'SORTA', ref: '3X', via: 'Montgomery'}})).to.eql('SORTA 3X');
// Green Line: Old Ironsides => Winchester
expect(iD.utilDisplayName({tags: {network: 'VTA', ref: 'Green', from: 'Old Ironsides', to: 'Winchester'}})).to.eql('VTA Green from Old Ironsides to Winchester');
// BART Yellow Line: Antioch => Pittsburg/Bay Point => SFO Airport => Millbrae
expect(iD.utilDisplayName({tags: {network: 'BART', ref: 'Yellow', from: 'Antioch', to: 'Millbrae', via: 'Pittsburg/Bay Point;San Francisco International Airport'}})).to.eql('BART Yellow from Antioch to Millbrae via Pittsburg/Bay Point;San Francisco International Airport');
});
});
});