Hoisted assert clipboard into TestAppContext
This commit is contained in:
parent
9209c0dfeb
commit
2a6e23ff28
4 changed files with 9 additions and 17 deletions
|
@ -8232,7 +8232,7 @@ mod tests {
|
||||||
fox ju|mps over
|
fox ju|mps over
|
||||||
the lazy dog"});
|
the lazy dog"});
|
||||||
cx.update_editor(|e, cx| e.copy(&Copy, cx));
|
cx.update_editor(|e, cx| e.copy(&Copy, cx));
|
||||||
cx.assert_clipboard_content(Some("fox jumps over\n"));
|
cx.cx.assert_clipboard_content(Some("fox jumps over\n"));
|
||||||
|
|
||||||
// Paste with three selections, noticing how the copied full-line selection is inserted
|
// Paste with three selections, noticing how the copied full-line selection is inserted
|
||||||
// before the empty selections but replaces the selection that is non-empty.
|
// before the empty selections but replaces the selection that is non-empty.
|
||||||
|
|
|
@ -404,14 +404,6 @@ impl<'a> EditorTestContext<'a> {
|
||||||
|
|
||||||
editor_text_with_selections
|
editor_text_with_selections
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn assert_clipboard_content(&mut self, expected_content: Option<&str>) {
|
|
||||||
self.cx.update(|cx| {
|
|
||||||
let actual_content = cx.read_from_clipboard().map(|item| item.text().to_owned());
|
|
||||||
let expected_content = expected_content.map(|content| content.to_owned());
|
|
||||||
assert_eq!(actual_content, expected_content);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Deref for EditorTestContext<'a> {
|
impl<'a> Deref for EditorTestContext<'a> {
|
||||||
|
|
|
@ -627,6 +627,14 @@ impl TestAppContext {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn assert_clipboard_content(&mut self, expected_content: Option<&str>) {
|
||||||
|
self.update(|cx| {
|
||||||
|
let actual_content = cx.read_from_clipboard().map(|item| item.text().to_owned());
|
||||||
|
let expected_content = expected_content.map(|content| content.to_owned());
|
||||||
|
assert_eq!(actual_content, expected_content);
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsyncAppContext {
|
impl AsyncAppContext {
|
||||||
|
|
|
@ -147,14 +147,6 @@ impl<'a> VimTestContext<'a> {
|
||||||
let mode = self.mode();
|
let mode = self.mode();
|
||||||
VimBindingTestContext::new(keystrokes, mode, mode, self)
|
VimBindingTestContext::new(keystrokes, mode, mode, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn assert_clipboard_content(&mut self, expected_content: Option<&str>) {
|
|
||||||
self.cx.update(|cx| {
|
|
||||||
let actual_content = cx.read_from_clipboard().map(|item| item.text().to_owned());
|
|
||||||
let expected_content = expected_content.map(|content| content.to_owned());
|
|
||||||
assert_eq!(actual_content, expected_content);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Deref for VimTestContext<'a> {
|
impl<'a> Deref for VimTestContext<'a> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue