local p=require("\078\101\120\117\115\085\110\105\116\084\101\115\116\105\110\103")local u=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\120\117\115\080\108\117\103\105\110\070\114\097\109\101\119\111\114\107"))local L=u:GetResource("\085\073\046\067\111\108\108\097\112\115\097\098\108\101\076\105\115\116\046\078\101\120\117\115\067\111\108\108\097\112\115\097\098\108\101\076\105\115\116\070\114\097\109\101")p:RegisterUnitTest("\067\111\110\115\116\114\117\099\116\111\114",function(p)local u=L.new()p:AssertEquals(u.ClassName,"\078\101\120\117\115\067\111\108\108\097\112\115\097\098\108\101\076\105\115\116\070\114\097\109\101","\067\108\097\115\115 \110\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(u.Name,"\078\101\120\117\115\067\111\108\108\097\112\115\097\098\108\101\076\105\115\116\070\114\097\109\101","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(tostring(u),"\078\101\120\117\115\067\111\108\108\097\112\115\097\098\108\101\076\105\115\116\070\114\097\109\101","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(#u:GetChildren(),0,"\067\104\105\108\100\114\101\110 \097\114\101\110\'\116 \104\105\100\100\101\110\046")end)p:RegisterUnitTest("\083\116\114\117\099\116\117\114\101",function(p)local i=L.new()local o,F=i:GetMainContainer(),i:GetCollapsableContainer()local t,C=u.new("\070\114\097\109\101"),u.new("\070\114\097\109\101")local j,M=u.new("\070\114\097\109\101"),u.new("\070\114\097\109\101")t.Parent=i:GetMainContainer()C.Parent=t j.Parent=i:GetCollapsableContainer()M.Parent=j p:AssertSame((t:GetWrappedInstance()).Parent,o:GetWrappedInstance(),"\080\097\114\101\110\116 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame((C:GetWrappedInstance()).Parent,t:GetWrappedInstance(),"\080\097\114\101\110\116 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame((j:GetWrappedInstance()).Parent,F:GetWrappedInstance(),"\080\097\114\101\110\116 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame((M:GetWrappedInstance()).Parent,j:GetWrappedInstance(),"\080\097\114\101\110\116 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\086\097\108\105\100\065\114\114\111\119\086\105\115\105\098\105\108\105\116\121",function(p)local i=L.new()local o=i.__Arrow local F,t=u.new("\070\114\097\109\101"),u.new("\070\114\097\109\101")local C=u.new("\070\114\097\109\101")F.Parent=i:GetCollapsableContainer()t.Parent=F C.Parent=t p:AssertTrue(o.Visible,"\065\114\114\111\119 \105\115 \110\111\116 \118\105\115\105\098\108\101\046")C.Visible=false p:AssertTrue(o.Visible,"\065\114\114\111\119 \105\115 \110\111\116 \118\105\115\105\098\108\101\046")F.Visible=false p:AssertFalse(o.Visible,"\065\114\114\111\119 \105\115 \118\105\115\105\098\108\101\046")end)p:RegisterUnitTest("\066\111\117\110\100\105\110\103\083\105\122\101",function(p)local i=L.new()i.Size=UDim2.new(0,200,0,20)local o,F=i:GetWrappedInstance(),i:GetCollapsableContainer()local t,C=u.new("\070\114\097\109\101"),u.new("\070\114\097\109\101")t.Size=UDim2.new(0,25,0,50)C.Size=UDim2.new(0,-10,0,-10)p:AssertEquals(F.Size.Y,UDim.new(0,0),"\073\110\105\116\105\097\108 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")t.Parent=i:GetCollapsableContainer()p:AssertEquals(i.Size,UDim2.new(0,200,0,20),"\083\105\122\101 \119\097\115 \109\117\116\097\116\101\100\046")p:AssertEquals(F.Size,UDim2.new(1,-20,0,50),"\073\110\105\116\105\097\108 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(o.Size,UDim2.new(0,200,0,70),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")t.Size=UDim2.new(0,75,0,100)p:AssertEquals(i.Size,UDim2.new(0,200,0,20),"\083\105\122\101 \119\097\115 \109\117\116\097\116\101\100\046")p:AssertEquals(F.Size,UDim2.new(1,-20,0,100),"\083\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(o.Size,UDim2.new(0,200,0,120),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")t.Position=UDim2.new(0,25,0,50)p:AssertEquals(i.Size,UDim2.new(0,200,0,20),"\083\105\122\101 \119\097\115 \109\117\116\097\116\101\100\046")p:AssertEquals(F.Size,UDim2.new(1,-20,0,150),"\083\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(o.Size,UDim2.new(0,200,0,170),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")C.Position=UDim2.new(0,50,0,150)C.Parent=t p:AssertEquals(i.Size,UDim2.new(0,200,0,20),"\083\105\122\101 \119\097\115 \109\117\116\097\116\101\100\046")p:AssertEquals(F.Size,UDim2.new(1,-20,0,200),"\083\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(o.Size,UDim2.new(0,200,0,220),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")C.Position=UDim2.new(0,50,0,200)p:AssertEquals(i.Size,UDim2.new(0,200,0,20),"\083\105\122\101 \119\097\115 \109\117\116\097\116\101\100\046")p:AssertEquals(F.Size,UDim2.new(1,-20,0,250),"\083\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(o.Size,UDim2.new(0,200,0,270),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")C.Size=UDim2.new(0,50,0,50)p:AssertEquals(i.Size,UDim2.new(0,200,0,20),"\083\105\122\101 \119\097\115 \109\117\116\097\116\101\100\046")p:AssertEquals(F.Size,UDim2.new(1,-20,0,300),"\083\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(o.Size,UDim2.new(0,200,0,320),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")C.Parent=i:GetCollapsableContainer()p:AssertEquals(i.Size,UDim2.new(0,200,0,20),"\083\105\122\101 \119\097\115 \109\117\116\097\116\101\100\046")p:AssertEquals(F.Size,UDim2.new(1,-20,0,250),"\083\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(o.Size,UDim2.new(0,200,0,270),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")C:Destroy()p:AssertEquals(i.Size,UDim2.new(0,200,0,20),"\083\105\122\101 \119\097\115 \109\117\116\097\116\101\100\046")p:AssertEquals(F.Size,UDim2.new(1,-20,0,150),"\083\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(o.Size,UDim2.new(0,200,0,170),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")t:Destroy()p:AssertEquals(i.Size,UDim2.new(0,200,0,20),"\083\105\122\101 \119\097\115 \109\117\116\097\116\101\100\046")p:AssertEquals(F.Size,UDim2.new(1,-20,0,0),"\083\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(o.Size,UDim2.new(0,200,0,20),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\068\105\115\097\098\108\101\100",function(p)local u=L.new()local i,o=u:GetMainContainer(),u.__Arrow local F=o.ImageColor3 u.Selected=true u.Disabled=true p:AssertNotEquals(o.ImageColor3,F,"\065\114\114\111\119 \099\111\108\111\114 \105\115 \110\111\116 \100\105\115\097\098\108\101\100\046")p:AssertEquals(i.BackgroundTransparency,1,"\084\114\097\110\115\112\097\114\101\110\099\121 \105\115 \105\110\099\111\114\114\101\099\116\046")u.Disabled=false p:AssertEquals(o.ImageColor3,F,"\065\114\114\111\119 \099\111\108\111\114 \105\115 \110\111\116 \100\105\115\097\098\108\101\100\046")p:AssertEquals(i.BackgroundTransparency,0,"\084\114\097\110\115\112\097\114\101\110\099\121 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\072\105\103\104\108\105\103\104\116\067\111\108\111\114\051\065\110\100\083\101\108\101\099\116\101\100",function(p)local u=L.new()local i=u:GetMainContainer()p:AssertEquals(i.BackgroundTransparency,1,"\066\097\099\107\103\114\111\117\110\100 \105\115 \110\111\116 \104\105\100\100\101\110\046")i.BackgroundColor3=Color3.new(1,0,0)u.Selected=true p:AssertEquals(i.BackgroundTransparency,0,"\066\097\099\107\103\114\111\117\110\100 \105\115 \104\105\100\100\101\110\046")p:AssertNotEquals(i.BackgroundColor3,Color3.new(1,0,0),"\067\111\108\111\114 \119\097\115 \110\111\116 \099\104\097\110\103\101\100\046")u.HighlightColor3=Color3.new(0,1,0)p:AssertEquals(i.BackgroundColor3,Color3.new(0,1,0),"\067\111\108\111\114 \119\097\115 \110\111\116 \099\104\097\110\103\101\100\046")u.Selected=false p:AssertEquals(i.BackgroundTransparency,1,"\066\097\099\107\103\114\111\117\110\100 \105\115 \110\111\116 \104\105\100\100\101\110\046")end)p:RegisterUnitTest("\065\114\114\111\119\086\105\115\105\098\108\101",function(p)local i=L.new()local o=i.__Arrow p:AssertFalse(o.Visible,"\065\114\114\111\119 \105\115 \110\111\116 \104\105\100\100\101\110\046")local F=u.new("\070\114\097\109\101")F.Parent=i p:AssertFalse(o.Visible,"\065\114\114\111\119 \105\115 \110\111\116 \104\105\100\100\101\110\046")F.Parent=i:GetCollapsableContainer()p:AssertTrue(o.Visible,"\065\114\114\111\119 \105\115 \104\105\100\100\101\110\046")i.ArrowVisible=false p:AssertFalse(o.Visible,"\065\114\114\111\119 \105\115 \110\111\116 \104\105\100\100\101\110\046")i.ArrowVisible=true p:AssertTrue(o.Visible,"\065\114\114\111\119 \105\115 \104\105\100\100\101\110\046");(i:GetCollapsableContainer()):ClearAllChildren()p:AssertFalse(o.Visible,"\065\114\114\111\119 \105\115 \110\111\116 \104\105\100\100\101\110\046")end)p:RegisterUnitTest("\083\101\108\101\099\116\097\098\108\101",function(p)local u=L.new()local i=u:GetMainContainer()p:AssertEquals(i.BackgroundTransparency,1,"\066\097\099\107\103\114\111\117\110\100 \105\115 \110\111\116 \104\105\100\100\101\110\046")u.HighlightColor3=Color3.new(0,1,0)u.Selectable=false u.Selected=true p:AssertEquals(i.BackgroundTransparency,1,"\066\097\099\107\103\114\111\117\110\100 \105\115 \110\111\116 \104\105\100\100\101\110\046")p:AssertNotEquals(i.BackgroundColor3,Color3.new(0,1,0),"\067\111\108\111\114 \119\097\115 \099\104\097\110\103\101\100\046")u.Selectable=true p:AssertEquals(i.BackgroundTransparency,0,"\066\097\099\107\103\114\111\117\110\100 \105\115 \104\105\100\100\101\110\046")p:AssertEquals(i.BackgroundColor3,Color3.new(0,1,0),"\067\111\108\111\114 \119\097\115 \110\111\116 \099\104\097\110\103\101\100\046")end)p:RegisterUnitTest("\069\120\112\097\110\100\101\100",function(p)local u=L.new()local i=u:GetCollapsableContainer()i.Size=UDim2.new(1,-16,0,20)p:AssertTrue(u.Expanded,"\070\114\097\109\101 \105\115 \110\111\116 \101\120\112\097\110\100\101\100\046")p:AssertTrue(i.Visible,"\070\114\097\109\101 \105\115 \110\111\116 \101\120\112\097\110\100\101\100\046")p:AssertEquals(i.Size,UDim2.new(1,-16,0,20),"\067\111\108\108\097\112\115\097\098\108\101\067\111\110\116\097\105\110\101\114 \115\105\122\101 \099\104\097\110\103\101\100 \040\102\111\108\108\111\119\105\110\103 \097\115\115\101\114\116\105\111\110\115 \119\105\108\108 \102\097\105\108\041\046")p:AssertEquals((u:GetWrappedInstance()).Size,UDim2.new(0,200,0,36),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")u.Expanded=false p:AssertFalse(u.Expanded,"\070\114\097\109\101 \105\115 \110\111\116 \101\120\112\097\110\100\101\100\046")p:AssertFalse(i.Visible,"\070\114\097\109\101 \105\115 \110\111\116 \101\120\112\097\110\100\101\100\046")p:AssertEquals((u:GetWrappedInstance()).Size,UDim2.new(0,200,0,16),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")u.Expanded=true p:AssertTrue(u.Expanded,"\070\114\097\109\101 \105\115 \110\111\116 \101\120\112\097\110\100\101\100\046")p:AssertTrue(i.Visible,"\070\114\097\109\101 \105\115 \110\111\116 \101\120\112\097\110\100\101\100\046")p:AssertEquals((u:GetWrappedInstance()).Size,UDim2.new(0,200,0,36),"\067\111\110\116\097\105\110\101\114 \115\105\122\101 \105\115 \105\110\099\111\114\114\101\099\116\046")end)return true
--[[
TheNexusAvenger

Tests the NexusCollapsableListFrame class.
--]]

local NexusUnitTesting = require("NexusUnitTesting")

local NexusPluginFramework = require(game:GetService("ReplicatedStorage"):WaitForChild("NexusPluginFramework"))
local NexusCollapsableListFrame = NexusPluginFramework:GetResource("UI.CollapsableList.NexusCollapsableListFrame")



--[[
Test that the constructor works without failing.
--]]
NexusUnitTesting:RegisterUnitTest("Constructor",function(UnitTest)
	local CuT = NexusCollapsableListFrame.new()
	UnitTest:AssertEquals(CuT.ClassName,"NexusCollapsableListFrame","Class name is incorrect.")
	UnitTest:AssertEquals(CuT.Name,"NexusCollapsableListFrame","Name is incorrect.")
	UnitTest:AssertEquals(tostring(CuT),"NexusCollapsableListFrame","Name is incorrect.")
	UnitTest:AssertEquals(#CuT:GetChildren(),0,"Children aren't hidden.")
end)

--[[
Tests that the structure is valid.
--]]
NexusUnitTesting:RegisterUnitTest("Structure",function(UnitTest)
	--Create the component under testing.
	local CuT = NexusCollapsableListFrame.new()
	local Container,CollapsableContainer = CuT:GetMainContainer(),CuT:GetCollapsableContainer()
	
	local Frame1,Frame2 = NexusPluginFramework.new("Frame"),NexusPluginFramework.new("Frame")
	local Frame3,Frame4 = NexusPluginFramework.new("Frame"),NexusPluginFramework.new("Frame")
	Frame1.Parent = CuT:GetMainContainer()
	Frame2.Parent = Frame1
	Frame3.Parent = CuT:GetCollapsableContainer()
	Frame4.Parent = Frame3
	
	--Assert the structure is correct.
	UnitTest:AssertSame(Frame1:GetWrappedInstance().Parent,Container:GetWrappedInstance(),"Parent is incorrect.")
	UnitTest:AssertSame(Frame2:GetWrappedInstance().Parent,Frame1:GetWrappedInstance(),"Parent is incorrect.")
	UnitTest:AssertSame(Frame3:GetWrappedInstance().Parent,CollapsableContainer:GetWrappedInstance(),"Parent is incorrect.")
	UnitTest:AssertSame(Frame4:GetWrappedInstance().Parent,Frame3:GetWrappedInstance(),"Parent is incorrect.")
end)

--[[
Tests the arrow visibility with nested visible frames.
--]]
NexusUnitTesting:RegisterUnitTest("ValidArrowVisibility",function(UnitTest)
	--Create the component under testing.
	local CuT = NexusCollapsableListFrame.new()
	local Arrow = CuT.__Arrow
	
	--Add 3 frames.
	local Frame1,Frame2 = NexusPluginFramework.new("Frame"),NexusPluginFramework.new("Frame")
	local Frame3 = NexusPluginFramework.new("Frame")
	Frame1.Parent = CuT:GetCollapsableContainer()
	Frame2.Parent = Frame1
	Frame3.Parent = Frame2
	
	--Assert the arrow is visible.
	UnitTest:AssertTrue(Arrow.Visible,"Arrow is not visible.")
	
	--Hide frame 3 and assert it is not hidden.
	Frame3.Visible = false
	UnitTest:AssertTrue(Arrow.Visible,"Arrow is not visible.")
	
	--Hide frame 1 and assert it is hidden.
	Frame1.Visible = false
	UnitTest:AssertFalse(Arrow.Visible,"Arrow is visible.")
end)

--[[
Tests that the bounding size is valid.
--]]
NexusUnitTesting:RegisterUnitTest("BoundingSize",function(UnitTest)
	--Create the component under testing.
	local CuT = NexusCollapsableListFrame.new()
	CuT.Size = UDim2.new(0,200,0,20)
	local WrappedInstance,CollapsableContainer = CuT:GetWrappedInstance(),CuT:GetCollapsableContainer()
	local Frame1,Frame2 = NexusPluginFramework.new("Frame"),NexusPluginFramework.new("Frame")
	Frame1.Size = UDim2.new(0,25,0,50)
	Frame2.Size = UDim2.new(0,-10,0,-10)
	
	--Assert the base size is correct.
	UnitTest:AssertEquals(CollapsableContainer.Size.Y,UDim.new(0,0),"Initial size is incorrect.")
	
	--Assert adding a frame changes the size correctly.
	Frame1.Parent = CuT:GetCollapsableContainer()
	UnitTest:AssertEquals(CuT.Size,UDim2.new(0,200,0,20),"Size was mutated.")
	UnitTest:AssertEquals(CollapsableContainer.Size,UDim2.new(1,-20,0,50),"Initial size is incorrect.")
	UnitTest:AssertEquals(WrappedInstance.Size,UDim2.new(0,200,0,70),"Container size is incorrect.")
	
	--Assert changing a frame changes the size correctly.
	Frame1.Size = UDim2.new(0,75,0,100)
	UnitTest:AssertEquals(CuT.Size,UDim2.new(0,200,0,20),"Size was mutated.")
	UnitTest:AssertEquals(CollapsableContainer.Size,UDim2.new(1,-20,0,100),"Size is incorrect.")
	UnitTest:AssertEquals(WrappedInstance.Size,UDim2.new(0,200,0,120),"Container size is incorrect.")
	Frame1.Position = UDim2.new(0,25,0,50)
	UnitTest:AssertEquals(CuT.Size,UDim2.new(0,200,0,20),"Size was mutated.")
	UnitTest:AssertEquals(CollapsableContainer.Size,UDim2.new(1,-20,0,150),"Size is incorrect.")
	UnitTest:AssertEquals(WrappedInstance.Size,UDim2.new(0,200,0,170),"Container size is incorrect.")
	
	--Assert adding and changing a child frame changes the size correctly.
	Frame2.Position = UDim2.new(0,50,0,150)
	Frame2.Parent = Frame1
	UnitTest:AssertEquals(CuT.Size,UDim2.new(0,200,0,20),"Size was mutated.")
	UnitTest:AssertEquals(CollapsableContainer.Size,UDim2.new(1,-20,0,200),"Size is incorrect.")
	UnitTest:AssertEquals(WrappedInstance.Size,UDim2.new(0,200,0,220),"Container size is incorrect.")
	Frame2.Position = UDim2.new(0,50,0,200)
	UnitTest:AssertEquals(CuT.Size,UDim2.new(0,200,0,20),"Size was mutated.")
	UnitTest:AssertEquals(CollapsableContainer.Size,UDim2.new(1,-20,0,250),"Size is incorrect.")
	UnitTest:AssertEquals(WrappedInstance.Size,UDim2.new(0,200,0,270),"Container size is incorrect.")
	Frame2.Size = UDim2.new(0,50,0,50)
	UnitTest:AssertEquals(CuT.Size,UDim2.new(0,200,0,20),"Size was mutated.")
	UnitTest:AssertEquals(CollapsableContainer.Size,UDim2.new(1,-20,0,300),"Size is incorrect.")
	UnitTest:AssertEquals(WrappedInstance.Size,UDim2.new(0,200,0,320),"Container size is incorrect.")
	
	--Assert that re-parenting then deleteing frames changes the size correctly.
	Frame2.Parent = CuT:GetCollapsableContainer()
	UnitTest:AssertEquals(CuT.Size,UDim2.new(0,200,0,20),"Size was mutated.")
	UnitTest:AssertEquals(CollapsableContainer.Size,UDim2.new(1,-20,0,250),"Size is incorrect.")
	UnitTest:AssertEquals(WrappedInstance.Size,UDim2.new(0,200,0,270),"Container size is incorrect.")
	Frame2:Destroy()
	UnitTest:AssertEquals(CuT.Size,UDim2.new(0,200,0,20),"Size was mutated.")
	UnitTest:AssertEquals(CollapsableContainer.Size,UDim2.new(1,-20,0,150),"Size is incorrect.")
	UnitTest:AssertEquals(WrappedInstance.Size,UDim2.new(0,200,0,170),"Container size is incorrect.")
	Frame1:Destroy()
	UnitTest:AssertEquals(CuT.Size,UDim2.new(0,200,0,20),"Size was mutated.")
	UnitTest:AssertEquals(CollapsableContainer.Size,UDim2.new(1,-20,0,0),"Size is incorrect.")
	UnitTest:AssertEquals(WrappedInstance.Size,UDim2.new(0,200,0,20),"Container size is incorrect.")
end)

--[[
Tests the Disabled property.
--]]
NexusUnitTesting:RegisterUnitTest("Disabled",function(UnitTest)
	--Create the component under testing.
	local CuT = NexusCollapsableListFrame.new()
	local Container,Arrow = CuT:GetMainContainer(),CuT.__Arrow
	local BaseColor = Arrow.ImageColor3
	CuT.Selected = true
	
	--Assert disabling the frame changes the arrow color and hides the selection color.
	CuT.Disabled = true
	UnitTest:AssertNotEquals(Arrow.ImageColor3,BaseColor,"Arrow color is not disabled.")
	UnitTest:AssertEquals(Container.BackgroundTransparency,1,"Transparency is incorrect.")
	
	--Assert enabling the frame changes the arrow color and hides the selection color.
	CuT.Disabled = false
	UnitTest:AssertEquals(Arrow.ImageColor3,BaseColor,"Arrow color is not disabled.")
	UnitTest:AssertEquals(Container.BackgroundTransparency,0,"Transparency is incorrect.")
end)

--[[
Tests the HighlightColor3 and Selected properties.
--]]
NexusUnitTesting:RegisterUnitTest("HighlightColor3AndSelected",function(UnitTest)
	--Create the component under testing.
	local CuT = NexusCollapsableListFrame.new()
	local Container = CuT:GetMainContainer()
	
	--Assert the container doesn't have the background set.
	UnitTest:AssertEquals(Container.BackgroundTransparency,1,"Background is not hidden.")
	
	--Assert selecting the background changes the color and transparency.
	Container.BackgroundColor3 = Color3.new(1,0,0)
	CuT.Selected = true
	UnitTest:AssertEquals(Container.BackgroundTransparency,0,"Background is hidden.")
	UnitTest:AssertNotEquals(Container.BackgroundColor3,Color3.new(1,0,0),"Color was not changed.")
	
	--Assert changing the highlight color changes the background.
	CuT.HighlightColor3 = Color3.new(0,1,0)
	UnitTest:AssertEquals(Container.BackgroundColor3,Color3.new(0,1,0),"Color was not changed.")
	
	--Assert unselecting the frame hides the background.
	CuT.Selected = false
	UnitTest:AssertEquals(Container.BackgroundTransparency,1,"Background is not hidden.")
end)

--[[
Tests the ArrowVisible property.
--]]
NexusUnitTesting:RegisterUnitTest("ArrowVisible",function(UnitTest)
	--Create the component under testing.
	local CuT = NexusCollapsableListFrame.new()
	local Arrow = CuT.__Arrow
	
	--Assert the arrow is hidden
	UnitTest:AssertFalse(Arrow.Visible,"Arrow is not hidden.")
	
	--Assert adding a frame doesn't make the arrow visible.
	local Frame = NexusPluginFramework.new("Frame")
	Frame.Parent = CuT
	UnitTest:AssertFalse(Arrow.Visible,"Arrow is not hidden.")
	
	--Assert adding a frame does makes the arrow visible.
	Frame.Parent = CuT:GetCollapsableContainer()
	UnitTest:AssertTrue(Arrow.Visible,"Arrow is hidden.")
	
	--Assert disabling arrow visibility hides the arrow.
	CuT.ArrowVisible = false
	UnitTest:AssertFalse(Arrow.Visible,"Arrow is not hidden.")
	
	--Assert enablign arrow visible shows the arrow.
	CuT.ArrowVisible = true
	UnitTest:AssertTrue(Arrow.Visible,"Arrow is hidden.")
	
	--Assert removing all children hides the arrow.
	CuT:GetCollapsableContainer():ClearAllChildren()
	UnitTest:AssertFalse(Arrow.Visible,"Arrow is not hidden.")
end)

--[[
Tests the Selectable property.
--]]
NexusUnitTesting:RegisterUnitTest("Selectable",function(UnitTest)
	--Create the component under testing.
	local CuT = NexusCollapsableListFrame.new()
	local Container = CuT:GetMainContainer()
	
	--Assert the container doesn't have the background set.
	UnitTest:AssertEquals(Container.BackgroundTransparency,1,"Background is not hidden.")
	
	--Assert making the frame unselectable doesn't change the colors.
	CuT.HighlightColor3 = Color3.new(0,1,0)
	CuT.Selectable = false
	CuT.Selected = true
	UnitTest:AssertEquals(Container.BackgroundTransparency,1,"Background is not hidden.")
	UnitTest:AssertNotEquals(Container.BackgroundColor3,Color3.new(0,1,0),"Color was changed.")
	
	--Assert making the frame selectable changes the colors.
	CuT.Selectable = true
	UnitTest:AssertEquals(Container.BackgroundTransparency,0,"Background is hidden.")
	UnitTest:AssertEquals(Container.BackgroundColor3,Color3.new(0,1,0),"Color was not changed.")
end)

--[[
Tests the Expanded property.
--]]
NexusUnitTesting:RegisterUnitTest("Expanded",function(UnitTest)
	--Create the component under testing.
	local CuT = NexusCollapsableListFrame.new()
	local CollapsableContainer = CuT:GetCollapsableContainer()
	CollapsableContainer.Size = UDim2.new(1,-16,0,20)
	
	--Assert the frame is initially expanded.
	UnitTest:AssertTrue(CuT.Expanded,"Frame is not expanded.")
	UnitTest:AssertTrue(CollapsableContainer.Visible,"Frame is not expanded.")
	UnitTest:AssertEquals(CollapsableContainer.Size,UDim2.new(1,-16,0,20),"CollapsableContainer size changed (following assertions will fail).")
	UnitTest:AssertEquals(CuT:GetWrappedInstance().Size,UDim2.new(0,200,0,36),"Container size is incorrect.")
	
	--Assert the frame is collapsed when not expanded.
	CuT.Expanded = false
	UnitTest:AssertFalse(CuT.Expanded,"Frame is not expanded.")
	UnitTest:AssertFalse(CollapsableContainer.Visible,"Frame is not expanded.")
	UnitTest:AssertEquals(CuT:GetWrappedInstance().Size,UDim2.new(0,200,0,16),"Container size is incorrect.")
	
	--Assert the frame is expanded when expanded.
	CuT.Expanded = true
	UnitTest:AssertTrue(CuT.Expanded,"Frame is not expanded.")
	UnitTest:AssertTrue(CollapsableContainer.Visible,"Frame is not expanded.")
	UnitTest:AssertEquals(CuT:GetWrappedInstance().Size,UDim2.new(0,200,0,36),"Container size is incorrect.")
end)

--[[
Creates a series of list frames.
Disabled unless needed.
--]]
--[[
NexusUnitTesting:RegisterUnitTest("ManualTesting",function(UnitTest)
	--Create the screen gui.
	local ScreenGui = Instance.new("ScreenGui")
	ScreenGui.Parent = game:GetService("StarterGui")
	
	--Create the background frame.
	local Frame = NexusPluginFramework.new("Frame")
	Frame.Size = UDim2.new(0,500,0,100)
	Frame.Parent = ScreenGui
	
	--Create the first list frame.
	local CuT1 = NexusCollapsableListFrame.new()
	CuT1.Size = UDim2.new(0,500,0,16)
	CuT1.Expanded = false
	CuT1.Parent = Frame
	
	local TextLabel = NexusPluginFramework.new("TextLabel")
	TextLabel.Size = UDim2.new(1,0,1,0)
	TextLabel.Text = "Frame 1 (Collapsed by default)"
	TextLabel.Parent = CuT1:GetMainContainer()
	
	--Create the second list frame.
	local CuT2 = NexusCollapsableListFrame.new()
	CuT2.Size = UDim2.new(1,0,0,16)
	CuT2.Disabled = true
	CuT2.Parent = CuT1:GetCollapsableContainer()
	
	local TextLabel = NexusPluginFramework.new("TextLabel")
	TextLabel.Size = UDim2.new(1,0,1,0)
	TextLabel.Text = "Frame 2 (Disabled)"
	TextLabel.Disabled = true
	TextLabel.Parent = CuT2:GetMainContainer()
	
	--Create the third list frame.
	local CuT3 = NexusCollapsableListFrame.new()
	CuT3.Size = UDim2.new(1,0,0,16)
	CuT3.ArrowVisible = false
	CuT3.Parent = CuT2:GetCollapsableContainer()
	
	local TextLabel = NexusPluginFramework.new("TextLabel")
	TextLabel.Size = UDim2.new(1,0,1,0)
	TextLabel.Text = "Frame 3 (Arrow not visible)"
	TextLabel.Parent = CuT3:GetMainContainer()
	
	--Create the fourth list frame.
	local CuT4 = NexusCollapsableListFrame.new()
	CuT4.Size = UDim2.new(1,0,0,30)
	CuT4.Selectable = false
	CuT4.Parent = CuT3:GetCollapsableContainer()
	
	local TextLabel = NexusPluginFramework.new("TextLabel")
	TextLabel.Size = UDim2.new(1,0,1,0)
	TextLabel.Text = "Frame 4 (Taller, unselectable)"
	TextLabel.Parent = CuT4:GetMainContainer()
	
	--Create the fifth list frame.
	local CuT5 = NexusCollapsableListFrame.new()
	CuT5.Size = UDim2.new(1,0,0,16)
	CuT5.Parent = CuT4:GetCollapsableContainer()
	
	local TextLabel = NexusPluginFramework.new("TextLabel")
	TextLabel.Size = UDim2.new(1,0,1,0)
	TextLabel.Text = "Frame 5 (No children)"
	TextLabel.Parent = CuT5:GetMainContainer()
	
	--Set up the events.
	CuT1.DoubleClicked:Connect(function() print("Frame 1 double clicked.") end)
	CuT1.DelayClicked:Connect(function() print("Frame 1 delayed clicked.") end)
	CuT2.DoubleClicked:Connect(function() print("Frame 2 double clicked.") end)
	CuT2.DelayClicked:Connect(function() print("Frame 2 delayed clicked.") end)
	CuT3.DoubleClicked:Connect(function() print("Frame 3 double clicked.") end)
	CuT3.DelayClicked:Connect(function() print("Frame 3 delayed clicked.") end)
	CuT4.DoubleClicked:Connect(function() print("Frame 4 double clicked.") end)
	CuT4.DelayClicked:Connect(function() print("Frame 4 delayed clicked.") end)
	CuT5.DoubleClicked:Connect(function() print("Frame 5 double clicked.") end)
	CuT5.DelayClicked:Connect(function() print("Frame 5 delayed clicked.") end)
	
	--Wait for the screen gui to be deleted.
	while ScreenGui.Parent do wait() end
end)
--]]



return true