mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
Keep plans for places that begin with a kind of place, and keep Satellites with Space Missions only while missions are on
A keyword is read as the start of a name only when what follows is one
word for a kind of place alone ("Radio City", "Traffic Island"), so
"traffic city hall" and "earthquakes valley forge" keep their plans.
"except space missions" keeps Satellites only while Space Missions is
on, and "from the map" is read before "except".
Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
859aa172e7
commit
81192cfa50
3 files changed
+53
-27
No files matched your search
@@ -744,11 +744,7 @@ test('a grid reference after "near" is the place', () => {
|
||||
|
||||
test('a keyword that begins a name offers no plan to the rest of it', () => {
|
||||
const omnibar = createOmnibar({ layers: layers() });
|
||||
for (const text of [
|
||||
'Radio City Music Hall',
|
||||
'Traffic Island',
|
||||
'radio island',
|
||||
]) {
|
||||
for (const text of ['Radio City', 'Traffic Island', 'radio island']) {
|
||||
const { rows } = omnibar.rows(text, { places: [] });
|
||||
assert.equal(rows[0].kind, 'place', text);
|
||||
assert.ok(!rows.some((row) => row.kind === 'plan'), text);
|
||||
@@ -759,7 +755,15 @@ test('a keyword that begins a name offers no plan to the rest of it', () => {
|
||||
}
|
||||
// A keyword after the place, or before a place that is no name's
|
||||
// fragment, still offers its plan.
|
||||
for (const text of ['tokyo traffic', 'earthquakes japan', 'radio London']) {
|
||||
for (const text of [
|
||||
'tokyo traffic',
|
||||
'earthquakes japan',
|
||||
'radio London',
|
||||
'traffic city hall',
|
||||
'traffic county cork',
|
||||
'earthquakes valley forge',
|
||||
'traffic road to hana',
|
||||
]) {
|
||||
const { rows } = omnibar.rows(text, { places: [] });
|
||||
assert.ok(
|
||||
rows.some((row) => row.kind === 'plan'),
|
||||
@@ -787,6 +791,28 @@ test('"except" keeps a layer and the one it shows through together', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('"except" leaves Satellites to switch off with Space Missions off', () => {
|
||||
const omnibar = createOmnibar({
|
||||
layers: [
|
||||
{ id: 'flights', name: 'Live Flights', enabled: true },
|
||||
{ id: 'satellites', name: 'Satellites', enabled: true },
|
||||
{ id: 'rocket-launches', name: 'Space Missions', enabled: false },
|
||||
],
|
||||
});
|
||||
assert.deepEqual(
|
||||
omnibar
|
||||
.rows('hide everything except space missions', { places: [] })
|
||||
.rows[0].steps.map(stepOutcome),
|
||||
['layer(flights,off)', 'layer(satellites,off)'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
omnibar
|
||||
.rows('hide everything except flights from the map', { places: [] })
|
||||
.rows[0].steps.map(stepOutcome),
|
||||
['layer(satellites,off)'],
|
||||
);
|
||||
});
|
||||
|
||||
test('"turn off the screen" is no layer switch and no place', () => {
|
||||
for (const text of ['turn off the screen', 'switch off the map'])
|
||||
assert.equal(outcome(text, { on: ['flights'] }), 'nothing', text);
|
||||
|
||||
Reference in new issue
Block a user