Browse Source

Shows county in label if there isnt a locality or local admin

pull/576/head
Alec Vulfson 9 years ago
parent
commit
2092cf2e15
  1. 2
      helper/labelSchema.js
  2. 19
      test/unit/helper/labelGenerator_USA.js

2
helper/labelSchema.js

@ -12,7 +12,7 @@ module.exports = {
},
'USA': {
'borough': getFirstProperty(['borough']),
'local': getFirstProperty(['locality', 'localadmin']),
'local': getFirstProperty(['locality', 'localadmin', 'county']),
'regional': getUsOrCaState,
'country': getUSACountryValue
},

19
test/unit/helper/labelGenerator_USA.js

@ -51,6 +51,25 @@ module.exports.tests.united_states = function(test, common) {
t.end();
});
test('county value should be used when there is no localadmin', function(t) {
var doc = {
'name': 'venue name',
'layer': 'venue',
'housenumber': 'house number',
'street': 'street name',
'neighbourhood': 'neighbourhood name',
'county': 'county name',
'macrocounty': 'macrocounty name',
'region_a': 'region abbr',
'region': 'region name',
'macroregion': 'macroregion name',
'country_a': 'USA',
'country': 'United States'
};
t.equal(generator(doc),'venue name, county name, region abbr, USA');
t.end();
});
test('street', function(t) {
var doc = {
'name': 'house number street name',

Loading…
Cancel
Save