File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -221,3 +221,36 @@ def outer_click_is_not_triggered(event):
221221 await inner .click ()
222222
223223 await poll (lambda : clicked .current ).until_is (True )
224+
225+
226+ async def test_javascript_event (display : DisplayFixture ):
227+ @reactpy .component
228+ def App ():
229+ return reactpy .html .div (
230+ reactpy .html .div (
231+ reactpy .html .button (
232+ {
233+ "id" : "the-button" ,
234+ "onClick" : """javascript: () => {
235+ let parent = document.getElementById("the-parent");
236+ parent.appendChild(document.createElement("div"));
237+ }""" ,
238+ },
239+ "Click Me" ,
240+ ),
241+ reactpy .html .div ({"id" : "the-parent" }),
242+ )
243+ )
244+
245+ await display .show (lambda : App ())
246+
247+ button = await display .page .wait_for_selector ("#the-button" , state = "attached" )
248+ await button .click ()
249+ await button .click ()
250+ await button .click ()
251+ parent = await display .page .wait_for_selector (
252+ "#the-parent" , state = "attached" , timeout = 0
253+ )
254+ generated_divs = await parent .query_selector_all ("div" )
255+
256+ assert len (generated_divs ) == 3
You can’t perform that action at this time.
0 commit comments