Skip to content

Commit 9f0bca3

Browse files
committed
Add test for React Strict Mode support (bitovi#169)
1 parent 3ce1656 commit 9f0bca3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/react-to-web-component/src/react-to-web-component.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,24 @@ describe("react-to-web-component 1", () => {
4646
expect(div?.textContent).toBe("hello, Bavin")
4747
})
4848

49+
it("works with props array in strict mode", async () => {
50+
function TestComponent({ name }: { name: string }) {
51+
return <div>hello, {name}</div>
52+
}
53+
54+
const TestElement = r2wc(TestComponent, { props: ["name"], strictMode: true })
55+
56+
customElements.define("test-hello-strict", TestElement)
57+
58+
const body = document.body
59+
body.innerHTML = "<test-hello-strict name='Bavin'></test-hello>"
60+
61+
await flushPromises()
62+
63+
const div = body.querySelector("div")
64+
expect(div?.textContent).toBe("hello, Bavin")
65+
})
66+
4967
it("works with proptypes", async () => {
5068
function WithProptypes({ name }: { name: string }) {
5169
return <div>hello, {name}</div>

0 commit comments

Comments
 (0)