From 002cbab0d5baac409bbd499cf25bfc7a7459ef74 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Mon, 19 Dec 2022 11:26:42 +0000 Subject: [PATCH] add pause to action --- docs/guide/actions.md | 4 ++-- tests/snapshot_tests/test_snapshots.py | 2 +- tests/test_binding_inheritance.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/guide/actions.md b/docs/guide/actions.md index f48a47a1d..063986069 100644 --- a/docs/guide/actions.md +++ b/docs/guide/actions.md @@ -75,7 +75,7 @@ When you click any of the links, Textual runs the `"set_background"` action to c ## Bindings -Textual will also run actions bound to keys. The following example adds key [bindings](./input.md#bindings) for the ++r++, ++g++, and ++b++ keys which call the `"set_background"` action. +Textual will run actions bound to keys. The following example adds key [bindings](./input.md#bindings) for the ++r++, ++g++, and ++b++ keys which call the `"set_background"` action. === "actions04.py" @@ -92,7 +92,7 @@ If you run this example, you can change the background by pressing keys in addit ## Namespaces -Textual will look for action methods on the widget or app where they are used. If we were to create a [custom widget](./widgets.md#custom-widgets) it can have its own set of actions. +Textual will look for action methods in the class where they are defined (App, Screen, or Widget). If we were to create a [custom widget](./widgets.md#custom-widgets) it can have its own set of actions. The following example defines a custom widget with its own `set_background` action. diff --git a/tests/snapshot_tests/test_snapshots.py b/tests/snapshot_tests/test_snapshots.py index d4c9980cf..b6cfa1fac 100644 --- a/tests/snapshot_tests/test_snapshots.py +++ b/tests/snapshot_tests/test_snapshots.py @@ -173,6 +173,6 @@ def test_demo(snap_compare): """Test the demo app (python -m textual)""" assert snap_compare( Path("../../src/textual/demo.py"), - press=["down", "down", "down"], + press=["down", "down", "down", "_"], terminal_size=(100, 30), ) diff --git a/tests/test_binding_inheritance.py b/tests/test_binding_inheritance.py index f87cf5f66..8f7029e35 100644 --- a/tests/test_binding_inheritance.py +++ b/tests/test_binding_inheritance.py @@ -640,7 +640,7 @@ async def test_skip_action() -> None: # Check the NoHandle widget has focus assert pilot.app.query_one(NoHandle).has_focus # Press the "t" key - await pilot.press("t", "_") + await pilot.press("t") # Check the action on the no handle widget was called assert no_handle_invoked # Check the return value, confirming that the action on Handle was called