mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-08-28 19:47:49 +08:00
fix(media-detail): 季集数为 0 时不渲染存在状态标签,避免误导性显示已入库
- 剧集详情季列表:当季 episode_count 为 0 时隐藏已入库/缺失状态标签 - 补充回归测试
This commit is contained in:
@@ -1083,7 +1083,11 @@ onUnmounted(() => {
|
||||
{{ t('media.episodeCount', { count: season.episode_count }) }}
|
||||
</VChip>
|
||||
<div class="absolute right-12">
|
||||
<VChip v-if="seasonsNotExisted" :color="getExistColor(season.season_number || 0)" flat>
|
||||
<VChip
|
||||
v-if="seasonsNotExisted && (season.episode_count ?? 0) > 0"
|
||||
:color="getExistColor(season.season_number || 0)"
|
||||
flat
|
||||
>
|
||||
{{ getExistText(season.season_number || 0) }}
|
||||
</VChip>
|
||||
<IconBtn
|
||||
|
||||
@@ -777,6 +777,28 @@ describe('MediaDetailView subscriptions, seasons, and episode groups', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('hides the status badge for a season with zero episodes', async () => {
|
||||
const media = createSubscribeTv({
|
||||
season_info: [
|
||||
createMediaSeason({ episode_count: 0, season_number: 1 }),
|
||||
createMediaSeason({ episode_count: 2, season_number: 2 }),
|
||||
],
|
||||
title: '零集数状态剧',
|
||||
tmdb_id: 8710,
|
||||
})
|
||||
const notExists = [createNotExistMediaInfo({ episodes: [1, 2], season: 2, total_episode: 2 })]
|
||||
const { container } = await renderDetail({ media, notExists, type: '电视剧' })
|
||||
|
||||
await waitFor(() => {
|
||||
const panels = [...container.querySelectorAll<HTMLElement>('.v-expansion-panel')]
|
||||
expect(panels).toHaveLength(2)
|
||||
// 集数为 0 的季不渲染任何存在状态标签
|
||||
expect(panels[0].textContent).toMatch(/第 1 季/)
|
||||
expect(panels[0].textContent).not.toMatch(/已入库|缺失/)
|
||||
expect(panels[1].textContent).toMatch(/第 2 季.*已入库/s)
|
||||
})
|
||||
})
|
||||
|
||||
it('loads season episodes and marks episodes that already exist remotely', async () => {
|
||||
const media = createSubscribeTv({
|
||||
season_info: [createMediaSeason({ episode_count: 2, season_number: 1 })],
|
||||
|
||||
Reference in New Issue
Block a user