refactor(catalog): derive desktop sort options from SORT_FIELD_LABELS
All checks were successful
deploy / test-backend (pull_request) Successful in 27m32s
deploy / test-frontend (pull_request) Successful in 10m21s
deploy / build-and-push (pull_request) Has been skipped
deploy / deploy (pull_request) Has been skipped

The desktop sort <select> hard-coded its four <option>s while the mobile
sort sheet rendered them from SORT_FIELD_LABELS. The two happened to match,
but a label rename in mangaSort.ts would have silently diverged the desktop
control. Render the desktop options from the same map so they can't.

No behaviour change (the rendered options are identical), so no version
bump. Adds an e2e guard asserting the desktop select's option values and
labels equal SORT_FIELD_LABELS in order — verified red against the old
hard-coded markup (with a label renamed) and green after.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-06-25 19:22:45 +02:00
parent dee53fa212
commit a08c49b708
2 changed files with 35 additions and 4 deletions

View File

@@ -538,10 +538,11 @@
<label class="sort">
<span>Sort</span>
<select bind:value={sort} onchange={onSortChange} data-testid="sort-select">
<option value="updated">Last updated</option>
<option value="created">Date added</option>
<option value="title">Title</option>
<option value="author">Author</option>
<!-- Options derive from SORT_FIELD_LABELS — the same source the
mobile sort sheet uses — so the two surfaces can't drift. -->
{#each Object.entries(SORT_FIELD_LABELS) as [value, label] (value)}
<option {value}>{label}</option>
{/each}
</select>
</label>
<div class="sort">