mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Snapshot testing data table, checkbox interactions
This commit is contained in:
@@ -11,13 +11,13 @@ The example below populates a table with CSV data.
|
||||
|
||||
=== "Output"
|
||||
|
||||
```{.textual path="docs/examples/widgets/table.py"}
|
||||
```{.textual path="docs/examples/widgets/data_table.py"}
|
||||
```
|
||||
|
||||
=== "table.py"
|
||||
=== "data_table.py"
|
||||
|
||||
```python
|
||||
--8<-- "docs/examples/widgets/table.py"
|
||||
--8<-- "docs/examples/widgets/data_table.py"
|
||||
```
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -33,12 +33,27 @@ def test_dock_layout_sidebar(snap_compare):
|
||||
assert snap_compare("docs/examples/guide/layout/dock_layout2_sidebar.py")
|
||||
|
||||
|
||||
# --- Interacting with widgets ---
|
||||
# --- Widgets - rendering and basic interactions ---
|
||||
|
||||
# before snapshot test:
|
||||
# src/textual/widgets/_checkbox.py 47 47 0% 1-126
|
||||
# before testing presses in snapshot test:
|
||||
# src/textual/widgets/_checkbox.py 47 11 77% 83-88, 110, 113, 118, 124-126
|
||||
# after testing presses in snapshot test:
|
||||
# src/textual/widgets/_checkbox.py 47 2 96% 87, 110
|
||||
|
||||
def test_checkboxes(snap_compare):
|
||||
"""Tests checkboxes but also acts a regression test for using
|
||||
width: auto in a Horizontal layout context."""
|
||||
assert snap_compare("docs/examples/widgets/checkbox.py")
|
||||
press = [
|
||||
"shift+tab",
|
||||
"enter", # toggle off
|
||||
"shift+tab",
|
||||
"wait:20",
|
||||
"enter", # toggle on
|
||||
"wait:20",
|
||||
]
|
||||
assert snap_compare("docs/examples/widgets/checkbox.py", press=press)
|
||||
|
||||
|
||||
def test_input_and_focus(snap_compare):
|
||||
@@ -52,6 +67,12 @@ def test_buttons_render(snap_compare):
|
||||
assert snap_compare("docs/examples/widgets/button.py", press=["tab"])
|
||||
|
||||
|
||||
# src/textual/widgets/_data_table.py 312 312 0%
|
||||
# src/textual/widgets/_data_table.py 312 85 73%
|
||||
def test_datatable_render(snap_compare):
|
||||
assert snap_compare("docs/examples/widgets/data_table.py")
|
||||
|
||||
|
||||
# --- CSS properties ---
|
||||
# We have a canonical example for each CSS property that is shown in their docs.
|
||||
# If any of these change, something has likely broken, so snapshot each of them.
|
||||
|
||||
Reference in New Issue
Block a user