Skip to content

Commit

Permalink
Update geocoder test after landmark additions; add tests for lnglat w…
Browse files Browse the repository at this point in the history
…rapping
  • Loading branch information
Lauren Budorick committed Oct 28, 2016
1 parent 78026c6 commit 1008dc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/test.geocoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ test('geocoder', function(tt) {
]
});

geocoder.query('Paris');
geocoder.query('London');
geocoder.on('results', once(function(e) {
t.ok(e.results.length, 'Event for results emitted');
t.equals(e.results[0].text, 'Paris Jewelry', 'Result is returned within a bbox');
t.equals(e.results[0].text, 'London Sole', 'Result is returned within a bbox');
}));
});

Expand All @@ -78,7 +78,7 @@ test('geocoder', function(tt) {
geocoder.query('1714 14th St NW');
geocoder.on('result', once(function() {
map.once(map.on('moveend', function() {
t.equals(map.getZoom(), 12, 'Custom zoom is supported');
t.equals(parseInt(map.getZoom()), 12, 'Custom zoom is supported');
}));
}));
});
Expand Down
8 changes: 7 additions & 1 deletion test/test.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('Geocoder#inputControl', function(tt) {

tt.test('input', function(t) {
setup();
t.plan(8);
t.plan(10);
var inputEl = container.querySelector('.mapboxgl-ctrl-geocoder input');
var clearEl = container.querySelector('.mapboxgl-ctrl-geocoder button');
inputEl.addEventListener('change', once(function() {
Expand All @@ -42,6 +42,12 @@ test('Geocoder#inputControl', function(tt) {
t.equals(inputEl.value, 'Paris', 'value populates in input');
t.ok(clearEl.classList.contains('active'), 'clear link is active');
t.notOk(geocoder.getResult(), 'input is set but result is null');

geocoder.setInput([90, 45]);
t.equals(inputEl.value, '90,45', 'valid LngLat value populates in input');

geocoder.setInput([270, 45]);
t.equals(inputEl.value, '-90,45', 'LngLat wraps if need be');
}));

geocoder.query([-79, 43]);
Expand Down

0 comments on commit 1008dc0

Please sign in to comment.