From d8873776fdb7a028d1b54d98343aec594a77f468 Mon Sep 17 00:00:00 2001 From: Christian Toney Date: Fri, 27 Jun 2025 11:37:52 -0400 Subject: [PATCH] Add test: DialogueGroupContainer refreshes the conversation group if a conversation is removed --- .../DialogueGroupContainer.test.luau | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/DialogueEditor/components/Explorer/components/DialogueGroupContainer/DialogueGroupContainer.test.luau b/src/DialogueEditor/components/Explorer/components/DialogueGroupContainer/DialogueGroupContainer.test.luau index c8d1aea..03d7dfe 100644 --- a/src/DialogueEditor/components/Explorer/components/DialogueGroupContainer/DialogueGroupContainer.test.luau +++ b/src/DialogueEditor/components/Explorer/components/DialogueGroupContainer/DialogueGroupContainer.test.luau @@ -246,6 +246,38 @@ return { end).toFinishBeforeSeconds(1); end); + + it("refreshes the conversation group if a conversation is removed", function() + + expect(function() + + -- Select the conversations folder parent. + local conversationsFolderParent = Instance.new("Folder"); + local conversationsFolder = Instance.new("Folder"); + conversationsFolder.Name = "Conversations"; + conversationsFolder.Parent = conversationsFolderParent; + + local conversationScript = Instance.new("ModuleScript"); + conversationScript:AddTag("DialogueMakerConversationScript"); + conversationScript.Parent = conversationsFolder; + VirtualService.mocks.services.Selection:Set({conversationsFolderParent}); + + -- Render the component and wait for it to finish rendering. + assert(screenGui, "ScreenGui should be initialized before running tests."); + render(); + verifyReactStatus(); + expect(#getDialogueItems(screenGui)).toBe(#conversationsFolder:GetChildren()); + + -- Delete the conversation script and verify that it is not rendered. + assert(dialogueGroup); + conversationScript:Destroy(); + verifyReactStatus(); + dialogueGroup.ChildRemoved:Wait(); + expect(#getDialogueItems(screenGui)).toBe(#conversationsFolder:GetChildren()); + + end).toFinishBeforeSeconds(1); + + end); }