@@ -111,7 +111,7 @@ async def test_customized_noscript(tmp_path: Path):
111111
112112 app = ReactPyCsr (
113113 Path (__file__ ).parent / "pyscript_components" / "root.py" ,
114- html_noscript_str_or_path = noscript_file ,
114+ html_noscript = noscript_file ,
115115 )
116116
117117 async with BackendFixture (app ) as server :
@@ -130,7 +130,7 @@ async def test_customized_noscript(tmp_path: Path):
130130async def test_customized_noscript_string ():
131131 app = ReactPyCsr (
132132 Path (__file__ ).parent / "pyscript_components" / "root.py" ,
133- html_noscript_str_or_path = '<p id="noscript-message">Please enable JavaScript.</p>' ,
133+ html_noscript = '<p id="noscript-message">Please enable JavaScript.</p>' ,
134134 )
135135
136136 async with BackendFixture (app ) as server :
@@ -154,7 +154,7 @@ async def test_customized_noscript_from_file(tmp_path: Path):
154154
155155 app = ReactPyCsr (
156156 Path (__file__ ).parent / "pyscript_components" / "root.py" ,
157- html_noscript_str_or_path = noscript_file ,
157+ html_noscript = noscript_file ,
158158 )
159159
160160 async with BackendFixture (app ) as server :
@@ -172,7 +172,29 @@ async def test_customized_noscript_from_file(tmp_path: Path):
172172async def test_customized_noscript_from_string ():
173173 app = ReactPyCsr (
174174 Path (__file__ ).parent / "pyscript_components" / "root.py" ,
175- html_noscript_str_or_path = '<p id="noscript-message">Please enable JavaScript.</p>' ,
175+ html_noscript = '<p id="noscript-message">Please enable JavaScript.</p>' ,
176+ )
177+
178+ async with BackendFixture (app ) as server :
179+ url = f"http://{ server .host } :{ server .port } "
180+ response = await asyncio .to_thread (
181+ request , "GET" , url , timeout = REACTPY_TESTS_DEFAULT_TIMEOUT .current
182+ )
183+ assert response .status_code == 200
184+ assert (
185+ '<noscript><p id="noscript-message">Please enable JavaScript.</p></noscript>'
186+ in response .text
187+ )
188+
189+
190+ async def test_customized_noscript_from_component ():
191+ @reactpy .component
192+ def noscript_message ():
193+ return html .p ({"id" : "noscript-message" }, "Please enable JavaScript." )
194+
195+ app = ReactPyCsr (
196+ Path (__file__ ).parent / "pyscript_components" / "root.py" ,
197+ html_noscript = noscript_message ,
176198 )
177199
178200 async with BackendFixture (app ) as server :
@@ -216,7 +238,10 @@ async def test_noscript_omitted():
216238
217239
218240async def test_noscript_disabled ():
219- app = ReactPyCsr (Path (__file__ ).parent / "pyscript_components" / "root.py" , html_noscript_str_or_path = None )
241+ app = ReactPyCsr (
242+ Path (__file__ ).parent / "pyscript_components" / "root.py" ,
243+ html_noscript = None ,
244+ )
220245
221246 async with BackendFixture (app ) as server :
222247 url = f"http://{ server .host } :{ server .port } "
0 commit comments