diff options
author | Michael Davis | 2022-10-20 18:36:21 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-10-20 23:43:15 +0000 |
commit | 1243db11a55a9f431a4b6bbf56c1953b2262d8b7 (patch) | |
tree | fb1be9d7efa60f15ff246c5a446fa23a10e3366e /helix-term/tests | |
parent | 4cff6250548d279ab69627177bd55312adb822a6 (diff) |
Use helix_view::apply_transaction in integration-tests
`helix_view::apply_transaction` closes over `Document::apply` and
`View::apply` to ensure that jumplist entries are updated when a
document changes from a transaction. `Document::apply` shouldn't
be called directly - this helper function should be used instead.
Diffstat (limited to 'helix-term/tests')
-rw-r--r-- | helix-term/tests/test/helpers.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/helix-term/tests/test/helpers.rs b/helix-term/tests/test/helpers.rs index 5adc3354..a2d53e9d 100644 --- a/helix-term/tests/test/helpers.rs +++ b/helix-term/tests/test/helpers.rs @@ -125,13 +125,12 @@ pub async fn test_key_sequence_with_input_text<T: Into<TestCase>>( let sel = doc.selection(view.id).clone(); // replace the initial text with the input text - doc.apply( - &Transaction::change_by_selection(doc.text(), &sel, |_| { - (0, doc.text().len_chars(), Some((&test_case.in_text).into())) - }) - .with_selection(test_case.in_selection.clone()), - view.id, - ); + let transaction = Transaction::change_by_selection(doc.text(), &sel, |_| { + (0, doc.text().len_chars(), Some((&test_case.in_text).into())) + }) + .with_selection(test_case.in_selection.clone()); + + helix_view::apply_transaction(&transaction, doc, view); test_key_sequence( &mut app, @@ -286,7 +285,7 @@ impl AppBuilder { .with_selection(selection); // replace the initial text with the input text - doc.apply(&trans, view.id); + helix_view::apply_transaction(&trans, doc, view); } Ok(app) |