fix(v3): drawer fav-sync honours data-fav-idle (no dim-heart on List View) (#717)

_patchCardFav (the Song Details drawer's like -> card heart sync) hardcoded
`classList.toggle('text-white', !fav)`, so toggling the like from the drawer
left List-View rows' `text-fb-textDim` idle class in place — the exact
dim-heart bug #654 fixed for the on-card click handler, reintroduced on the
drawer path. Read the per-heart `data-fav-idle` and swap that class instead,
mirroring wireCards. +regression assertion in v3_favorites_toggle.test.js.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Byron Gamatos
2026-07-02 14:52:40 +02:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 13db718bda
commit 2e4383524f
2 changed files with 16 additions and 1 deletions
+10
View File
@@ -40,6 +40,16 @@ test('the shared fav handler swaps the declared idle colour, not a hardcoded one
'the hardcoded text-white idle toggle must be removed');
});
test('the drawer fav-sync (_patchCardFav) swaps the declared idle colour too', () => {
// Toggling the like from the Song Details drawer patches the rendered card's
// heart via _patchCardFav; it must honour each heart's data-fav-idle the same
// way the click handler does, or List-View rows keep the dim-heart bug (#654).
assert.match(src, /function _patchCardFav[\s\S]*?getAttribute\('data-fav-idle'\)[\s\S]*?classList\.toggle\(\s*idle\s*,\s*!fav\s*\)/,
'_patchCardFav must restore the per-context idle colour (idle), not a hardcoded text-white');
assert.doesNotMatch(src, /classList\.toggle\('text-white',\s*!fav\)/,
'_patchCardFav must not hardcode the text-white idle toggle');
});
test('the fav toggle keeps the in-memory song model in sync', () => {
// So a virtualized grid recycle / tree re-render renders the new state,
// not a stale favorite=false read from state.songsById.