Skip to content

Visual Studio Code, rebuilt in Rust

Rust

test(webview): notify the workbench after setting a context key

rokartur7645ff4d04cd
diff --git a/native/crates/app/src/workbench/webview_views/tests.rs b/native/crates/app/src/workbench/webview_views/tests.rs
index 39728012dd6..75616086d61 100644
--- a/native/crates/app/src/workbench/webview_views/tests.rs
+++ b/native/crates/app/src/workbench/webview_views/tests.rs
@@ -48,7 +48,11 @@ fn a_webview_view_shows_in_its_own_container_while_its_when_holds(cx: &mut TestA
workbench.update_in(cx, |workbench, window, cx| drop(workbench.handle_webview_views_request("$registerWebviewViewProvider", &[json!({ "id": "test.views" }), json!("test.web"), json!({})], window, cx)));
assert_eq!(focus_view(cx), Vec::<Value>::new(), "a webview view whose when is false is not shown");
- workbench.update(cx, |workbench, _| drop(workbench.context_keys.insert("test.show".into(), json!(true))));
+ workbench.update(cx, |workbench, cx| {
+ drop(workbench.context_keys.insert("test.show".into(), json!(true)));
+ // As `_setContext` does: gpui-fast redraws only notified views.
+ cx.notify();
+ });
draw(cx);
assert_eq!(focus_view(cx), vec![json!("test.web")]);
assert!(workbench.read_with(cx, |workbench, _| workbench.view_pane_expanded(PaneContainer::Scm, "test.web")));