Files
pyscript/pyscriptjs/tests/integration/test_py_inputbox.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

23 lines
643 B
Python

from .support import PyScriptTest
class TestPyInputBox(PyScriptTest):
def test_input_box_typing(self):
self.pyscript_run(
"""
<py-inputbox label="my input">
import js
def on_keypress(evt):
if evt.key == "Enter":
js.console.log(evt.target.value)
</py-inputbox>
"""
)
assert self.console.log.lines == [self.PY_COMPLETE]
input = self.page.locator("input")
input.type("Hello")
input.press("Enter")
assert self.console.log.lines == [self.PY_COMPLETE, "Hello"]