* Details page helper to check if place has 1 or more keywords
* add documentation hint how to run only one test file
port. That's a rare setup but something https://nominatim.openstreetmap.org/ does
so worth testing.
port. That's a rare setup but something https://nominatim.openstreetmap.org/ does
so worth testing.
+ To run a single test file only
+
+ ```
+ yarn run rollup -c && yarn run mocha test/details.js
+ ```
+
* Run syntax linter (configuration in `.eslint.js`)
```
* Run syntax linter (configuration in `.eslint.js`)
```
+ function place_has_keywords(aThisPlace) {
+ // Return false if Nominatim API sends 'keywords: { name: [], address: [] }'
+ return (
+ aThisPlace.keywords && aThisPlace.keywords.name && aThisPlace.keywords.address
+ && (aThisPlace.keywords.name.length > 0 || aThisPlace.keywords.address.length > 0)
+ );
+ }
+
$: {
let pageinfo = $page;
if (pageinfo.tab === 'details') {
$: {
let pageinfo = $page;
if (pageinfo.tab === 'details') {
<tr class="all-columns"><td colspan="6"><h2>Keywords</h2></td></tr>
{#if api_request_params.keywords}
<tr class="all-columns"><td colspan="6"><h2>Keywords</h2></td></tr>
{#if api_request_params.keywords}
- {#if aPlace.keywords && (aPlace.keywords.name || aPlace.keywords.address) }
+ {#if place_has_keywords(aPlace)}
<tr class="all-columns"><td colspan="6"><h3>Name Keywords</h3></td></tr>
{#each aPlace.keywords.name as keyword}
<tr>
<tr class="all-columns"><td colspan="6"><h3>Name Keywords</h3></td></tr>
{#each aPlace.keywords.name as keyword}
<tr>