You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`"Invariant Violation: Text strings must be rendered within a <Text> component. Detected attempt to render "Hello!" string within a <div> component."`,
54
-
);
55
-
});
51
+
awaitexpect(()=>
52
+
renderWithAct(renderer,<div>Hello!</div>),
53
+
).rejects.toThrowErrorMatchingInlineSnapshot(
54
+
`"Invariant Violation: Text strings must be rendered within a <Text> component. Detected attempt to render "Hello!" string within a <div> component."`,
55
+
);
56
+
});
56
57
57
-
test("render with two allowed text components",async()=>{
`"Invariant Violation: Text strings must be rendered within a <A> or <B> component. Detected attempt to render "Hello!" string within a <X> component."`,
`"Invariant Violation: Text strings must be rendered within a <A>or <B> component. Detected attempt to render "Hello!" string within a <X> component."`,
`"Invariant Violation: Text strings must be rendered within a <A>, <B>, or <C> component. Detected attempt to render "Hello!" string within a <X> component."`,
121
+
);
122
+
});
87
123
88
-
test("render with multiple allowed text components",async()=>{
89
-
constrenderer=createRoot({
90
-
textComponents: ["A","B","C"],
124
+
test("error message uses textComponentTypes when publicTextComponentTypes is not set",async()=>{
125
+
constrenderer=createRoot({
126
+
textComponentTypes: ["RCTText","RCTVirtualText"],
127
+
});
128
+
129
+
awaitexpect(()=>
130
+
renderWithAct(renderer,<div>Hello!</div>),
131
+
).rejects.toThrowErrorMatchingInlineSnapshot(
132
+
`"Invariant Violation: Text strings must be rendered within a <RCTText> or <RCTVirtualText> component. Detected attempt to render "Hello!" string within a <div> component."`,
`"Invariant Violation: Text strings must be rendered within a <A>, <B>, or <C> component. Detected attempt to render "Hello!" string within a <X> component."`,
120
-
);
151
+
awaitexpect(()=>
152
+
renderWithAct(renderer,<div>Hello!</div>),
153
+
).rejects.toThrowErrorMatchingInlineSnapshot(
154
+
`"Invariant Violation: Text strings must be rendered within a <Text> component. Detected attempt to render "Hello!" string within a <div> component."`,
0 commit comments