mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 10:47:35 -05:00
Deprecate py-button, py-inputbox, py-box and py-title (#931)
This commit is contained in:
@@ -16,3 +16,44 @@ class TestPyButton(PyScriptTest):
|
||||
self.page.locator("text=my button").click()
|
||||
self.page.locator("text=my button").click()
|
||||
assert self.console.log.lines == [self.PY_COMPLETE, "clicked!", "clicked!"]
|
||||
|
||||
def test_deprecated_element(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
<py-button label="my button">
|
||||
import js
|
||||
def on_click(evt):
|
||||
js.console.log('clicked!')
|
||||
</py-button>
|
||||
"""
|
||||
)
|
||||
banner = self.page.locator(".py-warning")
|
||||
banner_content = banner.inner_text()
|
||||
expected = (
|
||||
"The element <py-button> is deprecated, create a function with your "
|
||||
'inline code and use <button py-click="function()" class="py-button"> instead.'
|
||||
)
|
||||
|
||||
assert banner_content == expected
|
||||
|
||||
def test_creates_single_deprecation_banner(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
<py-button label="my button">
|
||||
import js
|
||||
def on_click(evt):
|
||||
js.console.log('clicked!')
|
||||
</py-button>
|
||||
<py-button label="another button!">
|
||||
</py-button>
|
||||
"""
|
||||
)
|
||||
banner = self.page.query_selector_all(".py-warning")
|
||||
assert len(banner) == 1
|
||||
banner_content = banner[0].inner_text()
|
||||
expected = (
|
||||
"The element <py-button> is deprecated, create a function with your "
|
||||
'inline code and use <button py-click="function()" class="py-button"> instead.'
|
||||
)
|
||||
|
||||
assert banner_content == expected
|
||||
|
||||
Reference in New Issue
Block a user