Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
coroutine in test
Browse files Browse the repository at this point in the history
  • Loading branch information
ConorGriffin37 committed May 23, 2021
1 parent 7ea5eeb commit 72863ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/RobloxRenderer.spec.lua
Expand Up @@ -959,6 +959,8 @@ return function()
})
end

local childCoroutine

function ChildComponent:render()
if self.state.firstTime then
return createElement("Frame")
Expand All @@ -968,7 +970,7 @@ return function()
end

function ChildComponent:didMount()
spawn(function()
childCoroutine = coroutine.create(function()
self:setState({
firstTime = false
})
Expand Down Expand Up @@ -1007,6 +1009,8 @@ return function()
local hostKey = "Some Key"
local instance = reconciler.mountVirtualNode(tree, parent, hostKey)

coroutine.resume(childCoroutine)

expect(#parent:GetChildren()).to.equal(1)

local frame = parent:GetChildren()[1]
Expand Down

0 comments on commit 72863ab

Please sign in to comment.