mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Fix data-table snapshot
This commit is contained in:
@@ -2,7 +2,7 @@ import csv
|
|||||||
import io
|
import io
|
||||||
|
|
||||||
from textual.app import App, ComposeResult
|
from textual.app import App, ComposeResult
|
||||||
from textual.widgets import DataTable, Header
|
from textual.widgets import DataTable
|
||||||
|
|
||||||
CSV = """lane,swimmer,country,time
|
CSV = """lane,swimmer,country,time
|
||||||
4,Joseph Schooling,Singapore,50.39
|
4,Joseph Schooling,Singapore,50.39
|
||||||
@@ -17,7 +17,6 @@ CSV = """lane,swimmer,country,time
|
|||||||
|
|
||||||
class TableApp(App):
|
class TableApp(App):
|
||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
yield Header()
|
|
||||||
yield DataTable()
|
yield DataTable()
|
||||||
|
|
||||||
def on_mount(self) -> None:
|
def on_mount(self) -> None:
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ from pathlib import Path
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# --- Layout related stuff ---
|
from textual.app import App
|
||||||
from textual.widgets import Input
|
from textual.widgets import Input
|
||||||
|
|
||||||
|
|
||||||
|
# --- Layout related stuff ---
|
||||||
|
|
||||||
def test_grid_layout_basic(snap_compare):
|
def test_grid_layout_basic(snap_compare):
|
||||||
assert snap_compare("docs/examples/guide/layout/grid_layout1.py")
|
assert snap_compare("docs/examples/guide/layout/grid_layout1.py")
|
||||||
|
|
||||||
@@ -63,7 +65,8 @@ def test_input_and_focus(snap_compare):
|
|||||||
assert snap_compare("docs/examples/widgets/input.py", press=press)
|
assert snap_compare("docs/examples/widgets/input.py", press=press)
|
||||||
|
|
||||||
# Assert that the state of the Input is what we'd expect
|
# Assert that the state of the Input is what we'd expect
|
||||||
input: Input = snap_compare.app.query_one(Input)
|
app: App = snap_compare.app
|
||||||
|
input: Input = app.query_one(Input)
|
||||||
assert input.value == "Darren"
|
assert input.value == "Darren"
|
||||||
assert input.cursor_position == 6
|
assert input.cursor_position == 6
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user