Files
pyscript/pyscriptjs/tests/integration/test_style.py
Fábio Rosado dbdcd0b3d0 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
2023-01-03 13:14:20 +00:00

41 lines
1.3 KiB
Python

from playwright.sync_api import expect
from .support import PyScriptTest
class TestStyle(PyScriptTest):
def test_pyscript_not_defined(self):
"""Test raw elements that are not defined for display:none"""
doc = """
<html>
<head>
<link rel="stylesheet" href="build/pyscript.css" />
</head>
<body>
<py-config>hello</py-config>
<py-script>hello</py-script>
<py-repl>hello</py-repl>
</body>
</html>
"""
self.writefile("test-not-defined-css.html", doc)
self.goto("test-not-defined-css.html")
expect(self.page.locator("py-config")).to_be_hidden()
expect(self.page.locator("py-script")).to_be_hidden()
expect(self.page.locator("py-repl")).to_be_hidden()
def test_pyscript_defined(self):
"""Test elements have visibility that should"""
self.pyscript_run(
"""
<py-config>
name = "foo"
</py-config>
<py-script>display("hello")</py-script>
<py-repl>display("hello")</py-repl>
"""
)
expect(self.page.locator("py-config")).to_be_hidden()
expect(self.page.locator("py-script")).to_be_visible()
expect(self.page.locator("py-repl")).to_be_visible()