local W=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\066\117\116\116\111\110")):WaitForChild("\070\097\099\116\111\114\121")):WaitForChild("\066\117\116\116\111\110\070\097\099\116\111\114\121"))return function()describe("\065 \098\117\116\116\111\110 \102\097\099\116\111\114\121",function()it("\115\104\111\117\108\100 \115\101\116 \100\101\102\097\117\108\116 \112\114\111\112\101\114\116\105\101\115\046",function()local z=W.new()z:SetDefault("\078\097\109\101","\084\101\115\116\066\117\116\116\111\110")z:SetDefault("\083\105\122\101",UDim2.new(1,2,3,4))local g=z:Create();(expect(g.Name)).to.equal("\084\101\115\116\066\117\116\116\111\110");(expect(g.Size)).to.equal(UDim2.new(1,2,3,4))g:Destroy()z:UnsetDefault("\078\097\109\101")local Q=z:Create();(expect(Q.Name)).never.to.equal("\084\101\115\116\066\117\116\116\111\110");(expect(Q.Size)).to.equal(UDim2.new(1,2,3,4))Q:Destroy()end)it("\115\104\111\117\108\100 \098\101 \099\114\101\097\116\101\100 \102\114\111\109 \097 \100\101\102\097\117\108\116 \112\114\101\115\101\116\046",function()local z=W.CreateDefault(Color3.fromRGB(0,170,255))local g=z:Create();(expect(g.BackgroundColor3)).to.equal(Color3.fromRGB(0,170,255));(expect(g.BorderColor3)).to.equal(Color3.fromRGB(0,140,225));(expect(g.BorderTransparency)).to.equal(.25)g:Destroy()end)end)end
--Tests the ButtonFactory class.
--!strict

local ButtonFactory = require(game:GetService("ReplicatedStorage"):WaitForChild("NexusButton"):WaitForChild("Factory"):WaitForChild("ButtonFactory"))

return function()
    describe("A button factory", function()
        it("should set default properties.", function()
            local TestButtonFactory = ButtonFactory.new()
            TestButtonFactory:SetDefault("Name", "TestButton")
            TestButtonFactory:SetDefault("Size", UDim2.new(1, 2, 3, 4))

            local Button1 = TestButtonFactory:Create()
            expect(Button1.Name).to.equal("TestButton")
            expect(Button1.Size).to.equal(UDim2.new(1, 2, 3, 4))
            Button1:Destroy()
        
            TestButtonFactory:UnsetDefault("Name")
            local Button2 = TestButtonFactory:Create()
            expect(Button2.Name).never.to.equal("TestButton")
            expect(Button2.Size).to.equal(UDim2.new(1, 2, 3, 4))
            Button2:Destroy()
        end)

        it("should be created from a default preset.", function()
            local TestButtonFactory = ButtonFactory.CreateDefault(Color3.fromRGB(0, 170, 255))

            local Button = TestButtonFactory:Create()
            expect(Button.BackgroundColor3).to.equal(Color3.fromRGB(0, 170, 255))
            expect(Button.BorderColor3).to.equal(Color3.fromRGB(0, 140, 225))
            expect(Button.BorderTransparency).to.equal(0.25)
            Button:Destroy()
        end)
    end)
end