Track focus on TestItem

Julia created

Change summary

crates/project_panel2/src/project_panel.rs | 2 +-
crates/workspace2/src/item.rs              | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)

Detailed changes

crates/project_panel2/src/project_panel.rs 🔗

@@ -1671,7 +1671,7 @@ mod tests {
         path::{Path, PathBuf},
         sync::atomic::{self, AtomicUsize},
     };
-    use workspace::{dock::PanelHandle, AppState};
+    use workspace::AppState;
 
     #[gpui::test]
     async fn test_visible_list(cx: &mut gpui::TestAppContext) {

crates/workspace2/src/item.rs 🔗

@@ -760,8 +760,9 @@ pub mod test {
     use super::{Item, ItemEvent};
     use crate::{ItemId, ItemNavHistory, Pane, Workspace, WorkspaceId};
     use gpui::{
-        AnyElement, AppContext, Context as _, Div, EntityId, EventEmitter, FocusableView,
-        IntoElement, Model, Render, SharedString, Task, View, ViewContext, VisualContext, WeakView,
+        AnyElement, AppContext, Context as _, Div, EntityId, EventEmitter, Focusable,
+        FocusableView, InteractiveElement, IntoElement, Model, Render, SharedString, Task, View,
+        ViewContext, VisualContext, WeakView,
     };
     use project::{Project, ProjectEntryId, ProjectPath, WorktreeId};
     use std::{any::Any, cell::Cell, path::Path};
@@ -909,10 +910,10 @@ pub mod test {
     }
 
     impl Render for TestItem {
-        type Element = Div;
+        type Element = Focusable<Div>;
 
         fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
-            gpui::div()
+            gpui::div().track_focus(&self.focus_handle)
         }
     }