Files
pyscript/pyscriptjs/tests/integration/test_py_button.py
Fábio Rosado c566977749 Don't create custom elements in main and fix various small issues on tests (#747)
* Create custom elements when the runtime finishes loading

* Remove xfails and fix repl integration test

* Fix commented ignore

* Address Antonio's comments

* Fix bad rebase

* Make ure to wait for repl to be in attached state before asserting content

* Move createCustomeElement up so it runs before we close the loader, xfail flaky d3 test

* Fix xfail
2022-09-13 16:59:33 +02:00

19 lines
587 B
Python

from .support import PyScriptTest
class TestPyButton(PyScriptTest):
def test_on_click(self):
self.pyscript_run(
"""
<py-button label="my button">
import js
def on_click(evt):
js.console.log('clicked!')
</py-button>
"""
)
assert self.console.log.lines == [self.PY_COMPLETE]
self.page.locator("text=my button").click()
self.page.locator("text=my button").click()
assert self.console.log.lines == [self.PY_COMPLETE, "clicked!", "clicked!"]