Update tests for new sequence step types and target options

This commit is contained in:
2026-04-15 01:42:59 +02:00
parent 1328d6344e
commit 9e1d6caecf

View File

@@ -17,15 +17,22 @@ describe("ProjectSequencesPanel", () => {
},
{
stepClass: "impulse",
type: "toggleVisibility",
targetBrushId: "brush-a",
visible: undefined
type: "setVisibility",
target: {
kind: "brush",
brushId: "brush-a"
},
mode: "toggle"
}
]
});
const onAddTeleportStep = vi.fn();
const onAddVisibilityStep = vi.fn();
const onAddPlayAnimationStep = vi.fn();
const onAddStopAnimationStep = vi.fn();
const onAddPlaySoundStep = vi.fn();
const onAddStopSoundStep = vi.fn();
const onSetTeleportStepTarget = vi.fn();
const onSetVisibilityStepTarget = vi.fn();
const onSetVisibilityStepMode = vi.fn();
@@ -44,9 +51,13 @@ describe("ProjectSequencesPanel", () => {
{ entityId: "teleport-b", label: "South Gate" }
]}
visibilityTargetOptions={[
{ brushId: "brush-a", label: "Wall A" },
{ brushId: "brush-b", label: "Wall B" }
{ targetKey: "brush:brush-a", label: "Wall A" },
{ targetKey: "brush:brush-b", label: "Wall B" }
]}
modelAnimationTargetOptions={[
{ targetKey: "modelInstance:model-a", label: "Model A" }
]}
soundTargetOptions={[{ targetKey: "entity:sound-a", label: "Sound A" }]}
selectedSequenceId={sequence.id}
onSelectSequence={() => {}}
onAddSequence={() => {}}
@@ -57,6 +68,10 @@ describe("ProjectSequencesPanel", () => {
onAddDialogueStep={() => {}}
onAddTeleportStep={onAddTeleportStep}
onAddVisibilityStep={onAddVisibilityStep}
onAddPlayAnimationStep={onAddPlayAnimationStep}
onAddStopAnimationStep={onAddStopAnimationStep}
onAddPlaySoundStep={onAddPlaySoundStep}
onAddStopSoundStep={onAddStopSoundStep}
onDeleteStep={() => {}}
onSetControlStepTarget={() => {}}
onSetControlStepEffectOption={() => {}}
@@ -74,8 +89,8 @@ describe("ProjectSequencesPanel", () => {
fireEvent.change(screen.getByLabelText("Teleport Target"), {
target: { value: "teleport-b" }
});
fireEvent.change(screen.getByLabelText("Whitebox Solid"), {
target: { value: "brush-b" }
fireEvent.change(screen.getByLabelText("Target"), {
target: { value: "brush:brush-b" }
});
fireEvent.change(screen.getByLabelText("Mode"), {
target: { value: "hide" }
@@ -83,6 +98,10 @@ describe("ProjectSequencesPanel", () => {
fireEvent.click(screen.getByRole("button", { name: "Add Teleport Effect" }));
fireEvent.click(screen.getByRole("button", { name: "Add Visibility Effect" }));
fireEvent.click(screen.getByRole("button", { name: "Add Play Animation Effect" }));
fireEvent.click(screen.getByRole("button", { name: "Add Stop Animation Effect" }));
fireEvent.click(screen.getByRole("button", { name: "Add Play Sound Effect" }));
fireEvent.click(screen.getByRole("button", { name: "Add Stop Sound Effect" }));
expect(onSetTeleportStepTarget).toHaveBeenCalledWith(
"sequence-main",
@@ -92,7 +111,7 @@ describe("ProjectSequencesPanel", () => {
expect(onSetVisibilityStepTarget).toHaveBeenCalledWith(
"sequence-main",
1,
"brush-b"
"brush:brush-b"
);
expect(onSetVisibilityStepMode).toHaveBeenCalledWith(
"sequence-main",
@@ -100,6 +119,25 @@ describe("ProjectSequencesPanel", () => {
"hide"
);
expect(onAddTeleportStep).toHaveBeenCalledWith("sequence-main", "teleport-a");
expect(onAddVisibilityStep).toHaveBeenCalledWith("sequence-main", "brush-a");
expect(onAddVisibilityStep).toHaveBeenCalledWith(
"sequence-main",
"brush:brush-a"
);
expect(onAddPlayAnimationStep).toHaveBeenCalledWith(
"sequence-main",
"modelInstance:model-a"
);
expect(onAddStopAnimationStep).toHaveBeenCalledWith(
"sequence-main",
"modelInstance:model-a"
);
expect(onAddPlaySoundStep).toHaveBeenCalledWith(
"sequence-main",
"entity:sound-a"
);
expect(onAddStopSoundStep).toHaveBeenCalledWith(
"sequence-main",
"entity:sound-a"
);
});
});