From 826020effe1f4c66f5bf1a19b5ca4d8fcc8b68e7 Mon Sep 17 00:00:00 2001 From: Mathias Jakobsen Date: Tue, 20 Feb 2024 10:37:27 +0000 Subject: [PATCH] Merge pull request #17099 from overleaf/mj-no-op-transform [overleaf-editor-core] Fix transform for no-op Operation GitOrigin-RevId: 20b8681153fb0788feb7d5d9954781a5432dbe69 --- libraries/overleaf-editor-core/lib/operation/index.js | 2 +- libraries/overleaf-editor-core/test/operation.test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/overleaf-editor-core/lib/operation/index.js b/libraries/overleaf-editor-core/lib/operation/index.js index 134ff1a1c2..916440518e 100644 --- a/libraries/overleaf-editor-core/lib/operation/index.js +++ b/libraries/overleaf-editor-core/lib/operation/index.js @@ -160,7 +160,7 @@ class Operation { * @return {Operation[]} operations `[a', b']` */ static transform(a, b) { - if (a.isNoOp() || b.isNoOp()) return [b, a] + if (a.isNoOp() || b.isNoOp()) return [a, b] function transpose(transformer) { return transformer(b, a).reverse() diff --git a/libraries/overleaf-editor-core/test/operation.test.js b/libraries/overleaf-editor-core/test/operation.test.js index c0aad37bac..a4a823cf63 100644 --- a/libraries/overleaf-editor-core/test/operation.test.js +++ b/libraries/overleaf-editor-core/test/operation.test.js @@ -741,4 +741,10 @@ describe('Operation', function () { .expectFiles({}) .expectSymmetry() }) + + it('transforms no-op with other operation', function () { + runConcurrently(Operation.NO_OP, addFile('foo', 'test')).expectFiles({ + foo: 'test', + }) + }) })