pys-onClick shouldn't prevent splashscreen from closing (#1069)

This commit is contained in:
Fábio Rosado
2022-12-30 12:34:27 +00:00
committed by GitHub
parent 95783bc284
commit 35b0f9d377
2 changed files with 34 additions and 8 deletions

View File

@@ -78,3 +78,22 @@ class TestSplashscreen(PyScriptTest):
expect(div).to_contain_text("Startup complete")
assert self.console.log.lines[0] == self.PY_COMPLETE
assert "hello pyscript" in self.console.log.lines
def test_splashscreen_closes_on_error_with_pys_onClick(self):
self.pyscript_run(
"""
<button id="submit-button" type="submit" pys-onClick="myFunc">OK</button>
<py-script>
from js import console
def myFunc(*args, **kwargs):
text = Element('test-input').element.value
Element('test-output').element.innerText = text
</py-script>
""",
)
assert self.page.locator("py-splashscreen").count() == 0
assert "Python exception" in self.console.error.text