Files
pyscript/pyscript.core/tests/integration/test_shadow_root.py
Fabio Pliger f77241e977 next integration tests (#1712)
* move integration tests pyscriptjs/tests/integration ->pyscript.core/tests/integration

* add information in regards to how to run integration tests to README

* fix fake server build paths

* fix paths to build and run tests. The change of path before integration tests is a glitch maybe due to pytest cache?

* remove test files created by mistake

* update readme with latest changes

---------

Co-authored-by: Fabio Pliger <fpliger@anaconda.com>
2023-09-15 14:09:07 -07:00

34 lines
1.2 KiB
Python

import pytest
from .support import PyScriptTest
class TestShadowRoot(PyScriptTest):
# @skip_worker("FIXME: js.document")
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
def test_reachable_shadow_root(self):
self.pyscript_run(
r"""
<script>
// reason to wait for py-script is that it's the entry point for
// all patches and the MutationObserver, otherwise being this a synchronous
// script the constructor gets instantly invoked at the node before
// py-script gets a chance to initialize itself.
customElements.whenDefined('py-script').then(() => {
customElements.define('s-r', class extends HTMLElement {
constructor() {
super().attachShadow({mode: 'closed'}).innerHTML =
'<div id="shadowed">OK</div>';
}
});
});
</script>
<s-r></s-r>
<py-script>
import js
js.console.log(Element("shadowed").innerHtml)
</py-script>
"""
)
assert self.console.log.lines[-1] == "OK"