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:
Sameh KhamisandManjunath Paparaju committed 2026-11-18 16:55:00 -08:00
1 parent 0421813e26
commit 91700f89f8
3 files changed
+121 -14

No files matched your search

+24
View File
@@ -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');
});