Track focus on TestItem

This commit is contained in:
Julia
2023-12-14 20:58:59 -05:00
parent bbbdb9ff3e
commit fbcaf96ab5
2 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -1671,7 +1671,7 @@ mod tests {
path::{Path, PathBuf}, path::{Path, PathBuf},
sync::atomic::{self, AtomicUsize}, sync::atomic::{self, AtomicUsize},
}; };
use workspace::{dock::PanelHandle, AppState}; use workspace::AppState;
#[gpui::test] #[gpui::test]
async fn test_visible_list(cx: &mut gpui::TestAppContext) { async fn test_visible_list(cx: &mut gpui::TestAppContext) {
+5 -4
View File
@@ -760,8 +760,9 @@ pub mod test {
use super::{Item, ItemEvent}; use super::{Item, ItemEvent};
use crate::{ItemId, ItemNavHistory, Pane, Workspace, WorkspaceId}; use crate::{ItemId, ItemNavHistory, Pane, Workspace, WorkspaceId};
use gpui::{ use gpui::{
AnyElement, AppContext, Context as _, Div, EntityId, EventEmitter, FocusableView, AnyElement, AppContext, Context as _, Div, EntityId, EventEmitter, Focusable,
IntoElement, Model, Render, SharedString, Task, View, ViewContext, VisualContext, WeakView, FocusableView, InteractiveElement, IntoElement, Model, Render, SharedString, Task, View,
ViewContext, VisualContext, WeakView,
}; };
use project::{Project, ProjectEntryId, ProjectPath, WorktreeId}; use project::{Project, ProjectEntryId, ProjectPath, WorktreeId};
use std::{any::Any, cell::Cell, path::Path}; use std::{any::Any, cell::Cell, path::Path};
@@ -909,10 +910,10 @@ pub mod test {
} }
impl Render for TestItem { impl Render for TestItem {
type Element = Div; type Element = Focusable<Div>;
fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element { fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
gpui::div() gpui::div().track_focus(&self.focus_handle)
} }
} }