uncomment and augment mouse_context_menu tests

This commit is contained in:
Piotr Osiewicz 2023-12-04 15:06:56 +01:00
parent 3b1a0652ae
commit ff734d494f

View file

@ -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()));
}
}