Compare commits

..

No commits in common. "467c8c665dd3ee6469fc4dd8a9d3090560ee2991" and "71d06347fd4ea796c5d811b28aabcc36f4152635" have entirely different histories.

3 changed files with 7 additions and 12 deletions

View File

@ -2164,7 +2164,6 @@
if (!launchFilterResolved) {
selectedWorkFilter = mobileLaunch.chooseFilter({
saved: savedWorkFilter, today: counts.today, attention: counts.attention,
agenda: counts.agenda,
});
launchFilterResolved = true;
document.querySelectorAll('[data-work-filter]').forEach(item =>

View File

@ -4,14 +4,13 @@
else root.mobileLaunch = api;
})(typeof globalThis !== 'undefined' ? globalThis : this, function () {
const allowedFilters = new Set([
'all', 'today', 'attention', 'agenda', 'issue', 'pull', 'review', 'update', 'later', 'draft',
'all', 'today', 'attention', 'issue', 'pull', 'review', 'update', 'later', 'draft',
]);
function chooseFilter({ saved, today = 0, attention = 0, agenda = 0 } = {}) {
function chooseFilter({ saved, today = 0, attention = 0 } = {}) {
if (allowedFilters.has(saved)) return saved;
if (today > 0) return 'today';
if (attention > 0) return 'attention';
if (agenda > 0) return 'agenda';
return 'all';
}

View File

@ -14,11 +14,10 @@ def test_mobile_launch_selects_priority_queue_without_overriding_saved_choice():
script = f"""
const mobileLaunch = require({json.dumps(str(MOBILE_LAUNCH))});
process.stdout.write(JSON.stringify({{
today: mobileLaunch.chooseFilter({{saved:null, today:2, attention:4, agenda:6}}),
attention: mobileLaunch.chooseFilter({{saved:null, today:0, attention:4, agenda:6}}),
agenda: mobileLaunch.chooseFilter({{saved:null, today:0, attention:0, agenda:6}}),
all: mobileLaunch.chooseFilter({{saved:null, today:0, attention:0, agenda:0}}),
saved: mobileLaunch.chooseFilter({{saved:'agenda', today:2, attention:4, agenda:6}}),
today: mobileLaunch.chooseFilter({{saved:null, today:2, attention:4}}),
attention: mobileLaunch.chooseFilter({{saved:null, today:0, attention:4}}),
all: mobileLaunch.chooseFilter({{saved:null, today:0, attention:0}}),
saved: mobileLaunch.chooseFilter({{saved:'review', today:2, attention:4}}),
}}));
"""
result = subprocess.run(["node", "-e", script], capture_output=True, text=True)
@ -27,9 +26,8 @@ process.stdout.write(JSON.stringify({{
assert json.loads(result.stdout) == {
"today": "today",
"attention": "attention",
"agenda": "agenda",
"all": "all",
"saved": "agenda",
"saved": "review",
}
@ -66,7 +64,6 @@ async def test_mobile_launch_progressively_discloses_secondary_controls():
service_worker = (Path(__file__).resolve().parents[1] / "frontend" / "service-worker.js").read_text()
assert "BASE + 'static/mobile-launch.js'" in service_worker
assert "mobileLaunch.chooseFilter" in html
assert "agenda: counts.agenda" in html
assert "mobileLaunch.createDisclosure" in html
assert "@media (max-width: 600px)" in html
assert "header { min-height:56px; max-height:64px;" in html