From 896cf1d4c0d806ca64a42dcf3187405d7bc6c49e Mon Sep 17 00:00:00 2001 From: Christian Toney Date: Fri, 27 Jun 2025 15:17:32 -0400 Subject: [PATCH] Add test: AutoTriggerCheckbox can automatically create loader script from template --- .../AutoTriggerCheckbox.test.luau | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/DialogueEditor/components/Explorer/components/Preview/components/AutoTriggerCheckbox/AutoTriggerCheckbox.test.luau b/src/DialogueEditor/components/Explorer/components/Preview/components/AutoTriggerCheckbox/AutoTriggerCheckbox.test.luau index 746579b..400558c 100644 --- a/src/DialogueEditor/components/Explorer/components/Preview/components/AutoTriggerCheckbox/AutoTriggerCheckbox.test.luau +++ b/src/DialogueEditor/components/Explorer/components/Preview/components/AutoTriggerCheckbox/AutoTriggerCheckbox.test.luau @@ -1,5 +1,7 @@ --!strict +local StarterPlayer = game:GetService("StarterPlayer"); + local root = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent; local AutoTriggerCheckbox = require(script.Parent); local VirtualService = require(root.VirtualService); @@ -15,6 +17,8 @@ local it = IJW.it; local screenGui: ScreenGui?; local reactRoot: ReactRoblox.RootType?; local propagatedErrorMessage; +local originalLoaderScript; +local childAddedConnection: RBXScriptConnection?; return { @@ -156,10 +160,37 @@ return { end).toFinishBeforeSeconds(1); end); + + it("can automatically create loader script from template", function() + + expect(function() + + verifyCheckboxFeature(true); + + local createdLoaderScript = StarterPlayer.StarterPlayerScripts:FindFirstChild("DialogueLoader"); + + expect(createdLoaderScript).toNotBe(nil); + + createdLoaderScript:Destroy(); + + end).toFinishBeforeSeconds(1); + + end); } end, { + beforeAll = function() + + local loaderScript = StarterPlayer.StarterPlayerScripts:FindFirstChild("DialogueMakerLoader"); + if loaderScript then + + originalLoaderScript = loaderScript; + loaderScript.Parent = nil; + + end; + + end, beforeEach = function() local newScreenGui = Instance.new("ScreenGui"); @@ -184,5 +215,21 @@ return { propagatedErrorMessage = nil; end; + afterAll = function() + + if originalLoaderScript then + + originalLoaderScript.Parent = StarterPlayer.StarterPlayerScripts; + + end; + + if childAddedConnection then + + childAddedConnection:Disconnect(); + childAddedConnection = nil; + + end; + + end; }) }; \ No newline at end of file