Skip to content

Visual Studio Code, rebuilt in Rust

Rust

test(debug): cover the Debug Console title's Find before Clear Console

rokarturfa41bbfa19de
diff --git a/native/crates/app/src/workbench/debug_console.rs b/native/crates/app/src/workbench/debug_console.rs
index 3bba53e6c63..4ba4ad76ea4 100644
--- a/native/crates/app/src/workbench/debug_console.rs
+++ b/native/crates/app/src/workbench/debug_console.rs
@@ -93,9 +93,9 @@ impl Workbench {
.flex()
.items_center()
.when(workbench.view_filter_in_header(REPL_VIEW_ID), |actions| actions.child(workbench.debug_console_filter_box(window, cx)))
- .child(workbench.action_bar_item(REPL_VIEW_ID, "find", find, cx))
+ .child(workbench.action_bar_item(REPL_VIEW_ID, "find", find, cx).debug_selector(|| "repl-title-find".into()))
.when(workbench.repl_sessions().len() > 1, |actions| actions.child(workbench.action_bar_item(REPL_VIEW_ID, "session", workbench.repl_session_select(cx), cx)))
- .child(workbench.action_bar_item(REPL_VIEW_ID, "clear", clear, cx))
+ .child(workbench.action_bar_item(REPL_VIEW_ID, "clear", clear, cx).debug_selector(|| "repl-title-clear".into()))
.into_any_element()
},
visible: |_| true,
@@ -679,6 +679,17 @@ mod tests {
});
}
+ /// repl.ts `FindReplAction`: `search` in the view title's navigation group (order 15), before Clear Console.
+ #[gpui::test]
+ fn the_title_shows_find_before_clear_console(cx: &mut TestAppContext) {
+ let (workbench, cx) = workbench(cx);
+ workbench.update_in(cx, |workbench, window, cx| workbench.open_debug_console(true, window, cx));
+ cx.run_until_parked();
+ let find = cx.debug_bounds("repl-title-find").expect("the title draws Find");
+ let clear = cx.debug_bounds("repl-title-clear").expect("the title draws Clear Console");
+ assert!(find.right() <= clear.left() && find.top() == clear.top(), "{find:?} before {clear:?}");
+ }
+
#[gpui::test]
fn the_find_widget_filters_the_console_and_says_when_nothing_matches(cx: &mut TestAppContext) {
let (workbench, cx) = workbench(cx);