mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Keep panels, compound names and signed coordinates apart when reading a line
- "hide flights near Left Bank, Paris" closed the left panel: a side is closed only when the clause names nothing but the side. - "flights near Trinidad and Tobago" looked up Trinidad alone, and "take me to New York City NY" nothing (the command's words counted against the name): the whole place is looked up, and the limit counts its words. - "flights near 30.27, +97.74" and "30.27; -97.74" were split at the sign or semicolon; both stay coordinates. - "hide flights, show ships" listed "No layers are on": several requests in a line are read as one plan, as with "and". Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
8dae95e4da
commit
36264005a8
3 files changed
+64
-8
No files matched your search
@@ -601,3 +601,49 @@ test('only a layer in or near a place is counted, never a name', () => {
|
||||
])
|
||||
assert.equal(omnibar.countRequest(text), null, text);
|
||||
});
|
||||
|
||||
test('a place named Left or Right is no panel to close', () => {
|
||||
const omnibar = createOmnibar({ layers: layers(['flights']) });
|
||||
const { rows, defaultIndex } = omnibar.rows(
|
||||
'hide flights near Left Bank, Paris',
|
||||
);
|
||||
assert.equal(rows[defaultIndex].kind, 'plan');
|
||||
assert.ok(rows[defaultIndex].steps.every((step) => step.kind !== 'panel'));
|
||||
for (const text of ['hide the left panel', 'close right side']) {
|
||||
const read = omnibar.rows(text);
|
||||
assert.ok(
|
||||
read.rows[read.defaultIndex].steps.some((step) => step.kind === 'panel'),
|
||||
text,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('the place service gets the whole place, however it is asked', () => {
|
||||
const omnibar = createOmnibar({ layers: layers() });
|
||||
assert.equal(
|
||||
omnibar.placeQuery('flights near Trinidad and Tobago'),
|
||||
'trinidad and tobago',
|
||||
);
|
||||
assert.equal(
|
||||
omnibar.placeQuery('take me to New York City NY'),
|
||||
'New York City NY',
|
||||
);
|
||||
// A signed longitude or a semicolon stays inside the coordinates.
|
||||
for (const text of [
|
||||
'show flights near 30.27, +97.74',
|
||||
'go to 30.27; -97.74',
|
||||
]) {
|
||||
const { rows, defaultIndex } = omnibar.rows(text);
|
||||
assert.ok(defaultIndex >= 0, text);
|
||||
assert.equal(omnibar.placeQuery(text), null, text);
|
||||
assert.notEqual(rows[defaultIndex].kind, 'none', text);
|
||||
}
|
||||
});
|
||||
|
||||
test('several switches in one line are one plan', () => {
|
||||
const omnibar = createOmnibar({ layers: layers(['flights']) });
|
||||
for (const text of ['hide flights, show radio', 'hide flights; show radio']) {
|
||||
const { rows, defaultIndex } = omnibar.rows(text);
|
||||
assert.equal(rows[defaultIndex].kind, 'plan', text);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user