Fix element.select tests (#1457)

This commit is contained in:
Andrea Giammarchi
2023-05-09 13:12:29 +02:00
committed by GitHub
parent 6a27c6d9f2
commit a2dabee0e9

View File

@@ -137,12 +137,28 @@ class TestElement(PyScriptTest):
<py-script>
from pyscript import Element
el = Element("foo")
el.select("bar", from_content=True)
js.console.log(el.select("option").value)
</py-script>
"""
)
select = self.page.wait_for_selector("#foo")
assert select.inner_text() == "Bar"
assert self.console.log.lines[-1] == "bar"
@skip_worker("FIXME: js.document")
def test_element_select_content(self):
"""Test the element select"""
self.pyscript_run(
"""
<template id="foo">
<div>Bar</div>
</template>
<py-script>
from pyscript import Element
el = Element("foo")
js.console.log(el.select("div", from_content=True).innerHtml)
</py-script>
"""
)
assert self.console.log.lines[-1] == "Bar"
@skip_worker("FIXME: js.document")
def test_element_clone_no_id(self):