Skip to content

Commit d6ef1c0

Browse files
committed
Renaming App.search to App.search_commands
1 parent 6978f80 commit d6ef1c0

File tree

5 files changed

+166
-8
lines changed

5 files changed

+166
-8
lines changed

examples/theme_sandbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def action_invalid_theme(self) -> None:
302302
self.theme = "not-a-theme"
303303

304304
def action_widget_search(self) -> None:
305-
self.search(
305+
self.search_commands(
306306
[
307307
(
308308
widget.__class__.__name__,

src/textual/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,7 @@ def deliver_screenshot(
16621662
name="screenshot",
16631663
)
16641664

1665-
def search(
1665+
def search_commands(
16661666
self,
16671667
commands: Sequence[CommandListItem],
16681668
placeholder: str = "Search for commands…",
@@ -1671,6 +1671,7 @@ def search(
16711671
16721672
Args:
16731673
commands: A list of SimpleCommand instances.
1674+
placeholder: Placeholder text for the search field.
16741675
16751676
Returns:
16761677
AwaitMount: An awaitable that resolves when the commands are shown.
Lines changed: 157 additions & 0 deletions
Loading

tests/snapshot_tests/test_snapshots.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,8 +2511,8 @@ def on_mount(self) -> None:
25112511
assert snap_compare(ThemeApp())
25122512

25132513

2514-
def test_app_search_opens_and_displays_search_list(snap_compare):
2515-
"""Test the App.search method for displaying a list of commands."""
2514+
def test_app_search_commands_opens_and_displays_search_list(snap_compare):
2515+
"""Test the App.search_commands method for displaying a list of commands."""
25162516

25172517
class SearchApp(App[None]):
25182518
def compose(self) -> ComposeResult:
@@ -2523,7 +2523,7 @@ def callback():
25232523
"""Dummy no-op callback."""
25242524

25252525
commands = [("foo", callback), ("bar", callback), ("baz", callback)]
2526-
await self.search(commands)
2526+
await self.search_commands(commands)
25272527

25282528
async def run_before(pilot: Pilot) -> None:
25292529
await pilot.press("b")

tests/test_app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def callback():
195195
SimpleCommand("Another Command", callback, "Another test command"),
196196
]
197197
async with app.run_test() as pilot:
198-
await app.search(commands)
198+
await app.search_commands(commands)
199199
await pilot.press("enter", "enter")
200200
assert called
201201

@@ -216,7 +216,7 @@ def callback():
216216
("Another Command", callback),
217217
]
218218
async with app.run_test() as pilot:
219-
await app.search(commands)
219+
await app.search_commands(commands)
220220
await pilot.press("enter", "enter")
221221
assert called
222222

@@ -225,5 +225,5 @@ async def test_search_with_empty_list():
225225
"""Test search with an empty command list doesn't crash."""
226226
app = App[None]()
227227
async with app.run_test() as pilot:
228-
await app.search([])
228+
await app.search_commands([])
229229
await pilot.press("escape")

0 commit comments

Comments
 (0)