Adjust editor tests to use input APIs instead of key events

This commit is contained in:
Max Brunsfeld 2022-07-21 21:36:40 -07:00
parent 0185b4fef4
commit 372c3eed52
2 changed files with 14 additions and 6 deletions

View file

@ -139,6 +139,12 @@ impl<'a> EditorTestContext<'a> {
})
}
pub fn simulate_input(&mut self, input: &str) {
self.editor.update(self.cx, |editor, cx| {
editor.handle_input(input, cx);
});
}
pub fn simulate_keystroke(&mut self, keystroke_text: &str) {
let keystroke = Keystroke::parse(keystroke_text).unwrap();
self.cx.dispatch_keystroke(self.window_id, keystroke, false);