MCPcopy Index your code
hub / github.com/Textualize/textual / test_toggle_message

Function test_toggle_message

tests/test_collapsible.py:121–147  ·  view source on GitHub ↗

Toggling should post a message.

()

Source from the content-addressed store, hash-verified

119
120
121async def test_toggle_message():
122 """Toggling should post a message."""
123
124 hits = []
125
126 class CollapsibleApp(App[None]):
127 def compose(self) -> ComposeResult:
128 yield Collapsible(collapsed=True)
129
130 @on(Collapsible.Toggled)
131 def catch_collapsible_events(self) -> None:
132 hits.append("toggled")
133
134 async with CollapsibleApp().run_test() as pilot:
135 assert pilot.app.query_one(Collapsible).collapsed
136
137 await pilot.click(CollapsibleTitle)
138 await pilot.pause()
139
140 assert not pilot.app.query_one(Collapsible).collapsed
141 assert len(hits) == 1
142
143 await pilot.click(CollapsibleTitle)
144 await pilot.pause()
145
146 assert pilot.app.query_one(Collapsible).collapsed
147 assert len(hits) == 2
148
149
150async def test_expand_message():

Callers

nothing calls this directly

Calls 5

run_testMethod · 0.80
query_oneMethod · 0.80
clickMethod · 0.80
CollapsibleAppClass · 0.70
pauseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…