Remove deprecated elements and adds deprecation banner to pys-on (#1084)

* Show deprecation banner

* Add test for deprecation warning

* Remove deprecated elements

* Add entry in changelog

* Update test_style

* Remove random color rule

* Add PR link to changelog
This commit is contained in:
Fábio Rosado
2023-01-03 13:14:20 +00:00
committed by GitHub
parent 5c67384fbf
commit dbdcd0b3d0
18 changed files with 30 additions and 663 deletions

View File

@@ -292,3 +292,22 @@ class TestBasic(PyScriptTest):
pyscript_tag.evaluate("node => node.getPySrc()")
== 'print("hello world!")\n'
)
def test_pys_onClick_shows_deprecation_warning(self):
self.pyscript_run(
"""
<button id="1" pys-onClick="myfunc()">Click me</button>
<py-script>
def myfunc():
print("hello world")
</py-script>
"""
)
banner = self.page.locator(".alert-banner")
expected_message = (
"The attribute 'pys-onClick' and 'pys-onKeyDown' are "
"deprecated. Please 'py-click=\"myFunction()\"' or "
"'py-keydown=\"myFunction()\"' instead."
)
assert banner.inner_text() == expected_message