local S=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"))return function()local K=nil beforeEach(function()K=S.new()end)afterEach(function()K:Destroy()end)describe("\065 \078\101\120\117\115\066\117\116\116\111\110 ",function()it("\115\104\111\117\108\100 \117\112\100\097\116\101 \116\104\101 \098\111\114\100\101\114 \115\105\122\101\046",function()K.BorderSizePixel=0 K.BorderSizeScale=0 K.BorderSizePixel=10;(expect(K.BorderSize)).to.equal(UDim.new(0,10))K.BorderSizeScale=.4;(expect(K.BorderSize)).to.equal(UDim.new(.4,0))end)it("\115\104\111\117\108\100 \117\112\100\097\116\101 \116\104\101 \116\114\097\110\115\112\097\114\101\110\099\121\046",function()K.BackgroundTransparency=.25 K.BorderTransparency=.75;(expect(K.BackgroundFrame.ImageTransparency)).to.equal(.25);(expect(K.BorderFrame.ImageTransparency)).to.equal(.75)end)it("\115\104\111\117\108\100 \109\097\112 \107\101\121\115\046",function()K:MapKey(Enum.KeyCode.A,Enum.UserInputType.MouseButton1)K:MapKey(Enum.KeyCode.B,"\077\111\117\115\101\066\117\116\116\111\110\049")K:MapKey("\067",Enum.UserInputType.MouseButton2)K:MapKey("\068","\077\111\117\115\101\066\117\116\116\111\110\050");(expect(K.MappedInputs[Enum.KeyCode.A])).to.equal(Enum.UserInputType.MouseButton1);(expect(K.MappedInputs[Enum.KeyCode.B])).to.equal(Enum.UserInputType.MouseButton1);(expect(K.MappedInputs[Enum.KeyCode.C])).to.equal(Enum.UserInputType.MouseButton2);(expect(K.MappedInputs[Enum.KeyCode.D])).to.equal(Enum.UserInputType.MouseButton2);(expect(K.MappedInputs[Enum.KeyCode.E])).to.equal(nil)K:UnmapKey(Enum.KeyCode.A)K:UnmapKey("\066")K:MapKey(Enum.KeyCode.C,Enum.UserInputType.MouseButton1)K:MapKey("\068","\077\111\117\115\101\066\117\116\116\111\110\049");(expect(K.MappedInputs[Enum.KeyCode.A])).to.equal(nil);(expect(K.MappedInputs[Enum.KeyCode.B])).to.equal(nil);(expect(K.MappedInputs[Enum.KeyCode.C])).to.equal(Enum.UserInputType.MouseButton1);(expect(K.MappedInputs[Enum.KeyCode.D])).to.equal(Enum.UserInputType.MouseButton1);(expect(function()K:MapKey(Enum.KeyCode.A,"\070\097\107\101\075\101\121")end)).to.throw()end)end)end
--Tests the NeuxsButton class.
--!strict

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

return function()
    local TextNexusButton = nil
    beforeEach(function()
        TextNexusButton = NexusButton.new()
    end)
    afterEach(function()
        TextNexusButton:Destroy()
    end)

    describe("A NexusButton ", function()
        it("should update the border size.", function()
            TextNexusButton.BorderSizePixel = 0
            TextNexusButton.BorderSizeScale = 0

            TextNexusButton.BorderSizePixel = 10
            expect(TextNexusButton.BorderSize).to.equal(UDim.new(0, 10))
            TextNexusButton.BorderSizeScale = 0.4
            expect(TextNexusButton.BorderSize).to.equal(UDim.new(0.4, 0))
        end)

        it("should update the transparency.", function()
            TextNexusButton.BackgroundTransparency = 0.25
            TextNexusButton.BorderTransparency = 0.75
            expect(TextNexusButton.BackgroundFrame.ImageTransparency).to.equal(0.25)
            expect(TextNexusButton.BorderFrame.ImageTransparency).to.equal(0.75)
        end)

        it("should map keys.", function()
            --Map several inputs and assert the mappings are correct.
            TextNexusButton:MapKey(Enum.KeyCode.A, Enum.UserInputType.MouseButton1)
            TextNexusButton:MapKey(Enum.KeyCode.B, "MouseButton1")
            TextNexusButton:MapKey("C", Enum.UserInputType.MouseButton2)
            TextNexusButton:MapKey("D", "MouseButton2")
            expect(TextNexusButton.MappedInputs[Enum.KeyCode.A]).to.equal(Enum.UserInputType.MouseButton1)
            expect(TextNexusButton.MappedInputs[Enum.KeyCode.B]).to.equal(Enum.UserInputType.MouseButton1)
            expect(TextNexusButton.MappedInputs[Enum.KeyCode.C]).to.equal(Enum.UserInputType.MouseButton2)
            expect(TextNexusButton.MappedInputs[Enum.KeyCode.D]).to.equal(Enum.UserInputType.MouseButton2)
            expect(TextNexusButton.MappedInputs[Enum.KeyCode.E]).to.equal(nil)

            --Remap and unmap several mappings and assert they are correct.
            TextNexusButton:UnmapKey(Enum.KeyCode.A)
            TextNexusButton:UnmapKey("B")
            TextNexusButton:MapKey(Enum.KeyCode.C, Enum.UserInputType.MouseButton1)
            TextNexusButton:MapKey("D", "MouseButton1")
            expect(TextNexusButton.MappedInputs[Enum.KeyCode.A]).to.equal(nil)
            expect(TextNexusButton.MappedInputs[Enum.KeyCode.B]).to.equal(nil)
            expect(TextNexusButton.MappedInputs[Enum.KeyCode.C]).to.equal(Enum.UserInputType.MouseButton1)
            expect(TextNexusButton.MappedInputs[Enum.KeyCode.D]).to.equal(Enum.UserInputType.MouseButton1)
            
            --Assert an error is thrown for an incorrect mapping.
            expect(function()
                TextNexusButton:MapKey(Enum.KeyCode.A, "FakeKey")
            end).to.throw()
        end)
    end)
end