mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Keep a country named with "and" whole, and show places as they were typed
"flights near Trinidad and Tobago" flew to Trinidad and offered Tobago on
its own; places whose own name holds "and" or "&" (Trinidad and Tobago,
Bosnia and Herzegovina, Antigua and Barbuda and the like) now stay one
place, while "Austin and Dallas" is still two. "İstanbul" was searched with
a stray combining dot, and labels title-cased what was typed with capitals
("IPhone Store"); a place is searched in plain lower case and labelled as
it was typed.
Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
0421813e26
commit
91700f89f8
3 files changed
+121
-14
No files matched your search
@@ -646,3 +646,27 @@ test('several switches in one line are one plan', () => {
|
||||
assert.equal(rows[defaultIndex].kind, 'plan', text);
|
||||
}
|
||||
});
|
||||
|
||||
test('a place named with "and" stays whole, and a place keeps how it was typed', () => {
|
||||
const omnibar = createOmnibar({
|
||||
layers: [{ id: 'flights', name: 'Live Flights', enabled: false }],
|
||||
});
|
||||
const first = (text) => omnibar.rows(text, { places: [] }).rows[0];
|
||||
const plan = first('flights near Trinidad and Tobago');
|
||||
assert.equal(plan.kind, 'plan');
|
||||
assert.equal(plan.steps[0].place, 'trinidad and tobago');
|
||||
assert.equal(
|
||||
first('flights near Bosnia & Herzegovina').steps[0].place,
|
||||
'bosnia and herzegovina',
|
||||
);
|
||||
// Two places joined by "and" are still two.
|
||||
assert.equal(
|
||||
first('flights near Austin and Dallas').steps[0].place,
|
||||
'austin',
|
||||
);
|
||||
// "İstanbul" is searched without a stray combining dot, and labelled as typed.
|
||||
const istanbul = first('show flights in İstanbul');
|
||||
assert.equal(istanbul.steps[0].place, 'istanbul');
|
||||
assert.match(istanbul.label, /^İstanbul /);
|
||||
assert.equal(first('iPhone store').label, 'Go to iPhone store');
|
||||
});
|
||||
Reference in new issue
Block a user