local I=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local A=require(I.Packages.Dex)return function()describe("\067\111\110\110\101\099\116",function()it("\067\111\110\110\101\099\116\115 \097\110\100 \100\105\115\099\111\110\110\101\099\116\115 \116\119\111 \108\105\115\116\101\110\101\114\115 \111\110 \109\111\117\110\116\047\117\110\109\111\117\110\116",function()local I=Instance.new("\084\101\120\116\076\097\098\101\108")local f=0 local T=0 local W=A.Premade("\084\101\120\116\076\097\098\101\108")W:Connect("\067\104\097\110\103\101\100",function()f+=1 end)W:Connect("\067\104\097\110\103\101\100",function()T+=1 end)local J=A.Root(I)J:Render(W);(expect(f)).to.equal(0);(expect(T)).to.equal(0)I.Name="\070\111\111";(expect(f)).to.equal(1);(expect(T)).to.equal(1)J:Unmount();(expect(f)).to.equal(1);(expect(T)).to.equal(1)I.Name="\070\105\103\104\116\101\114\115";(expect(f)).to.equal(1);(expect(T)).to.equal(1)end)end)end
--!strict
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Dex = require(ReplicatedStorage.Packages.Dex)
return function()
    describe("Connect", function()
        it("Connects and disconnects two listeners on mount/unmount", function()
            local host = Instance.new("TextLabel")
            
            local changedCount1 = 0
            local changedCount2 = 0
            local virtualInstance = Dex.Premade("TextLabel")
            virtualInstance:Connect("Changed", function()
                changedCount1 += 1
            end)
            virtualInstance:Connect("Changed", function()
                changedCount2 += 1
            end)
            local root = Dex.Root(host)
            root:Render(virtualInstance)
            expect(changedCount1).to.equal(0)
            expect(changedCount2).to.equal(0)
        
            host.Name = "Foo"
            expect(changedCount1).to.equal(1)
            expect(changedCount2).to.equal(1)

            root:Unmount()
            expect(changedCount1).to.equal(1)
            expect(changedCount2).to.equal(1)
        
            host.Name = "Fighters"
            expect(changedCount1).to.equal(1)
            expect(changedCount2).to.equal(1)
        end)
    end)
end