export let addressLine;
export let bDistanceInMeters;
export let bMarkUnusedLines = false;
+ export let sCountryCode;
$: bAddressLineUsed = addressLine.isaddress;
$: reverse_only = Nominatim_Config.Reverse_Only;
search by name
</PageLink>
{:else if !reverse_only && addressLine.type === 'postcode'}
- <PageLink page='search' params_hash={{ postalcode: addressLine.localname }}>
+ <PageLink page='search'
+ params_hash={{ postalcode: addressLine.localname, country: sCountryCode }}>
search by name
</PageLink>
{/if}
);
}
+ function country_code(aThisPlace) {
+ let aLine = aThisPlace.address.find((address_line) => address_line.type === 'country_code');
+ return aLine ? aLine.localname : null;
+ }
+
$: {
let pageinfo = $page;
if (pageinfo.tab === 'details') {
<div class="row">
<div class="col-md-12">
<h2>Address</h2>
- <table id="address" class="table table-striped table-small">
+ <table id="address" class="table table-striped table-small">
<thead>
<tr>
<th>Local name</th>
{#each aPlace.address as addressLine}
<DetailsOneRow addressLine={addressLine}
bMarkUnusedLines={true}
- bDistanceInMeters={false} />
+ bDistanceInMeters={false}
+ sCountryCode={country_code(aPlace)} />
{/each}
{/if}
assert.strictEqual((await page.$$eval(`a[href="${url}"]`, (links) => links.length)), 2);
});
+ it('should have a link to postcode which includes country code', async function () {
+ const url = 'search.html?postalcode=9490&country=li';
+
+ assert.strictEqual((await page.$$eval(`a[href="${url}"]`, (links) => links.length)), 1);
+ });
+
// Reverse-only installation have no search index, therefore no keywords
if (!reverse_only) {
it('should change url and add new header on clicking display keywords', async function () {