mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-10 12:19:28 +00:00
add test for filter
This commit is contained in:
parent
f6292437fa
commit
cea7d3f5a2
1 changed files with 29 additions and 0 deletions
|
@ -384,5 +384,34 @@ mod tests {
|
|||
editor.read_with(cx, |editor, cx| {
|
||||
assert_eq!(editor.text(cx), "ab");
|
||||
});
|
||||
|
||||
// Add namespace filter, and redeploy the palette
|
||||
cx.update(|cx| {
|
||||
cx.update_default_global::<CommandPaletteFilter, _, _>(|filter, _| {
|
||||
filter.filtered_namespaces.insert("editor");
|
||||
})
|
||||
});
|
||||
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
CommandPalette::toggle(workspace, &Toggle, cx);
|
||||
});
|
||||
|
||||
// Assert editor command not present
|
||||
let palette = workspace.read_with(cx, |workspace, _| {
|
||||
workspace
|
||||
.modal()
|
||||
.unwrap()
|
||||
.clone()
|
||||
.downcast::<CommandPalette>()
|
||||
.unwrap()
|
||||
});
|
||||
|
||||
palette
|
||||
.update(cx, |palette, cx| {
|
||||
palette.update_matches("bcksp".to_string(), cx)
|
||||
})
|
||||
.await;
|
||||
|
||||
palette.update(cx, |palette, _| assert!(palette.matches.is_empty()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue