mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix for visiblity
This commit is contained in:
File diff suppressed because one or more lines are too long
34
tests/snapshot_tests/snapshot_apps/vis.html
Normal file
34
tests/snapshot_tests/snapshot_apps/vis.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
#outer {
|
||||
visibility: visible;
|
||||
background: red;
|
||||
}
|
||||
|
||||
#inner {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
<div id="outer">
|
||||
<div>
|
||||
<div id="inner">
|
||||
Hello, World
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</html>
|
||||
48
tests/snapshot_tests/snapshot_apps/visibility.py
Normal file
48
tests/snapshot_tests/snapshot_apps/visibility.py
Normal file
@@ -0,0 +1,48 @@
|
||||
from textual.app import App
|
||||
from textual.containers import Vertical
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
class Visibility(App):
|
||||
"""Check that visibility: hidden also makes children invisible;"""
|
||||
|
||||
CSS = """
|
||||
Screen {
|
||||
layout: horizontal;
|
||||
}
|
||||
Vertical {
|
||||
width: 1fr;
|
||||
border: solid red;
|
||||
}
|
||||
|
||||
#container1 {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.float {
|
||||
border: solid blue;
|
||||
}
|
||||
|
||||
/* Make a child of a hidden widget visible again */
|
||||
#container1 .float {
|
||||
visibility: visible;
|
||||
}
|
||||
"""
|
||||
|
||||
def compose(self):
|
||||
|
||||
yield Vertical(
|
||||
Static("foo"),
|
||||
Static("float", classes="float"),
|
||||
id="container1",
|
||||
)
|
||||
yield Vertical(
|
||||
Static("bar"),
|
||||
Static("float", classes="float"),
|
||||
id="container2",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = Visibility()
|
||||
app.run()
|
||||
@@ -100,6 +100,10 @@ def test_fr_units(snap_compare):
|
||||
assert snap_compare("snapshot_apps/fr_units.py")
|
||||
|
||||
|
||||
def test_visibility(snap_compare):
|
||||
assert snap_compare("snapshot_apps/visibility.py")
|
||||
|
||||
|
||||
def test_tree_example(snap_compare):
|
||||
assert snap_compare(WIDGET_EXAMPLES_DIR / "tree.py")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user