Files
pyscript/pyscriptjs/tests/integration/test_warnings_and_banners.py
Jeff Glass 470c3489dd Restore output attribute of py-script tags, add py-script exec lifecycle hooks (#1063)
* Add beforePyScriptExec, afterPyScriptExec lifecycle hooks

* Add stdiodirector plugin for `output`, `stderr` attributes of py-script tag

* Add docs on `output` and `stderr` attributes of py-script tag

* Tests

* Removed output deprecation warning for `output` attribute

* Add createSingularWarning(), with createDeprecationWarning as alias
2023-01-10 13:00:29 -06:00

29 lines
822 B
Python

from .support import PyScriptTest
class TestWarningsAndBanners(PyScriptTest):
# Test the behavior of generated warning banners
def test_create_singular_warning(self):
# Use a script tag with an invalid output attribute to generate a warning, but only one
self.pyscript_run(
"""
<py-script output="foo">
print("one.")
print("two.")
</py-script>
<py-script output="foo">
print("three.")
</py-script>
"""
)
loc = self.page.locator(".alert-banner")
# Only one banner should appear
assert loc.count() == 1
assert (
loc.text_content()
== 'output = "foo" does not match the id of any element on the page.'
)