5bb8b92c05
Two bugs in the add forms, both root-caused via the e2e harness: 1. add_game Name → Sort name never synced. syncSelectInputUntilChanged was scoped to "form", but the first <form> on every page is the navbar logout form — the add-form fields live in a later form, so the delegated listener never heard their events. Scope to "#add-form" (the add-form wrapper). Also switch the sync from the "change" event to "input" so Sort name mirrors Name live as you type, not only on blur. 2. add_purchase Related game not disabled when Type == Game. disableElementsWhenTrue set `.disabled` on #id_related_game, which is the SearchSelect wrapper <div> (a <div> ignores `disabled`). Target the inner [data-search-select-search] input instead, so the widget is actually disabled. Adds two e2e regression tests (live sync; type-game disables the related-game search input and re-enables it for other types). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
15 lines
394 B
TypeScript
15 lines
394 B
TypeScript
import { syncSelectInputUntilChanged } from "./utils.js";
|
|
|
|
const syncData = [
|
|
{
|
|
source: "#id_name",
|
|
source_value: "value",
|
|
target: "#id_sort_name",
|
|
target_value: "value",
|
|
},
|
|
];
|
|
|
|
// Scope to the add form (#add-form), not "form": the first <form> on the page
|
|
// is the navbar logout form, which never contains these fields.
|
|
syncSelectInputUntilChanged(syncData, "#add-form");
|