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

Commit

Permalink
Merge pull request #413 from Sunshine168/observer-with-inject
Browse files Browse the repository at this point in the history
Add Observer prop test suit
  • Loading branch information
mweststrate authored Feb 5, 2018
2 parents 925cf54 + 43fe3fc commit 3b508ed
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/observer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -807,4 +807,20 @@ describe("use Observer inject and render sugar should work ", () => {
await asyncReactDOMRender(<A />, testRoot)
expect(testRoot.querySelector("span").innerHTML).toBe("hello world")
})

test("show error when using children and render at same time ", async () => {
const msg = []
const baseError = console.error
console.error = m => msg.push(m)

const Comp = () => (
<div>
<Observer render={() => <span>{123}</span>}>{() => <span>{123}</span>}</Observer>
</div>
)

await asyncReactDOMRender(<Comp />, testRoot)
expect(msg.length).toBe(1)
console.error = baseError
})
})

0 comments on commit 3b508ed

Please sign in to comment.