test(web): 剧集组组件测试按 lint 规范传 children
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
22f0f2b06a
commit
965c68405e
2 files changed
+10
-4
No files matched your search
@@ -10,7 +10,13 @@ import {
|
||||
StructureTrack,
|
||||
SubscriptionSeasonPicker,
|
||||
} from "./episode-structure.tsx";
|
||||
import { hasStructureChoice, inLibraryText, originText, seasonLine, structureOptions } from "./episode-structure-model.ts";
|
||||
import {
|
||||
hasStructureChoice,
|
||||
inLibraryText,
|
||||
originText,
|
||||
seasonLine,
|
||||
structureOptions,
|
||||
} from "./episode-structure-model.ts";
|
||||
|
||||
const ENTITY = "6b1f2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d";
|
||||
|
||||
@@ -159,7 +165,7 @@ describe("季集结构:组件", () => {
|
||||
withCache(createElement(SubscriptionSeasonPicker, { entityId: ENTITY, value: "", onChange: () => {} }), empty),
|
||||
).toBe("");
|
||||
const html = withCache(
|
||||
createElement(EpisodeStructureSwitcher, { entityId: ENTITY, children: createElement("p", null, "原季列表") }),
|
||||
createElement(EpisodeStructureSwitcher, { entityId: ENTITY }, createElement("p", null, "原季列表")),
|
||||
empty,
|
||||
);
|
||||
expect(html).toBe("<p>原季列表</p>");
|
||||
@@ -167,7 +173,7 @@ describe("季集结构:组件", () => {
|
||||
|
||||
it("作品页:有剧集组时轨道在季列表上方,当前结构显示原来的季与集", () => {
|
||||
const html = withCache(
|
||||
createElement(EpisodeStructureSwitcher, { entityId: ENTITY, children: createElement("p", null, "原季列表") }),
|
||||
createElement(EpisodeStructureSwitcher, { entityId: ENTITY }, createElement("p", null, "原季列表")),
|
||||
groups("grp-production"),
|
||||
);
|
||||
expect(html).toContain("季集结构");
|
||||
|
||||
@@ -201,7 +201,7 @@ function resultToast(r: EpisodeGroupSetResult) {
|
||||
* 作品页「季与集」顶部的季集结构切换:只有 TMDB 有剧集组(或作品已选了剧集组)时出现。
|
||||
* 选中当前结构时显示 children(现有的季与集);选中其它结构时显示该结构的季卡片预览与「改用这套结构」。
|
||||
*/
|
||||
export function EpisodeStructureSwitcher({ entityId, children }: { entityId: string; children: ReactNode }) {
|
||||
export function EpisodeStructureSwitcher({ entityId, children }: { entityId: string; children?: ReactNode }) {
|
||||
const groups = useEpisodeGroups(entityId);
|
||||
const options = structureOptions(groups.data);
|
||||
const current = groups.data?.current?.groupId ?? null;
|
||||
|
||||
Reference in new issue
Block a user