Added toggle dock test

Mikayla Maki created

Change summary

crates/workspace/src/dock.rs | 15 +++++++++++++++
1 file changed, 15 insertions(+)

Detailed changes

crates/workspace/src/dock.rs 🔗

@@ -472,6 +472,17 @@ mod tests {
         cx.assert_workspace_pane_inactive();
     }
 
+    #[gpui::test]
+    async fn test_toggle_dock_focus(cx: &mut TestAppContext) {
+        let cx = DockTestContext::new(cx).await;
+
+        cx.move_dock(DockAnchor::Right);
+        cx.assert_dock_pane_active();
+        cx.toggle_dock();
+        cx.move_dock(DockAnchor::Right);
+        cx.assert_dock_pane_active();
+    }
+
     struct DockTestContext<'a> {
         pub cx: &'a mut TestAppContext,
         pub window_id: usize,
@@ -589,6 +600,10 @@ mod tests {
             self.cx.dispatch_action(self.window_id, MoveDock(anchor));
         }
 
+        pub fn toggle_dock(&self) {
+            self.cx.dispatch_action(self.window_id, ToggleDock);
+        }
+
         pub fn open_sidebar(&mut self, sidebar_side: SidebarSide) {
             if !self.sidebar(sidebar_side, |sidebar, _| sidebar.is_open()) {
                 self.update_workspace(|workspace, cx| workspace.toggle_sidebar(sidebar_side, cx));