diff --git a/src/DialogueEditor/components/Explorer/components/Preview/components/DialogueTypeDropdown/DialogueTypeDropdown.test.luau b/src/DialogueEditor/components/Explorer/components/Preview/components/DialogueTypeDropdown/DialogueTypeDropdown.test.luau index 2cca331..cadd8ba 100644 --- a/src/DialogueEditor/components/Explorer/components/Preview/components/DialogueTypeDropdown/DialogueTypeDropdown.test.luau +++ b/src/DialogueEditor/components/Explorer/components/Preview/components/DialogueTypeDropdown/DialogueTypeDropdown.test.luau @@ -182,6 +182,49 @@ return { end).toFinishBeforeSeconds(1); end); + + it("can create dialogue folder if it doesn't exist", function() + + expect(function() + + local selectedScript = render("Message"); + local messagesFolder = Instance.new("Folder"); + messagesFolder.Name = "Messages"; + selectedScript.Parent = messagesFolder; + + local parentDialogueScript = Instance.new("ModuleScript"); + messagesFolder.Parent = parentDialogueScript; + + assert(screenGui, "ScreenGui should be initialized before running tests."); + local dialogueTypeDropdown = screenGui:FindFirstChildOfClass("Frame"); + assert(dialogueTypeDropdown, "DialogueTypeDropdown should be rendered."); + + local toggleButton = dialogueTypeDropdown:FindFirstChild("ToggleButton"); + assert(toggleButton and toggleButton:IsA("TextButton"), "ToggleButton should be present in DialogueTypeDropdown."); + + VirtualService.events.GuiButton.Activated:fireEvent(toggleButton); + + local optionsFrame = dialogueTypeDropdown:WaitForChild("OptionsFrame"); + assert(optionsFrame, "OptionsFrame should be present in DialogueTypeDropdown."); + + local responseButton = optionsFrame:FindFirstChild("ResponseButton"); + assert(responseButton and responseButton:IsA("TextButton"), "ResponseButton should be present in OptionsFrame."); + + local didDialogueTypeChange = false; + eventConnection = selectedScript:GetAttributeChangedSignal("DialogueType"):Once(function() + + didDialogueTypeChange = true; + + end); + VirtualService.events.GuiButton.Activated:fireEvent(responseButton); + repeat task.wait() until didDialogueTypeChange or propagatedErrorMessage; + verifyReactStatus(); + assert(selectedScript.Parent, "Selected script parent should not be nil after changing dialogue type."); + expect(selectedScript.Parent.Name).toBe("Responses"); + + end).toFinishBeforeSeconds(1); + + end); }