local a=require("\078\101\120\117\115\085\110\105\116\084\101\115\116\105\110\103")local L=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 b=L:GetResource("\085\073\046\067\111\108\108\097\112\115\097\098\108\101\076\105\115\116\046\067\111\110\115\116\114\097\105\110\116\046\078\101\120\117\115\067\111\110\116\101\110\116\115\080\114\111\112\101\114\116\121\067\111\110\115\116\114\097\105\110\116")a:RegisterUnitTest("\067\111\110\115\116\114\117\099\116\111\114",function(a)local L=b.new()a:AssertEquals(L.ClassName,"\078\101\120\117\115\067\111\110\116\101\110\116\115\080\114\111\112\101\114\116\121\067\111\110\115\116\114\097\105\110\116","\067\108\097\115\115 \110\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")a:AssertEquals(L.Name,"\078\101\120\117\115\067\111\110\116\101\110\116\115\080\114\111\112\101\114\116\121\067\111\110\115\116\114\097\105\110\116","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")a:AssertEquals(tostring(L),"\078\101\120\117\115\067\111\110\116\101\110\116\115\080\114\111\112\101\114\116\121\067\111\110\115\116\114\097\105\110\116","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")end)a:RegisterUnitTest("\080\097\115\115\084\104\114\111\117\103\104",function(a)local Y=b.new()local T,X=L.new("\067\111\108\108\097\112\115\097\098\108\101\076\105\115\116\070\114\097\109\101"),L.new("\067\111\108\108\097\112\115\097\098\108\101\076\105\115\116\070\114\097\109\101")local R,A,N=L.new("\084\101\120\116\076\097\098\101\108"),L.new("\084\101\120\116\076\097\098\101\108"),L.new("\084\101\120\116\076\097\098\101\108")R.Parent=T:GetMainContainer()A.Parent=X:GetMainContainer()N.Parent=X:GetCollapsableContainer()Y:AddListFrame(T)Y:AddListFrame(X)T.Disabled=true X.Selected=true a:AssertFalse(R.Selected,"\084\101\120\116 \108\097\098\101\108 \105\115 \115\101\108\101\099\116\101\100\046")a:AssertTrue(R.Disabled,"\084\101\120\116 \108\097\098\101\108 \105\115 \110\111\116 \100\105\115\097\098\108\101\100\046")a:AssertTrue(A.Selected,"\084\101\120\116 \108\097\098\101\108 \105\115 \110\111\116 \115\101\108\101\099\116\101\100\046")a:AssertFalse(A.Disabled,"\084\101\120\116 \108\097\098\101\108 \105\115 \100\105\115\097\098\108\101\100\046")a:AssertFalse(N.Selected,"\084\101\120\116 \108\097\098\101\108 \105\115 \115\101\108\101\099\116\101\100\046")a:AssertFalse(N.Disabled,"\084\101\120\116 \108\097\098\101\108 \105\115 \100\105\115\097\098\108\101\100\046")T.Disabled=false T.Selected=true X.Disabled=true X.Selected=false a:AssertTrue(R.Selected,"\084\101\120\116 \108\097\098\101\108 \105\115 \110\111\116 \115\101\108\101\099\116\101\100\046")a:AssertFalse(R.Disabled,"\084\101\120\116 \108\097\098\101\108 \105\115 \100\105\115\097\098\108\101\100\046")a:AssertFalse(A.Selected,"\084\101\120\116 \108\097\098\101\108 \105\115 \115\101\108\101\099\116\101\100\046")a:AssertTrue(A.Disabled,"\084\101\120\116 \108\097\098\101\108 \105\115 \110\111\116 \100\105\115\097\098\108\101\100\046")a:AssertFalse(N.Selected,"\084\101\120\116 \108\097\098\101\108 \105\115 \115\101\108\101\099\116\101\100\046")a:AssertFalse(N.Disabled,"\084\101\120\116 \108\097\098\101\108 \105\115 \100\105\115\097\098\108\101\100\046")end)return true
--[[
TheNexusAvenger

Tests the NexusContentsPropertyConstraint class.
--]]

local NexusUnitTesting = require("NexusUnitTesting")

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



--[[
Test that the constructor works without failing.
--]]
NexusUnitTesting:RegisterUnitTest("Constructor",function(UnitTest)
	local CuT = NexusContentsPropertyConstraint.new()
	UnitTest:AssertEquals(CuT.ClassName,"NexusContentsPropertyConstraint","Class name is incorrect.")
	UnitTest:AssertEquals(CuT.Name,"NexusContentsPropertyConstraint","Name is incorrect.")
	UnitTest:AssertEquals(tostring(CuT),"NexusContentsPropertyConstraint","Name is incorrect.")
end)

--[[
Tests that properties are passed through.
--]]
NexusUnitTesting:RegisterUnitTest("PassThrough",function(UnitTest)
	--Create the component under testing.
	local CuT = NexusContentsPropertyConstraint.new()
	
	--Create 2 list frames and add them to the constraint.
	local Frame1,Frame2 = NexusPluginFramework.new("CollapsableListFrame"),NexusPluginFramework.new("CollapsableListFrame")
	local TextLabel1,TextLabel2,TextLabel3 = NexusPluginFramework.new("TextLabel"),NexusPluginFramework.new("TextLabel"),NexusPluginFramework.new("TextLabel")
	TextLabel1.Parent = Frame1:GetMainContainer()
	TextLabel2.Parent = Frame2:GetMainContainer()
	TextLabel3.Parent = Frame2:GetCollapsableContainer()
	CuT:AddListFrame(Frame1)
	CuT:AddListFrame(Frame2)
	
	--Modify the properties and assert they are passed through.
	Frame1.Disabled = true
	Frame2.Selected = true
	UnitTest:AssertFalse(TextLabel1.Selected,"Text label is selected.")
	UnitTest:AssertTrue(TextLabel1.Disabled,"Text label is not disabled.")
	UnitTest:AssertTrue(TextLabel2.Selected,"Text label is not selected.")
	UnitTest:AssertFalse(TextLabel2.Disabled,"Text label is disabled.")
	UnitTest:AssertFalse(TextLabel3.Selected,"Text label is selected.")
	UnitTest:AssertFalse(TextLabel3.Disabled,"Text label is disabled.")
	
	--Modify the properties and assert they are passed through.
	Frame1.Disabled = false
	Frame1.Selected = true
	Frame2.Disabled = true
	Frame2.Selected = false
	UnitTest:AssertTrue(TextLabel1.Selected,"Text label is not selected.")
	UnitTest:AssertFalse(TextLabel1.Disabled,"Text label is disabled.")
	UnitTest:AssertFalse(TextLabel2.Selected,"Text label is selected.")
	UnitTest:AssertTrue(TextLabel2.Disabled,"Text label is not disabled.")
	UnitTest:AssertFalse(TextLabel3.Selected,"Text label is selected.")
	UnitTest:AssertFalse(TextLabel3.Disabled,"Text label is disabled.")
end)



return true