]> git.openstreetmap.org Git - nominatim-ui.git/blob - test/reverse.js
reverse page: dont switch empty coordinates (#130)
[nominatim-ui.git] / test / reverse.js
1 const assert = require('assert');
2
3 describe('Reverse Page', function () {
4   let page;
5
6   describe('No search', function () {
7     before(async function () {
8       page = await browser.newPage();
9       await page.goto('http://localhost:9999/reverse.html');
10     });
11
12     after(async function () {
13       await page.close();
14     });
15
16     it('should allow switching coordinates', async function () {
17       let lat_handle = await page.$('input[name=lat]');
18       let lon_handle = await page.$('input[name=lon]');
19
20       assert.equal(await lat_handle.evaluate(node => node.value), '');
21       assert.equal(await lon_handle.evaluate(node => node.value), '');
22
23       await page.click('#switch-coords');
24       // no change
25       assert.equal(await lat_handle.evaluate(node => node.value), '');
26       assert.equal(await lon_handle.evaluate(node => node.value), '');
27
28       await page.type('input[name=lat]', '5');
29       await page.type('input[name=lon]', '10');
30       await page.click('#switch-coords');
31       // switched
32       assert.equal(await lat_handle.evaluate(node => node.value), 10);
33       assert.equal(await lon_handle.evaluate(node => node.value), 5);
34     });
35   });
36 });