Add command palette tests and simulate_keystrokes

This commit is contained in:
Conrad Irwin 2023-11-14 23:21:32 -07:00
parent e37d7f5b0e
commit 91b54b352b
6 changed files with 180 additions and 119 deletions

View file

@ -54,6 +54,9 @@ pub trait Action: std::fmt::Debug + 'static {
where
Self: Sized;
fn build(value: Option<serde_json::Value>) -> Result<Box<dyn Action>>
where
Self: Sized;
fn is_registered() -> bool
where
Self: Sized;
@ -88,6 +91,14 @@ where
Ok(Box::new(action))
}
fn is_registered() -> bool {
ACTION_REGISTRY
.read()
.names_by_type_id
.get(&TypeId::of::<A>())
.is_some()
}
fn partial_eq(&self, action: &dyn Action) -> bool {
action
.as_any()