Event dispatch moved to MutableAppContext. No longer dispatches from presenter. Not currently handling key presses properly

This commit is contained in:
K Simmons 2022-08-04 20:55:10 -07:00
parent c303c4e8f9
commit 4271eb3624
14 changed files with 392 additions and 336 deletions

View file

@ -600,7 +600,7 @@ impl BufferSearchBar {
mod tests {
use super::*;
use editor::{DisplayPoint, Editor};
use gpui::{color::Color, TestAppContext};
use gpui::{color::Color, test::EmptyView, TestAppContext};
use language::Buffer;
use std::sync::Arc;
use unindent::Unindent as _;
@ -629,11 +629,13 @@ mod tests {
cx,
)
});
let editor = cx.add_view(Default::default(), |cx| {
let (_, root_view) = cx.add_window(|_| EmptyView);
let editor = cx.add_view(&root_view, |cx| {
Editor::for_buffer(buffer.clone(), None, cx)
});
let search_bar = cx.add_view(Default::default(), |cx| {
let search_bar = cx.add_view(&root_view, |cx| {
let mut search_bar = BufferSearchBar::new(cx);
search_bar.set_active_pane_item(Some(&editor), cx);
search_bar.show(false, true, cx);

View file

@ -933,7 +933,8 @@ mod tests {
cx.update(|cx| {
let mut settings = Settings::test(cx);
settings.theme = Arc::new(theme);
cx.set_global(settings)
cx.set_global(settings);
cx.set_global(ActiveSearches::default());
});
let fs = FakeFs::new(cx.background());
@ -949,9 +950,7 @@ mod tests {
.await;
let project = Project::test(fs.clone(), ["/dir".as_ref()], cx).await;
let search = cx.add_model(|cx| ProjectSearch::new(project, cx));
let search_view = cx.add_view(Default::default(), |cx| {
ProjectSearchView::new(search.clone(), cx)
});
let (_, search_view) = cx.add_window(|cx| ProjectSearchView::new(search.clone(), cx));
search_view.update(cx, |search_view, cx| {
search_view