@@ -137,13 +137,12 @@ def compose(self) -> ComposeResult:
137137
138138async def test_tabbed_content_messages ():
139139 class TabbedApp (App ):
140- message = None
140+ activation_history : list [ Tab ] = []
141141
142142 def compose (self ) -> ComposeResult :
143- with TabbedContent (initial = "bar" ):
143+ with TabbedContent ():
144144 with TabPane ("foo" , id = "foo" ):
145145 yield Label ("Foo" , id = "foo-label" )
146-
147146 with TabPane ("bar" , id = "bar" ):
148147 yield Label ("Bar" , id = "bar-label" )
149148 with TabPane ("baz" , id = "baz" ):
@@ -152,15 +151,19 @@ def compose(self) -> ComposeResult:
152151 def on_tabbed_content_tab_activated (
153152 self , event : TabbedContent .TabActivated
154153 ) -> None :
155- self .message = event
154+ self .activation_history . append ( event . tab )
156155
157156 app = TabbedApp ()
158157 async with app .run_test () as pilot :
159158 tabbed_content = app .query_one (TabbedContent )
160159 tabbed_content .active = "bar"
161160 await pilot .pause ()
162- assert isinstance (app .message , TabbedContent .TabActivated )
163- assert app .message .tab .label .plain == "bar"
161+ assert app .activation_history == [
162+ # foo was originally activated.
163+ app .query_one (TabbedContent ).get_tab ("foo" ),
164+ # then we did bar "by hand"
165+ app .query_one (TabbedContent ).get_tab ("bar" ),
166+ ]
164167
165168
166169async def test_tabbed_content_add_later_from_empty ():
0 commit comments