11--!strict
22
3+ local StarterPlayer = game :GetService ("StarterPlayer" );
4+
35local root = script .Parent .Parent .Parent .Parent .Parent .Parent .Parent .Parent ;
46local AutoTriggerCheckbox = require (script .Parent );
57local VirtualService = require (root .VirtualService );
@@ -15,6 +17,8 @@ local it = IJW.it;
1517local screenGui : ScreenGui ? ;
1618local reactRoot : ReactRoblox .RootType ? ;
1719local propagatedErrorMessage ;
20+ local originalLoaderScript ;
21+ local childAddedConnection : RBXScriptConnection ? ;
1822
1923return {
2024
@@ -156,10 +160,37 @@ return {
156160 end ).toFinishBeforeSeconds (1 );
157161
158162 end );
163+
164+ it ("can automatically create loader script from template" , function ()
165+
166+ expect (function ()
167+
168+ verifyCheckboxFeature (true );
169+
170+ local createdLoaderScript = StarterPlayer .StarterPlayerScripts :FindFirstChild ("DialogueLoader" );
171+
172+ expect (createdLoaderScript ).toNotBe (nil );
173+
174+ createdLoaderScript :Destroy ();
175+
176+ end ).toFinishBeforeSeconds (1 );
177+
178+ end );
159179
160180 }
161181
162182 end , {
183+ beforeAll = function ()
184+
185+ local loaderScript = StarterPlayer .StarterPlayerScripts :FindFirstChild ("DialogueMakerLoader" );
186+ if loaderScript then
187+
188+ originalLoaderScript = loaderScript ;
189+ loaderScript .Parent = nil ;
190+
191+ end ;
192+
193+ end ,
163194 beforeEach = function ()
164195
165196 local newScreenGui = Instance .new ("ScreenGui" );
@@ -184,5 +215,21 @@ return {
184215 propagatedErrorMessage = nil ;
185216
186217 end ;
218+ afterAll = function ()
219+
220+ if originalLoaderScript then
221+
222+ originalLoaderScript .Parent = StarterPlayer .StarterPlayerScripts ;
223+
224+ end ;
225+
226+ if childAddedConnection then
227+
228+ childAddedConnection :Disconnect ();
229+ childAddedConnection = nil ;
230+
231+ end ;
232+
233+ end ;
187234 })
188235};
0 commit comments