mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix binding inheritance issues
This commit is contained in:
@@ -39,8 +39,10 @@ class NoBindings(App[None]):
|
||||
async def test_just_app_no_bindings() -> None:
|
||||
"""An app with no bindings should have no bindings, other than ctrl+c."""
|
||||
async with NoBindings().run_test() as pilot:
|
||||
assert list(pilot.app._bindings.keys.keys()) == ["ctrl+c"]
|
||||
assert list(pilot.app._bindings.keys.keys()) == ["ctrl+c", "tab", "shift+tab"]
|
||||
assert pilot.app._bindings.get_key("ctrl+c").priority is True
|
||||
assert pilot.app._bindings.get_key("tab").priority is False
|
||||
assert pilot.app._bindings.get_key("shift+tab").priority is False
|
||||
|
||||
|
||||
##############################################################################
|
||||
@@ -61,7 +63,9 @@ class AlphaBinding(App[None]):
|
||||
async def test_just_app_alpha_binding() -> None:
|
||||
"""An app with a single binding should have just the one binding."""
|
||||
async with AlphaBinding().run_test() as pilot:
|
||||
assert sorted(pilot.app._bindings.keys.keys()) == sorted(["ctrl+c", "a"])
|
||||
assert sorted(pilot.app._bindings.keys.keys()) == sorted(
|
||||
["ctrl+c", "tab", "shift+tab", "a"]
|
||||
)
|
||||
assert pilot.app._bindings.get_key("ctrl+c").priority is True
|
||||
assert pilot.app._bindings.get_key("a").priority is True
|
||||
|
||||
@@ -84,7 +88,9 @@ class LowAlphaBinding(App[None]):
|
||||
async def test_just_app_low_priority_alpha_binding() -> None:
|
||||
"""An app with a single low-priority binding should have just the one binding."""
|
||||
async with LowAlphaBinding().run_test() as pilot:
|
||||
assert sorted(pilot.app._bindings.keys.keys()) == sorted(["ctrl+c", "a"])
|
||||
assert sorted(pilot.app._bindings.keys.keys()) == sorted(
|
||||
["ctrl+c", "tab", "shift+tab", "a"]
|
||||
)
|
||||
assert pilot.app._bindings.get_key("ctrl+c").priority is True
|
||||
assert pilot.app._bindings.get_key("a").priority is False
|
||||
|
||||
@@ -574,6 +580,7 @@ class PriorityOverlapScreen(Screen):
|
||||
def on_mount(self) -> None:
|
||||
self.query_one(PriorityOverlapWidget).focus()
|
||||
|
||||
|
||||
class PriorityOverlapApp(AppKeyRecorder):
|
||||
"""An application with a priority binding."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user