mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-23 04:03:00 -05:00
* bring Makefile to root folder * add back the print to console when pyscript is ready * fix build path on tests, link to core.js and overall timeout since it now loads faster * fix and mark some tests accordingly * change default timeout to 20s * review tests and skip what is a known regression * more tests review until pycondif and skip what is a known regression * fix pyodide version used on tests * remove display from config test since it's not testing anything more than console already tests and display as its own tests * disable config tests that rely on the banner * skip REPL tests since it's not included in pyscript NEXT * skip PyTerminal tests since it's not included in pyscript NEXT * skip more tests relying on Element * Fix wrong script type from py-script to py * review more tests related to attributes and add test for worker * skip spashscreen tests * wrap up reviews on remaining tests * update core * update display tests to use import * fix more tests and skip some that have known issues * skip other 2 tests that fail because the test framework injects values that cause the config to fail * fix getPySrc test due to changed interface * another round of fixes and commenting on specific tests --------- Co-authored-by: Fabio Pliger <fpliger@anaconda.com>
65 lines
2.1 KiB
Python
65 lines
2.1 KiB
Python
import pytest
|
|
|
|
from .support import PyScriptTest
|
|
|
|
|
|
class TestPyScriptRuntimeAttributes(PyScriptTest):
|
|
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
|
|
def test_injected_html_with_py_event(self):
|
|
self.pyscript_run(
|
|
r"""
|
|
<div id="py-button-container"></div>
|
|
<py-script>
|
|
import js
|
|
|
|
py_button = Element("py-button-container")
|
|
py_button.element.innerHTML = '<button py-click="print_hello()"></button>'
|
|
|
|
def print_hello():
|
|
js.console.log("hello pyscript")
|
|
</py-script>
|
|
"""
|
|
)
|
|
self.page.locator("button").click()
|
|
assert self.console.log.lines == ["hello pyscript"]
|
|
|
|
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
|
|
def test_added_py_event(self):
|
|
self.pyscript_run(
|
|
r"""
|
|
<button id="py-button"></button>
|
|
<py-script>
|
|
import js
|
|
|
|
py_button = Element("py-button")
|
|
py_button.element.setAttribute("py-click", "print_hello()")
|
|
|
|
def print_hello():
|
|
js.console.log("hello pyscript")
|
|
</py-script>
|
|
"""
|
|
)
|
|
self.page.locator("button").click()
|
|
assert self.console.log.lines == ["hello pyscript"]
|
|
|
|
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
|
|
def test_added_then_removed_py_event(self):
|
|
self.pyscript_run(
|
|
r"""
|
|
<button id="py-button">live content</button>
|
|
<py-script>
|
|
import js
|
|
|
|
py_button = Element("py-button")
|
|
py_button.element.setAttribute("py-click", "print_hello()")
|
|
|
|
def print_hello():
|
|
js.console.log("hello pyscript")
|
|
py_button.element.removeAttribute("py-click")
|
|
</py-script>
|
|
"""
|
|
)
|
|
self.page.locator("button").click()
|
|
self.page.locator("button").click()
|
|
assert self.console.log.lines == ["hello pyscript"]
|