diff --git a/crates/editor2/src/mouse_context_menu.rs b/crates/editor2/src/mouse_context_menu.rs index fdeec9110b..ba989ab011 100644 --- a/crates/editor2/src/mouse_context_menu.rs +++ b/crates/editor2/src/mouse_context_menu.rs @@ -69,42 +69,43 @@ pub fn deploy_context_menu( cx.notify(); } -// #[cfg(test)] -// mod tests { -// use super::*; -// use crate::{editor_tests::init_test, test::editor_lsp_test_context::EditorLspTestContext}; -// use indoc::indoc; +#[cfg(test)] +mod tests { + use super::*; + use crate::{editor_tests::init_test, test::editor_lsp_test_context::EditorLspTestContext}; + use indoc::indoc; -// #[gpui::test] -// async fn test_mouse_context_menu(cx: &mut gpui::TestAppContext) { -// init_test(cx, |_| {}); + #[gpui::test] + async fn test_mouse_context_menu(cx: &mut gpui::TestAppContext) { + init_test(cx, |_| {}); -// let mut cx = EditorLspTestContext::new_rust( -// lsp::ServerCapabilities { -// hover_provider: Some(lsp::HoverProviderCapability::Simple(true)), -// ..Default::default() -// }, -// cx, -// ) -// .await; + let mut cx = EditorLspTestContext::new_rust( + lsp::ServerCapabilities { + hover_provider: Some(lsp::HoverProviderCapability::Simple(true)), + ..Default::default() + }, + cx, + ) + .await; -// cx.set_state(indoc! {" -// fn teˇst() { -// do_work(); -// } -// "}); -// let point = cx.display_point(indoc! {" -// fn test() { -// do_wˇork(); -// } -// "}); -// cx.update_editor(|editor, cx| deploy_context_menu(editor, Default::default(), point, cx)); + cx.set_state(indoc! {" + fn teˇst() { + do_work(); + } + "}); + let point = cx.display_point(indoc! {" + fn test() { + do_wˇork(); + } + "}); + cx.editor(|editor, app| assert!(editor.mouse_context_menu.is_none())); + cx.update_editor(|editor, cx| deploy_context_menu(editor, Default::default(), point, cx)); -// cx.assert_editor_state(indoc! {" -// fn test() { -// do_wˇork(); -// } -// "}); -// cx.editor(|editor, app| assert!(editor.mouse_context_menu.read(app).visible())); -// } -// } + cx.assert_editor_state(indoc! {" + fn test() { + do_wˇork(); + } + "}); + cx.editor(|editor, app| assert!(editor.mouse_context_menu.is_some())); + } +}