]> git.openstreetmap.org Git - nominatim-ui.git/commitdiff
Feat: Ignore case senstivity to osm type, details page (#144)
authorYash Srivastava <52625656+darkshredder@users.noreply.github.com>
Thu, 29 Apr 2021 11:01:59 +0000 (16:31 +0530)
committerGitHub <noreply@github.com>
Thu, 29 Apr 2021 11:01:59 +0000 (13:01 +0200)
src/components/SearchSectionDetails.svelte
test/details.js

index 8029fb3705392c7a4f4cda9d0d3ae2456db19a30..cd5faacdc9adff721f05fb75d89d2b36633f5187 100644 (file)
 <form on:submit|preventDefault={handleFormSubmit} class="form-inline" action="details.html">
   <input type="edit"
          class="form-control form-control-sm mr-1"
 <form on:submit|preventDefault={handleFormSubmit} class="form-inline" action="details.html">
   <input type="edit"
          class="form-control form-control-sm mr-1"
-         pattern="^[NWR]?[0-9]+$|.*openstreetmap.*"
+         pattern="^[NWRnwr]?[0-9]+$|.*openstreetmap.*"
          value="{api_request_params.osmtype || ''}{api_request_params.osmid || ''}{api_request_params.place_id || ''}" />
   <button type="submit" class="btn btn-primary btn-sm">Show</button>
 </form>
 <small class="form-text text-muted">
          value="{api_request_params.osmtype || ''}{api_request_params.osmid || ''}{api_request_params.place_id || ''}" />
   <button type="submit" class="btn btn-primary btn-sm">Show</button>
 </form>
 <small class="form-text text-muted">
-  OSM type+id (<em>N123</em>, <em>W123</em>, <em>R123</em>),
+  OSM type+id (<em>N123</em>, <em>n123</em>, <em>W123</em>, <em>w123</em>, <em>R123</em>, <em>r123</em>),
   Place id (<em>1234</em>) or
   URL (<em>https://openstreetmap.org/way/123</em>)
 </small>
   Place id (<em>1234</em>) or
   URL (<em>https://openstreetmap.org/way/123</em>)
 </small>
index ba1c154e5d5be22131237a1859882606bc0f4fce..5baf40209807c6cd9da642fd9bc58a7594553d4f 100644 (file)
@@ -68,5 +68,15 @@ describe('Details Page', function () {
       current_url = new URL(await page.url());
       assert.strictEqual(current_url.searchParams.get('hierarchy'), '1');
     });
       current_url = new URL(await page.url());
       assert.strictEqual(current_url.searchParams.get('hierarchy'), '1');
     });
+
+    it('should have case-insenstive input and can navigate to other details', async function () {
+      let input_field = await page.$('input[type=edit]');
+      await input_field.click({ clickCount: 3 });
+      await input_field.type('w375257537');
+      await page.click('button[type=submit]');
+
+      await page.waitForSelector('a[href="https://www.openstreetmap.org/way/375257537"]');
+      assert.ok((await page.$eval('.container h1', el => el.textContent)).includes('Taj Mahal'));
+    });
   });
 });
   });
 });