@@ -1025,6 +1025,67 @@ public void AuthoringToolsChrome_ProjectsStockSelectionLayoutActions()
10251025 Assert . Equal ( new GraphPoint ( 520 , 180 ) , nodes [ "tests.view.target-001" ] . Position ) ;
10261026 }
10271027
1028+ [ AvaloniaFact ]
1029+ public void HostedCommandSurface_RefreshesAfterLayoutPlanApply ( )
1030+ {
1031+ var editor = CreateSelectionEditor ( ) ;
1032+ var window = CreateWindow ( new GraphEditorView
1033+ {
1034+ Editor = editor ,
1035+ } ) ;
1036+ var view = ( GraphEditorView ) window . Content ! ;
1037+ var undoButton = FindRequiredDescendant < Button > ( view , "PART_HeaderCommand_history.undo" ) ;
1038+
1039+ Assert . False ( undoButton . IsEnabled ) ;
1040+
1041+ var applied = editor . Session . Commands . TryApplyLayoutPlan (
1042+ new GraphLayoutPlan (
1043+ true ,
1044+ new GraphLayoutRequest { Mode = GraphLayoutRequestMode . All } ,
1045+ [
1046+ new GraphLayoutNodePosition ( "tests.view.source-001" , new GraphPoint ( 180 , 120 ) ) ,
1047+ new GraphLayoutNodePosition ( "tests.view.target-001" , new GraphPoint ( 560 , 120 ) ) ,
1048+ ] ) ,
1049+ updateStatus : false ) ;
1050+ Dispatcher . UIThread . RunJobs ( DispatcherPriority . Render ) ;
1051+
1052+ undoButton = FindRequiredDescendant < Button > ( view , "PART_HeaderCommand_history.undo" ) ;
1053+ Assert . True ( applied ) ;
1054+ Assert . True ( undoButton . IsEnabled ) ;
1055+ Assert . Equal ( "Undo" , AutomationProperties . GetName ( undoButton ) ) ;
1056+ }
1057+
1058+ [ AvaloniaFact ]
1059+ public void HostedCommandSurface_RefreshesAfterPendingConnectionStartAndCancel ( )
1060+ {
1061+ var editor = CreateConnectionToolEditor ( ) ;
1062+ var window = CreateWindow ( new GraphEditorView
1063+ {
1064+ Editor = editor ,
1065+ } ) ;
1066+ var view = ( GraphEditorView ) window . Content ! ;
1067+ var paletteToggle = FindRequiredControl < Button > ( view , "PART_OpenCommandPaletteButton" ) ;
1068+
1069+ paletteToggle . RaiseEvent ( new RoutedEventArgs ( Button . ClickEvent ) ) ;
1070+ Dispatcher . UIThread . RunJobs ( DispatcherPriority . Render ) ;
1071+
1072+ var cancelPending = FindRequiredDescendant < Button > ( view , "PART_CommandPaletteAction_connections.cancel" ) ;
1073+ Assert . False ( cancelPending . IsEnabled ) ;
1074+
1075+ editor . Session . Commands . StartConnection ( "tests.view.tools-source-001" , "out" ) ;
1076+ Dispatcher . UIThread . RunJobs ( DispatcherPriority . Render ) ;
1077+
1078+ cancelPending = FindRequiredDescendant < Button > ( view , "PART_CommandPaletteAction_connections.cancel" ) ;
1079+ Assert . True ( cancelPending . IsEnabled ) ;
1080+ Assert . Equal ( "Cancel Pending Connection" , AutomationProperties . GetName ( cancelPending ) ) ;
1081+
1082+ cancelPending . RaiseEvent ( new RoutedEventArgs ( Button . ClickEvent ) ) ;
1083+ Dispatcher . UIThread . RunJobs ( DispatcherPriority . Render ) ;
1084+
1085+ cancelPending = FindRequiredDescendant < Button > ( view , "PART_CommandPaletteAction_connections.cancel" ) ;
1086+ Assert . False ( cancelPending . IsEnabled ) ;
1087+ }
1088+
10281089 [ AvaloniaFact ]
10291090 public void CompositeWorkflowChrome_ProjectsBreadcrumbsAndScopeNavigation ( )
10301091 {
0 commit comments