@fluid-experimental/tree 2.0.0-rc.2.0.1 → 2.0.0-rc.3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/api-report/experimental-tree.api.md +2 -2
- package/dist/ChangeCompression.d.ts +2 -2
- package/dist/ChangeCompression.d.ts.map +1 -1
- package/dist/ChangeCompression.js +1 -1
- package/dist/ChangeCompression.js.map +1 -1
- package/dist/ChangeTypes.d.ts +1 -1
- package/dist/ChangeTypes.d.ts.map +1 -1
- package/dist/ChangeTypes.js +4 -4
- package/dist/ChangeTypes.js.map +1 -1
- package/dist/Checkout.d.ts +3 -3
- package/dist/Checkout.d.ts.map +1 -1
- package/dist/Checkout.js +17 -17
- package/dist/Checkout.js.map +1 -1
- package/dist/EditLog.d.ts +1 -1
- package/dist/EditLog.d.ts.map +1 -1
- package/dist/EditLog.js +9 -9
- package/dist/EditLog.js.map +1 -1
- package/dist/EditUtilities.d.ts +3 -3
- package/dist/EditUtilities.d.ts.map +1 -1
- package/dist/EditUtilities.js +6 -6
- package/dist/EditUtilities.js.map +1 -1
- package/dist/Forest.d.ts.map +1 -1
- package/dist/Forest.js +23 -23
- package/dist/Forest.js.map +1 -1
- package/dist/HistoryEditFactory.d.ts +1 -1
- package/dist/HistoryEditFactory.d.ts.map +1 -1
- package/dist/HistoryEditFactory.js +7 -7
- package/dist/HistoryEditFactory.js.map +1 -1
- package/dist/IdConversion.d.ts.map +1 -1
- package/dist/IdConversion.js.map +1 -1
- package/dist/LogViewer.d.ts +2 -2
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +7 -7
- package/dist/LogViewer.js.map +1 -1
- package/dist/MergeHealth.d.ts.map +1 -1
- package/dist/MergeHealth.js +1 -1
- package/dist/MergeHealth.js.map +1 -1
- package/dist/NodeIdUtilities.d.ts +1 -1
- package/dist/NodeIdUtilities.d.ts.map +1 -1
- package/dist/NodeIdUtilities.js +1 -1
- package/dist/NodeIdUtilities.js.map +1 -1
- package/dist/PayloadUtilities.d.ts.map +1 -1
- package/dist/PayloadUtilities.js +2 -2
- package/dist/PayloadUtilities.js.map +1 -1
- package/dist/ReconciliationPath.d.ts +1 -1
- package/dist/ReconciliationPath.d.ts.map +1 -1
- package/dist/ReconciliationPath.js.map +1 -1
- package/dist/RevisionValueCache.d.ts.map +1 -1
- package/dist/RevisionValueCache.js +2 -2
- package/dist/RevisionValueCache.js.map +1 -1
- package/dist/RevisionView.d.ts +2 -2
- package/dist/RevisionView.d.ts.map +1 -1
- package/dist/RevisionView.js.map +1 -1
- package/dist/SerializationUtilities.d.ts +1 -1
- package/dist/SerializationUtilities.d.ts.map +1 -1
- package/dist/SerializationUtilities.js.map +1 -1
- package/dist/SharedTree.d.ts +8 -7
- package/dist/SharedTree.d.ts.map +1 -1
- package/dist/SharedTree.js +78 -78
- package/dist/SharedTree.js.map +1 -1
- package/dist/SharedTreeEncoder.d.ts +1 -1
- package/dist/SharedTreeEncoder.d.ts.map +1 -1
- package/dist/SharedTreeEncoder.js +31 -31
- package/dist/SharedTreeEncoder.js.map +1 -1
- package/dist/Summary.d.ts +2 -2
- package/dist/Summary.d.ts.map +1 -1
- package/dist/Summary.js +2 -2
- package/dist/Summary.js.map +1 -1
- package/dist/SummaryBackCompatibility.d.ts.map +1 -1
- package/dist/SummaryBackCompatibility.js.map +1 -1
- package/dist/SummaryTestUtilities.d.ts +1 -1
- package/dist/SummaryTestUtilities.d.ts.map +1 -1
- package/dist/SummaryTestUtilities.js.map +1 -1
- package/dist/Transaction.d.ts +3 -3
- package/dist/Transaction.d.ts.map +1 -1
- package/dist/Transaction.js +3 -3
- package/dist/Transaction.js.map +1 -1
- package/dist/TransactionInternal.d.ts +3 -3
- package/dist/TransactionInternal.d.ts.map +1 -1
- package/dist/TransactionInternal.js +6 -6
- package/dist/TransactionInternal.js.map +1 -1
- package/dist/TreeCompressor.d.ts +5 -1
- package/dist/TreeCompressor.d.ts.map +1 -1
- package/dist/TreeCompressor.js +5 -5
- package/dist/TreeCompressor.js.map +1 -1
- package/dist/TreeNodeHandle.d.ts +1 -1
- package/dist/TreeNodeHandle.d.ts.map +1 -1
- package/dist/TreeNodeHandle.js.map +1 -1
- package/dist/TreeView.d.ts +1 -1
- package/dist/TreeView.d.ts.map +1 -1
- package/dist/TreeView.js +2 -3
- package/dist/TreeView.js.map +1 -1
- package/dist/UuidUtilities.d.ts.map +1 -1
- package/dist/UuidUtilities.js.map +1 -1
- package/dist/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
- package/dist/id-compressor/AppendOnlySortedMap.js +3 -3
- package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/dist/id-compressor/IdCompressor.d.ts +1 -1
- package/dist/id-compressor/IdCompressor.d.ts.map +1 -1
- package/dist/id-compressor/IdCompressor.js +25 -26
- package/dist/id-compressor/IdCompressor.js.map +1 -1
- package/dist/id-compressor/IdRange.d.ts.map +1 -1
- package/dist/id-compressor/IdRange.js +2 -2
- package/dist/id-compressor/IdRange.js.map +1 -1
- package/dist/id-compressor/NumericUuid.d.ts.map +1 -1
- package/dist/id-compressor/NumericUuid.js +2 -1
- package/dist/id-compressor/NumericUuid.js.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.js +8 -9
- package/dist/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.d.ts +1 -1
- package/dist/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.js +11 -11
- package/dist/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/dist/migration-shim/migrationShim.d.ts +8 -4
- package/dist/migration-shim/migrationShim.d.ts.map +1 -1
- package/dist/migration-shim/migrationShim.js +13 -13
- package/dist/migration-shim/migrationShim.js.map +1 -1
- package/dist/migration-shim/migrationShimFactory.d.ts +2 -2
- package/dist/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/migrationShimFactory.js +2 -2
- package/dist/migration-shim/migrationShimFactory.js.map +1 -1
- package/dist/migration-shim/packageVersion.d.ts +0 -2
- package/dist/migration-shim/packageVersion.d.ts.map +1 -1
- package/dist/migration-shim/packageVersion.js +0 -2
- package/dist/migration-shim/packageVersion.js.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.js +8 -8
- package/dist/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/dist/migration-shim/sharedTreeShim.d.ts +2 -2
- package/dist/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShim.js +8 -4
- package/dist/migration-shim/sharedTreeShim.js.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.d.ts +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.js +2 -2
- package/dist/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/dist/migration-shim/shimChannelServices.d.ts +1 -1
- package/dist/migration-shim/shimChannelServices.d.ts.map +1 -1
- package/dist/migration-shim/shimChannelServices.js.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.d.ts +1 -1
- package/dist/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.js +2 -2
- package/dist/migration-shim/shimDeltaConnection.js.map +1 -1
- package/dist/migration-shim/shimHandle.d.ts.map +1 -1
- package/dist/migration-shim/shimHandle.js.map +1 -1
- package/dist/migration-shim/types.d.ts +1 -1
- package/dist/migration-shim/types.d.ts.map +1 -1
- package/dist/migration-shim/types.js.map +1 -1
- package/dist/migration-shim/utils.d.ts +1 -1
- package/dist/migration-shim/utils.d.ts.map +1 -1
- package/dist/migration-shim/utils.js.map +1 -1
- package/dist/persisted-types/0.0.2.d.ts +1 -1
- package/dist/persisted-types/0.0.2.d.ts.map +1 -1
- package/dist/persisted-types/0.0.2.js.map +1 -1
- package/dist/persisted-types/0.1.1.d.ts +1 -1
- package/dist/persisted-types/0.1.1.d.ts.map +1 -1
- package/dist/persisted-types/0.1.1.js +3 -3
- package/dist/persisted-types/0.1.1.js.map +1 -1
- package/lib/ChangeCompression.d.ts +2 -2
- package/lib/ChangeCompression.d.ts.map +1 -1
- package/lib/ChangeCompression.js +1 -1
- package/lib/ChangeCompression.js.map +1 -1
- package/lib/ChangeTypes.d.ts +1 -1
- package/lib/ChangeTypes.d.ts.map +1 -1
- package/lib/ChangeTypes.js +2 -2
- package/lib/ChangeTypes.js.map +1 -1
- package/lib/Checkout.d.ts +3 -3
- package/lib/Checkout.d.ts.map +1 -1
- package/lib/Checkout.js +4 -4
- package/lib/Checkout.js.map +1 -1
- package/lib/EditLog.d.ts +1 -1
- package/lib/EditLog.d.ts.map +1 -1
- package/lib/EditLog.js +2 -2
- package/lib/EditLog.js.map +1 -1
- package/lib/EditUtilities.d.ts +3 -3
- package/lib/EditUtilities.d.ts.map +1 -1
- package/lib/EditUtilities.js +5 -5
- package/lib/EditUtilities.js.map +1 -1
- package/lib/Forest.d.ts.map +1 -1
- package/lib/Forest.js +2 -2
- package/lib/Forest.js.map +1 -1
- package/lib/HistoryEditFactory.d.ts +1 -1
- package/lib/HistoryEditFactory.d.ts.map +1 -1
- package/lib/HistoryEditFactory.js +5 -5
- package/lib/HistoryEditFactory.js.map +1 -1
- package/lib/IdConversion.d.ts.map +1 -1
- package/lib/IdConversion.js.map +1 -1
- package/lib/LogViewer.d.ts +2 -2
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +3 -3
- package/lib/LogViewer.js.map +1 -1
- package/lib/MergeHealth.d.ts.map +1 -1
- package/lib/MergeHealth.js +1 -1
- package/lib/MergeHealth.js.map +1 -1
- package/lib/NodeIdUtilities.d.ts +1 -1
- package/lib/NodeIdUtilities.d.ts.map +1 -1
- package/lib/NodeIdUtilities.js +1 -1
- package/lib/NodeIdUtilities.js.map +1 -1
- package/lib/PayloadUtilities.d.ts.map +1 -1
- package/lib/PayloadUtilities.js +1 -1
- package/lib/PayloadUtilities.js.map +1 -1
- package/lib/ReconciliationPath.d.ts +1 -1
- package/lib/ReconciliationPath.d.ts.map +1 -1
- package/lib/ReconciliationPath.js.map +1 -1
- package/lib/RevisionValueCache.d.ts.map +1 -1
- package/lib/RevisionValueCache.js +2 -2
- package/lib/RevisionValueCache.js.map +1 -1
- package/lib/RevisionView.d.ts +2 -2
- package/lib/RevisionView.d.ts.map +1 -1
- package/lib/RevisionView.js.map +1 -1
- package/lib/SerializationUtilities.d.ts +1 -1
- package/lib/SerializationUtilities.d.ts.map +1 -1
- package/lib/SerializationUtilities.js.map +1 -1
- package/lib/SharedTree.d.ts +8 -7
- package/lib/SharedTree.d.ts.map +1 -1
- package/lib/SharedTree.js +13 -13
- package/lib/SharedTree.js.map +1 -1
- package/lib/SharedTreeEncoder.d.ts +1 -1
- package/lib/SharedTreeEncoder.d.ts.map +1 -1
- package/lib/SharedTreeEncoder.js +5 -5
- package/lib/SharedTreeEncoder.js.map +1 -1
- package/lib/Summary.d.ts +2 -2
- package/lib/Summary.d.ts.map +1 -1
- package/lib/Summary.js +1 -1
- package/lib/Summary.js.map +1 -1
- package/lib/SummaryBackCompatibility.d.ts.map +1 -1
- package/lib/SummaryBackCompatibility.js.map +1 -1
- package/lib/SummaryTestUtilities.d.ts +1 -1
- package/lib/SummaryTestUtilities.d.ts.map +1 -1
- package/lib/SummaryTestUtilities.js.map +1 -1
- package/lib/Transaction.d.ts +3 -3
- package/lib/Transaction.d.ts.map +1 -1
- package/lib/Transaction.js +3 -3
- package/lib/Transaction.js.map +1 -1
- package/lib/TransactionInternal.d.ts +3 -3
- package/lib/TransactionInternal.d.ts.map +1 -1
- package/lib/TransactionInternal.js +3 -3
- package/lib/TransactionInternal.js.map +1 -1
- package/lib/TreeCompressor.d.ts +5 -1
- package/lib/TreeCompressor.d.ts.map +1 -1
- package/lib/TreeCompressor.js +2 -2
- package/lib/TreeCompressor.js.map +1 -1
- package/lib/TreeNodeHandle.d.ts +1 -1
- package/lib/TreeNodeHandle.d.ts.map +1 -1
- package/lib/TreeNodeHandle.js.map +1 -1
- package/lib/TreeView.d.ts +1 -1
- package/lib/TreeView.d.ts.map +1 -1
- package/lib/TreeView.js +1 -2
- package/lib/TreeView.js.map +1 -1
- package/lib/UuidUtilities.d.ts.map +1 -1
- package/lib/UuidUtilities.js +1 -1
- package/lib/UuidUtilities.js.map +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.js +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/lib/id-compressor/IdCompressor.d.ts +1 -1
- package/lib/id-compressor/IdCompressor.d.ts.map +1 -1
- package/lib/id-compressor/IdCompressor.js +4 -5
- package/lib/id-compressor/IdCompressor.js.map +1 -1
- package/lib/id-compressor/IdRange.d.ts.map +1 -1
- package/lib/id-compressor/IdRange.js +1 -1
- package/lib/id-compressor/IdRange.js.map +1 -1
- package/lib/id-compressor/NumericUuid.d.ts.map +1 -1
- package/lib/id-compressor/NumericUuid.js +2 -1
- package/lib/id-compressor/NumericUuid.js.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.js +1 -2
- package/lib/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.d.ts +1 -1
- package/lib/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.js +1 -1
- package/lib/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/lib/migration-shim/migrationShim.d.ts +8 -4
- package/lib/migration-shim/migrationShim.d.ts.map +1 -1
- package/lib/migration-shim/migrationShim.js +3 -3
- package/lib/migration-shim/migrationShim.js.map +1 -1
- package/lib/migration-shim/migrationShimFactory.d.ts +2 -2
- package/lib/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/migrationShimFactory.js +1 -1
- package/lib/migration-shim/migrationShimFactory.js.map +1 -1
- package/lib/migration-shim/packageVersion.d.ts +0 -2
- package/lib/migration-shim/packageVersion.d.ts.map +1 -1
- package/lib/migration-shim/packageVersion.js +0 -2
- package/lib/migration-shim/packageVersion.js.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.js +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/lib/migration-shim/sharedTreeShim.d.ts +2 -2
- package/lib/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShim.js +6 -2
- package/lib/migration-shim/sharedTreeShim.js.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.d.ts +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.js +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/lib/migration-shim/shimChannelServices.d.ts +1 -1
- package/lib/migration-shim/shimChannelServices.d.ts.map +1 -1
- package/lib/migration-shim/shimChannelServices.js.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.d.ts +1 -1
- package/lib/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.js +1 -1
- package/lib/migration-shim/shimDeltaConnection.js.map +1 -1
- package/lib/migration-shim/shimHandle.d.ts.map +1 -1
- package/lib/migration-shim/shimHandle.js.map +1 -1
- package/lib/migration-shim/types.d.ts +1 -1
- package/lib/migration-shim/types.d.ts.map +1 -1
- package/lib/migration-shim/types.js.map +1 -1
- package/lib/migration-shim/utils.d.ts +1 -1
- package/lib/migration-shim/utils.d.ts.map +1 -1
- package/lib/migration-shim/utils.js.map +1 -1
- package/lib/persisted-types/0.0.2.d.ts +1 -1
- package/lib/persisted-types/0.0.2.d.ts.map +1 -1
- package/lib/persisted-types/0.0.2.js.map +1 -1
- package/lib/persisted-types/0.1.1.d.ts +1 -1
- package/lib/persisted-types/0.1.1.d.ts.map +1 -1
- package/lib/persisted-types/0.1.1.js +1 -1
- package/lib/persisted-types/0.1.1.js.map +1 -1
- package/package.json +33 -32
- package/src/ChangeCompression.ts +8 -8
- package/src/ChangeTypes.ts +5 -4
- package/src/Checkout.ts +9 -7
- package/src/EditLog.ts +4 -3
- package/src/EditUtilities.ts +9 -8
- package/src/Forest.ts +3 -2
- package/src/HistoryEditFactory.ts +12 -11
- package/src/IdConversion.ts +2 -2
- package/src/LogViewer.ts +5 -4
- package/src/MergeHealth.ts +2 -1
- package/src/NodeIdUtilities.ts +2 -2
- package/src/PayloadUtilities.ts +2 -1
- package/src/ReconciliationPath.ts +1 -1
- package/src/RevisionValueCache.ts +3 -2
- package/src/RevisionView.ts +3 -3
- package/src/SerializationUtilities.ts +1 -1
- package/src/SharedTree.ts +46 -49
- package/src/SharedTreeEncoder.ts +30 -29
- package/src/Summary.ts +5 -3
- package/src/SummaryBackCompatibility.ts +1 -0
- package/src/SummaryTestUtilities.ts +2 -1
- package/src/Transaction.ts +7 -6
- package/src/TransactionInternal.ts +17 -16
- package/src/TreeCompressor.ts +6 -4
- package/src/TreeNodeHandle.ts +2 -2
- package/src/TreeView.ts +3 -3
- package/src/UuidUtilities.ts +2 -1
- package/src/id-compressor/AppendOnlySortedMap.ts +2 -1
- package/src/id-compressor/IdCompressor.ts +18 -17
- package/src/id-compressor/IdRange.ts +2 -1
- package/src/id-compressor/NumericUuid.ts +1 -1
- package/src/id-compressor/SessionIdNormalizer.ts +3 -3
- package/src/migration-shim/migrationDeltaHandler.ts +3 -2
- package/src/migration-shim/migrationShim.ts +14 -10
- package/src/migration-shim/migrationShimFactory.ts +6 -4
- package/src/migration-shim/packageVersion.ts +0 -2
- package/src/migration-shim/sharedTreeDeltaHandler.ts +3 -2
- package/src/migration-shim/sharedTreeShim.ts +7 -5
- package/src/migration-shim/sharedTreeShimFactory.ts +3 -3
- package/src/migration-shim/shimChannelServices.ts +1 -1
- package/src/migration-shim/shimDeltaConnection.ts +3 -2
- package/src/migration-shim/shimHandle.ts +1 -0
- package/src/migration-shim/types.ts +3 -1
- package/src/migration-shim/utils.ts +2 -1
- package/src/persisted-types/0.0.2.ts +2 -2
- package/src/persisted-types/0.1.1.ts +10 -8
- package/dist/tree-alpha.d.ts +0 -2901
- package/dist/tree-beta.d.ts +0 -348
- package/dist/tree-public.d.ts +0 -348
- package/dist/tree-untrimmed.d.ts +0 -3820
- package/lib/test/AppendOnlySortedMap.perf.tests.d.ts +0 -6
- package/lib/test/AppendOnlySortedMap.perf.tests.d.ts.map +0 -1
- package/lib/test/AppendOnlySortedMap.perf.tests.js +0 -49
- package/lib/test/AppendOnlySortedMap.perf.tests.js.map +0 -1
- package/lib/test/AppendOnlySortedMap.tests.d.ts +0 -6
- package/lib/test/AppendOnlySortedMap.tests.d.ts.map +0 -1
- package/lib/test/AppendOnlySortedMap.tests.js +0 -213
- package/lib/test/AppendOnlySortedMap.tests.js.map +0 -1
- package/lib/test/ChangeCompression.tests.d.ts +0 -6
- package/lib/test/ChangeCompression.tests.d.ts.map +0 -1
- package/lib/test/ChangeCompression.tests.js +0 -154
- package/lib/test/ChangeCompression.tests.js.map +0 -1
- package/lib/test/Checkout.tests.d.ts +0 -10
- package/lib/test/Checkout.tests.d.ts.map +0 -1
- package/lib/test/Checkout.tests.js +0 -460
- package/lib/test/Checkout.tests.js.map +0 -1
- package/lib/test/Common.tests.d.ts +0 -6
- package/lib/test/Common.tests.d.ts.map +0 -1
- package/lib/test/Common.tests.js +0 -102
- package/lib/test/Common.tests.js.map +0 -1
- package/lib/test/EagerCheckout.tests.d.ts +0 -6
- package/lib/test/EagerCheckout.tests.d.ts.map +0 -1
- package/lib/test/EagerCheckout.tests.js +0 -20
- package/lib/test/EagerCheckout.tests.js.map +0 -1
- package/lib/test/Edit.tests.d.ts +0 -6
- package/lib/test/Edit.tests.d.ts.map +0 -1
- package/lib/test/Edit.tests.js +0 -60
- package/lib/test/Edit.tests.js.map +0 -1
- package/lib/test/EditLog.perf.tests.d.ts +0 -6
- package/lib/test/EditLog.perf.tests.d.ts.map +0 -1
- package/lib/test/EditLog.perf.tests.js +0 -41
- package/lib/test/EditLog.perf.tests.js.map +0 -1
- package/lib/test/EditLog.tests.d.ts +0 -6
- package/lib/test/EditLog.tests.d.ts.map +0 -1
- package/lib/test/EditLog.tests.js +0 -355
- package/lib/test/EditLog.tests.js.map +0 -1
- package/lib/test/EditUtilities.tests.d.ts +0 -6
- package/lib/test/EditUtilities.tests.d.ts.map +0 -1
- package/lib/test/EditUtilities.tests.js +0 -512
- package/lib/test/EditUtilities.tests.js.map +0 -1
- package/lib/test/Forest.perf.tests.d.ts +0 -6
- package/lib/test/Forest.perf.tests.d.ts.map +0 -1
- package/lib/test/Forest.perf.tests.js +0 -135
- package/lib/test/Forest.perf.tests.js.map +0 -1
- package/lib/test/Forest.tests.d.ts +0 -6
- package/lib/test/Forest.tests.d.ts.map +0 -1
- package/lib/test/Forest.tests.js +0 -213
- package/lib/test/Forest.tests.js.map +0 -1
- package/lib/test/GenericTransaction.tests.d.ts +0 -6
- package/lib/test/GenericTransaction.tests.d.ts.map +0 -1
- package/lib/test/GenericTransaction.tests.js +0 -31
- package/lib/test/GenericTransaction.tests.js.map +0 -1
- package/lib/test/HistoryEditFactory.tests.d.ts +0 -6
- package/lib/test/HistoryEditFactory.tests.d.ts.map +0 -1
- package/lib/test/HistoryEditFactory.tests.js +0 -170
- package/lib/test/HistoryEditFactory.tests.js.map +0 -1
- package/lib/test/IdCompressor.perf.tests.d.ts +0 -6
- package/lib/test/IdCompressor.perf.tests.d.ts.map +0 -1
- package/lib/test/IdCompressor.perf.tests.js +0 -290
- package/lib/test/IdCompressor.perf.tests.js.map +0 -1
- package/lib/test/IdCompressor.tests.d.ts +0 -6
- package/lib/test/IdCompressor.tests.d.ts.map +0 -1
- package/lib/test/IdCompressor.tests.js +0 -1542
- package/lib/test/IdCompressor.tests.js.map +0 -1
- package/lib/test/IdConversion.tests.d.ts +0 -6
- package/lib/test/IdConversion.tests.d.ts.map +0 -1
- package/lib/test/IdConversion.tests.js +0 -36
- package/lib/test/IdConversion.tests.js.map +0 -1
- package/lib/test/LazyCheckout.tests.d.ts +0 -6
- package/lib/test/LazyCheckout.tests.d.ts.map +0 -1
- package/lib/test/LazyCheckout.tests.js +0 -22
- package/lib/test/LazyCheckout.tests.js.map +0 -1
- package/lib/test/LogViewer.tests.d.ts +0 -6
- package/lib/test/LogViewer.tests.d.ts.map +0 -1
- package/lib/test/LogViewer.tests.js +0 -588
- package/lib/test/LogViewer.tests.js.map +0 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts +0 -6
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts.map +0 -1
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +0 -351
- package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +0 -1
- package/lib/test/NumericUuid.perf.tests.d.ts +0 -6
- package/lib/test/NumericUuid.perf.tests.d.ts.map +0 -1
- package/lib/test/NumericUuid.perf.tests.js +0 -68
- package/lib/test/NumericUuid.perf.tests.js.map +0 -1
- package/lib/test/NumericUuid.tests.d.ts +0 -6
- package/lib/test/NumericUuid.tests.d.ts.map +0 -1
- package/lib/test/NumericUuid.tests.js +0 -192
- package/lib/test/NumericUuid.tests.js.map +0 -1
- package/lib/test/RevisionValueCache.tests.d.ts +0 -6
- package/lib/test/RevisionValueCache.tests.d.ts.map +0 -1
- package/lib/test/RevisionValueCache.tests.js +0 -106
- package/lib/test/RevisionValueCache.tests.js.map +0 -1
- package/lib/test/RevisionView.tests.d.ts +0 -6
- package/lib/test/RevisionView.tests.d.ts.map +0 -1
- package/lib/test/RevisionView.tests.js +0 -131
- package/lib/test/RevisionView.tests.js.map +0 -1
- package/lib/test/SessionIdNormalizer.tests.d.ts +0 -6
- package/lib/test/SessionIdNormalizer.tests.d.ts.map +0 -1
- package/lib/test/SessionIdNormalizer.tests.js +0 -377
- package/lib/test/SessionIdNormalizer.tests.js.map +0 -1
- package/lib/test/SharedTree.fuzz.tests.d.ts +0 -6
- package/lib/test/SharedTree.fuzz.tests.d.ts.map +0 -1
- package/lib/test/SharedTree.fuzz.tests.js +0 -9
- package/lib/test/SharedTree.fuzz.tests.js.map +0 -1
- package/lib/test/SharedTree.perf.tests.d.ts +0 -6
- package/lib/test/SharedTree.perf.tests.d.ts.map +0 -1
- package/lib/test/SharedTree.perf.tests.js +0 -39
- package/lib/test/SharedTree.perf.tests.js.map +0 -1
- package/lib/test/SharedTree.tests.d.ts +0 -6
- package/lib/test/SharedTree.tests.d.ts.map +0 -1
- package/lib/test/SharedTree.tests.js +0 -22
- package/lib/test/SharedTree.tests.js.map +0 -1
- package/lib/test/StringInterner.tests.d.ts +0 -6
- package/lib/test/StringInterner.tests.d.ts.map +0 -1
- package/lib/test/StringInterner.tests.js +0 -73
- package/lib/test/StringInterner.tests.js.map +0 -1
- package/lib/test/Summary.tests.d.ts +0 -7
- package/lib/test/Summary.tests.d.ts.map +0 -1
- package/lib/test/Summary.tests.js +0 -386
- package/lib/test/Summary.tests.js.map +0 -1
- package/lib/test/Transaction.tests.d.ts +0 -6
- package/lib/test/Transaction.tests.d.ts.map +0 -1
- package/lib/test/Transaction.tests.js +0 -124
- package/lib/test/Transaction.tests.js.map +0 -1
- package/lib/test/TransactionInternal.tests.d.ts +0 -6
- package/lib/test/TransactionInternal.tests.d.ts.map +0 -1
- package/lib/test/TransactionInternal.tests.js +0 -576
- package/lib/test/TransactionInternal.tests.js.map +0 -1
- package/lib/test/TreeCompression.tests.d.ts +0 -6
- package/lib/test/TreeCompression.tests.d.ts.map +0 -1
- package/lib/test/TreeCompression.tests.js +0 -291
- package/lib/test/TreeCompression.tests.js.map +0 -1
- package/lib/test/TreeView.tests.d.ts +0 -6
- package/lib/test/TreeView.tests.d.ts.map +0 -1
- package/lib/test/TreeView.tests.js +0 -178
- package/lib/test/TreeView.tests.js.map +0 -1
- package/lib/test/UndoRedoHandler.tests.d.ts +0 -6
- package/lib/test/UndoRedoHandler.tests.d.ts.map +0 -1
- package/lib/test/UndoRedoHandler.tests.js +0 -37
- package/lib/test/UndoRedoHandler.tests.js.map +0 -1
- package/lib/test/fuzz/Generators.d.ts +0 -8
- package/lib/test/fuzz/Generators.d.ts.map +0 -1
- package/lib/test/fuzz/Generators.js +0 -345
- package/lib/test/fuzz/Generators.js.map +0 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +0 -23
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +0 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.js +0 -241
- package/lib/test/fuzz/SharedTreeFuzzTests.js.map +0 -1
- package/lib/test/fuzz/Types.d.ts +0 -136
- package/lib/test/fuzz/Types.d.ts.map +0 -1
- package/lib/test/fuzz/Types.js +0 -6
- package/lib/test/fuzz/Types.js.map +0 -1
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts +0 -246
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +0 -1
- package/lib/test/utilities/IdCompressorTestUtilities.js +0 -608
- package/lib/test/utilities/IdCompressorTestUtilities.js.map +0 -1
- package/lib/test/utilities/MockTransaction.d.ts +0 -35
- package/lib/test/utilities/MockTransaction.d.ts.map +0 -1
- package/lib/test/utilities/MockTransaction.js +0 -51
- package/lib/test/utilities/MockTransaction.js.map +0 -1
- package/lib/test/utilities/PendingLocalStateTests.d.ts +0 -12
- package/lib/test/utilities/PendingLocalStateTests.d.ts.map +0 -1
- package/lib/test/utilities/PendingLocalStateTests.js +0 -223
- package/lib/test/utilities/PendingLocalStateTests.js.map +0 -1
- package/lib/test/utilities/SharedTreeTests.d.ts +0 -12
- package/lib/test/utilities/SharedTreeTests.d.ts.map +0 -1
- package/lib/test/utilities/SharedTreeTests.js +0 -949
- package/lib/test/utilities/SharedTreeTests.js.map +0 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts +0 -11
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +0 -1
- package/lib/test/utilities/SharedTreeVersioningTests.js +0 -439
- package/lib/test/utilities/SharedTreeVersioningTests.js.map +0 -1
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts +0 -10
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +0 -1
- package/lib/test/utilities/SummaryLoadPerfTests.js +0 -105
- package/lib/test/utilities/SummaryLoadPerfTests.js.map +0 -1
- package/lib/test/utilities/SummarySizeTests.d.ts +0 -11
- package/lib/test/utilities/SummarySizeTests.d.ts.map +0 -1
- package/lib/test/utilities/SummarySizeTests.js +0 -160
- package/lib/test/utilities/SummarySizeTests.js.map +0 -1
- package/lib/test/utilities/TestCommon.d.ts +0 -13
- package/lib/test/utilities/TestCommon.d.ts.map +0 -1
- package/lib/test/utilities/TestCommon.js +0 -19
- package/lib/test/utilities/TestCommon.js.map +0 -1
- package/lib/test/utilities/TestNode.d.ts +0 -140
- package/lib/test/utilities/TestNode.d.ts.map +0 -1
- package/lib/test/utilities/TestNode.js +0 -282
- package/lib/test/utilities/TestNode.js.map +0 -1
- package/lib/test/utilities/TestSerializer.d.ts +0 -24
- package/lib/test/utilities/TestSerializer.d.ts.map +0 -1
- package/lib/test/utilities/TestSerializer.js +0 -40
- package/lib/test/utilities/TestSerializer.js.map +0 -1
- package/lib/test/utilities/TestUtilities.d.ts +0 -212
- package/lib/test/utilities/TestUtilities.d.ts.map +0 -1
- package/lib/test/utilities/TestUtilities.js +0 -413
- package/lib/test/utilities/TestUtilities.js.map +0 -1
- package/lib/test/utilities/UndoRedoTests.d.ts +0 -32
- package/lib/test/utilities/UndoRedoTests.d.ts.map +0 -1
- package/lib/test/utilities/UndoRedoTests.js +0 -317
- package/lib/test/utilities/UndoRedoTests.js.map +0 -1
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { expect } from 'chai';
|
|
6
|
-
import { noop } from '../../Common.js';
|
|
7
|
-
import { TreeNodeHandle } from '../../TreeNodeHandle.js';
|
|
8
|
-
import { Change, StablePlace, StableRange } from '../../ChangeTypes.js';
|
|
9
|
-
import { deepCompareNodes } from '../../EditUtilities.js';
|
|
10
|
-
import { expectDefined } from './TestCommon.js';
|
|
11
|
-
import { buildLeaf } from './TestNode.js';
|
|
12
|
-
import { setUpTestSharedTree, setUpTestTree, translateId } from './TestUtilities.js';
|
|
13
|
-
/**
|
|
14
|
-
* Runs undo/redo tests for SharedTree
|
|
15
|
-
*/
|
|
16
|
-
export function runSharedTreeUndoRedoTestSuite(options) {
|
|
17
|
-
const { localMode, title, undo, redo, beforeEach: additionalSetup } = options;
|
|
18
|
-
const afterEdit = options.afterEdit ?? noop;
|
|
19
|
-
const testOutOfOrderRevert = options.testOutOfOrderRevert ?? true;
|
|
20
|
-
const treeOptions = {
|
|
21
|
-
localMode,
|
|
22
|
-
allowInvalid: true,
|
|
23
|
-
allowMalformed: true,
|
|
24
|
-
};
|
|
25
|
-
const secondTreeOptions = {
|
|
26
|
-
localMode,
|
|
27
|
-
id: 'secondTestTree',
|
|
28
|
-
allowInvalid: true,
|
|
29
|
-
};
|
|
30
|
-
describe(title, () => {
|
|
31
|
-
let testTree;
|
|
32
|
-
let sharedTree;
|
|
33
|
-
let undoSharedTree;
|
|
34
|
-
let containerRuntimeFactory;
|
|
35
|
-
function getTreeHandle() {
|
|
36
|
-
return new TreeNodeHandle(sharedTree.currentView, testTree.identifier);
|
|
37
|
-
}
|
|
38
|
-
beforeEach(() => {
|
|
39
|
-
const setupResult = setUpTestSharedTree(treeOptions);
|
|
40
|
-
sharedTree = setupResult.tree;
|
|
41
|
-
testTree = setUpTestTree(sharedTree);
|
|
42
|
-
containerRuntimeFactory = setupResult.containerRuntimeFactory;
|
|
43
|
-
const secondTree = localMode
|
|
44
|
-
? undefined
|
|
45
|
-
: setUpTestSharedTree({ containerRuntimeFactory, ...secondTreeOptions }).tree;
|
|
46
|
-
undoSharedTree = secondTree ?? sharedTree;
|
|
47
|
-
if (additionalSetup !== undefined) {
|
|
48
|
-
if (secondTree !== undefined) {
|
|
49
|
-
additionalSetup([sharedTree, undoSharedTree]);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
additionalSetup([sharedTree]);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
it('can detach and re-insert the same node', () => {
|
|
57
|
-
const detachedId = 0;
|
|
58
|
-
const { id } = sharedTree.applyEdit(Change.detach(StableRange.only(testTree.left), detachedId), Change.insert(detachedId, StablePlace.atStartOf(testTree.left.traitLocation)));
|
|
59
|
-
if (!localMode) {
|
|
60
|
-
containerRuntimeFactory.processAllMessages();
|
|
61
|
-
}
|
|
62
|
-
expect(deepCompareNodes(getTreeHandle(), testTree)).to.be.true;
|
|
63
|
-
const undoId = expectDefined(undo(sharedTree, id));
|
|
64
|
-
if (!localMode) {
|
|
65
|
-
containerRuntimeFactory.processAllMessages();
|
|
66
|
-
}
|
|
67
|
-
expect(deepCompareNodes(getTreeHandle(), testTree)).to.be.true;
|
|
68
|
-
redo(sharedTree, undoId);
|
|
69
|
-
if (!localMode) {
|
|
70
|
-
containerRuntimeFactory.processAllMessages();
|
|
71
|
-
}
|
|
72
|
-
expect(deepCompareNodes(getTreeHandle(), testTree)).to.be.true;
|
|
73
|
-
});
|
|
74
|
-
it('works for Insert', () => {
|
|
75
|
-
const newNode = testTree.buildLeaf();
|
|
76
|
-
const { id } = sharedTree.applyEdit(...Change.insertTree(newNode, StablePlace.after(testTree.left)));
|
|
77
|
-
afterEdit();
|
|
78
|
-
expect(sharedTree.edits.length).to.equal(2);
|
|
79
|
-
if (!localMode) {
|
|
80
|
-
containerRuntimeFactory.processAllMessages();
|
|
81
|
-
}
|
|
82
|
-
// Undo testing
|
|
83
|
-
const undoId = expectDefined(undo(undoSharedTree, id));
|
|
84
|
-
if (!localMode) {
|
|
85
|
-
containerRuntimeFactory.processAllMessages();
|
|
86
|
-
}
|
|
87
|
-
expect(sharedTree.edits.length).to.equal(3);
|
|
88
|
-
// Check the inserted node was deleted
|
|
89
|
-
const leftTraitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);
|
|
90
|
-
expect(leftTraitAfterUndo.length).to.equal(1);
|
|
91
|
-
// Redo testing
|
|
92
|
-
redo(undoSharedTree, undoId);
|
|
93
|
-
if (!localMode) {
|
|
94
|
-
containerRuntimeFactory.processAllMessages();
|
|
95
|
-
}
|
|
96
|
-
expect(sharedTree.edits.length).to.equal(4);
|
|
97
|
-
// Check the inserted node was reinserted
|
|
98
|
-
const leftTraitAfterRedo = sharedTree.currentView.getTrait(testTree.left.traitLocation);
|
|
99
|
-
expect(leftTraitAfterRedo.length).to.equal(2);
|
|
100
|
-
});
|
|
101
|
-
// Scope of detach code and fixtures
|
|
102
|
-
{
|
|
103
|
-
for (let startIndex = 0; startIndex < 8; ++startIndex) {
|
|
104
|
-
for (let endIndex = startIndex; endIndex < 8; ++endIndex) {
|
|
105
|
-
it(`works for Detach [${startIndex} -> ${endIndex}]`, () => {
|
|
106
|
-
const leftTraitNodes = [
|
|
107
|
-
testTree.buildLeaf(testTree.generateNodeId()),
|
|
108
|
-
testTree.left,
|
|
109
|
-
testTree.buildLeaf(testTree.generateNodeId()),
|
|
110
|
-
];
|
|
111
|
-
const places = leftTraitPlaces(testTree, leftTraitNodes);
|
|
112
|
-
sharedTree.applyEdit(...Change.insertTree(leftTraitNodes[0], StablePlace.before(testTree.left)));
|
|
113
|
-
afterEdit();
|
|
114
|
-
sharedTree.applyEdit(...Change.insertTree(leftTraitNodes[2], StablePlace.after(testTree.left)));
|
|
115
|
-
afterEdit();
|
|
116
|
-
expect(sharedTree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(3);
|
|
117
|
-
const range = {
|
|
118
|
-
start: places[startIndex].place,
|
|
119
|
-
end: places[endIndex].place,
|
|
120
|
-
};
|
|
121
|
-
const countDetached = places[endIndex].index - places[startIndex].index;
|
|
122
|
-
const { id } = sharedTree.applyEdit(Change.delete(range));
|
|
123
|
-
afterEdit();
|
|
124
|
-
expect(sharedTree.edits.length).to.equal(4);
|
|
125
|
-
expect(sharedTree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(3 - countDetached);
|
|
126
|
-
if (!localMode) {
|
|
127
|
-
containerRuntimeFactory.processAllMessages();
|
|
128
|
-
}
|
|
129
|
-
// Undo testing
|
|
130
|
-
const undoId = expectDefined(undo(undoSharedTree, id));
|
|
131
|
-
if (!localMode) {
|
|
132
|
-
containerRuntimeFactory.processAllMessages();
|
|
133
|
-
}
|
|
134
|
-
expect(sharedTree.edits.length).to.equal(5);
|
|
135
|
-
expect(sharedTree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(3);
|
|
136
|
-
// Redo testing
|
|
137
|
-
redo(undoSharedTree, undoId);
|
|
138
|
-
if (!localMode) {
|
|
139
|
-
containerRuntimeFactory.processAllMessages();
|
|
140
|
-
}
|
|
141
|
-
expect(sharedTree.edits.length).to.equal(6);
|
|
142
|
-
expect(sharedTree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(3 - countDetached);
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
it('works for SetValue', () => {
|
|
148
|
-
const newNode = testTree.buildLeaf(testTree.generateNodeId());
|
|
149
|
-
sharedTree.applyEdit(...Change.insertTree(newNode, StablePlace.after(testTree.left)));
|
|
150
|
-
afterEdit();
|
|
151
|
-
const testPayload = 5;
|
|
152
|
-
const { id } = sharedTree.applyEdit(Change.setPayload(newNode.identifier, testPayload));
|
|
153
|
-
afterEdit();
|
|
154
|
-
expect(sharedTree.edits.length).to.equal(3);
|
|
155
|
-
if (!localMode) {
|
|
156
|
-
containerRuntimeFactory.processAllMessages();
|
|
157
|
-
}
|
|
158
|
-
// Undo testing
|
|
159
|
-
const undoId = expectDefined(undo(undoSharedTree, id));
|
|
160
|
-
if (!localMode) {
|
|
161
|
-
containerRuntimeFactory.processAllMessages();
|
|
162
|
-
}
|
|
163
|
-
expect(sharedTree.edits.length).to.equal(4);
|
|
164
|
-
// Check the node whose value was set now has an empty payload
|
|
165
|
-
const leftTraitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);
|
|
166
|
-
const nodeAfterUndo = sharedTree.currentView.getViewNode(leftTraitAfterUndo[1]);
|
|
167
|
-
expect(nodeAfterUndo.payload).to.be.undefined;
|
|
168
|
-
// Redo testing
|
|
169
|
-
redo(undoSharedTree, undoId);
|
|
170
|
-
if (!localMode) {
|
|
171
|
-
containerRuntimeFactory.processAllMessages();
|
|
172
|
-
}
|
|
173
|
-
expect(sharedTree.edits.length).to.equal(5);
|
|
174
|
-
// Check the inserted node was reinserted
|
|
175
|
-
const leftTraitAfterRedo = sharedTree.currentView.getTrait(testTree.left.traitLocation);
|
|
176
|
-
const nodeAfterRedo = sharedTree.currentView.getViewNode(leftTraitAfterRedo[1]);
|
|
177
|
-
expect(nodeAfterRedo.payload).equal(testPayload);
|
|
178
|
-
});
|
|
179
|
-
it('works for conflicting edits', () => {
|
|
180
|
-
const newNodeId = sharedTree.generateNodeId();
|
|
181
|
-
const newNode = buildLeaf(newNodeId);
|
|
182
|
-
sharedTree.applyEdit(...Change.insertTree(newNode, StablePlace.atStartOf(testTree.left.traitLocation)));
|
|
183
|
-
containerRuntimeFactory.processAllMessages();
|
|
184
|
-
// First tree deletes the new node under left trait
|
|
185
|
-
sharedTree.applyEdit(Change.detach(StableRange.only(newNode)));
|
|
186
|
-
afterEdit();
|
|
187
|
-
// Second tree also deletes new left node
|
|
188
|
-
const translatedNodeId = translateId(newNodeId, sharedTree, undoSharedTree);
|
|
189
|
-
const { id } = undoSharedTree.applyEdit(Change.detach(StableRange.only(translatedNodeId)));
|
|
190
|
-
afterEdit();
|
|
191
|
-
// Synchronize; the first tree's edit will apply but the second tree's will be invalid
|
|
192
|
-
if (!localMode) {
|
|
193
|
-
containerRuntimeFactory.processAllMessages();
|
|
194
|
-
}
|
|
195
|
-
// The undo should succeed but do nothing
|
|
196
|
-
undo(undoSharedTree, id);
|
|
197
|
-
// Check that the undo had no effect
|
|
198
|
-
const traitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);
|
|
199
|
-
expect(traitAfterUndo.length).equals(1);
|
|
200
|
-
});
|
|
201
|
-
if (testOutOfOrderRevert === true) {
|
|
202
|
-
it('works for out-of-order Insert', () => {
|
|
203
|
-
const firstNode = testTree.buildLeaf();
|
|
204
|
-
const secondNode = testTree.buildLeaf(testTree.generateNodeId());
|
|
205
|
-
const { id } = sharedTree.applyEdit(...Change.insertTree(firstNode, StablePlace.after(testTree.left)));
|
|
206
|
-
afterEdit();
|
|
207
|
-
sharedTree.applyEdit(...Change.insertTree(secondNode, StablePlace.after(testTree.left)));
|
|
208
|
-
afterEdit();
|
|
209
|
-
expect(sharedTree.edits.length).to.equal(3);
|
|
210
|
-
if (!localMode) {
|
|
211
|
-
containerRuntimeFactory.processAllMessages();
|
|
212
|
-
}
|
|
213
|
-
// Undo testing
|
|
214
|
-
const undoId = expectDefined(undo(undoSharedTree, id));
|
|
215
|
-
if (!localMode) {
|
|
216
|
-
containerRuntimeFactory.processAllMessages();
|
|
217
|
-
}
|
|
218
|
-
const editsAfterUndo = sharedTree.edits;
|
|
219
|
-
expect(editsAfterUndo.length).to.equal(4);
|
|
220
|
-
const leftTraitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);
|
|
221
|
-
expect(leftTraitAfterUndo.length).to.equal(2);
|
|
222
|
-
// Check that the node under the left trait is the second node
|
|
223
|
-
const nodeAfterUndo = sharedTree.currentView.getViewNode(leftTraitAfterUndo[1]);
|
|
224
|
-
expect(nodeAfterUndo.identifier).to.equal(secondNode.identifier);
|
|
225
|
-
// Redo testing
|
|
226
|
-
redo(undoSharedTree, undoId);
|
|
227
|
-
if (!localMode) {
|
|
228
|
-
containerRuntimeFactory.processAllMessages();
|
|
229
|
-
}
|
|
230
|
-
expect(sharedTree.edits.length).to.equal(5);
|
|
231
|
-
const leftTraitAfterRedo = sharedTree.currentView.getTrait(testTree.left.traitLocation);
|
|
232
|
-
expect(leftTraitAfterRedo.length).to.equal(3);
|
|
233
|
-
});
|
|
234
|
-
it('works for out-of-order Detach', () => {
|
|
235
|
-
const firstNode = testTree.buildLeaf(testTree.generateNodeId());
|
|
236
|
-
const secondNode = testTree.buildLeaf();
|
|
237
|
-
sharedTree.applyEdit(...Change.insertTree(firstNode, StablePlace.after(testTree.left)));
|
|
238
|
-
afterEdit();
|
|
239
|
-
const { id } = sharedTree.applyEdit(Change.delete(StableRange.only(firstNode)));
|
|
240
|
-
afterEdit();
|
|
241
|
-
sharedTree.applyEdit(...Change.insertTree(secondNode, StablePlace.after(testTree.left)));
|
|
242
|
-
afterEdit();
|
|
243
|
-
expect(sharedTree.edits.length).to.equal(4);
|
|
244
|
-
if (!localMode) {
|
|
245
|
-
containerRuntimeFactory.processAllMessages();
|
|
246
|
-
}
|
|
247
|
-
// Undo testing
|
|
248
|
-
const undoId = expectDefined(undo(undoSharedTree, id));
|
|
249
|
-
if (!localMode) {
|
|
250
|
-
containerRuntimeFactory.processAllMessages();
|
|
251
|
-
}
|
|
252
|
-
expect(sharedTree.edits.length).to.equal(5);
|
|
253
|
-
const leftTraitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);
|
|
254
|
-
expect(leftTraitAfterUndo.length).to.equal(3);
|
|
255
|
-
// Check the first node is the second one under the left trait
|
|
256
|
-
const nodeAfterUndo = sharedTree.currentView.getViewNode(leftTraitAfterUndo[1]);
|
|
257
|
-
expect(nodeAfterUndo.identifier).to.equal(firstNode.identifier);
|
|
258
|
-
// Redo testing
|
|
259
|
-
redo(undoSharedTree, undoId);
|
|
260
|
-
if (!localMode) {
|
|
261
|
-
containerRuntimeFactory.processAllMessages();
|
|
262
|
-
}
|
|
263
|
-
expect(sharedTree.edits.length).to.equal(6);
|
|
264
|
-
const leftTraitAfterRedo = sharedTree.currentView.getTrait(testTree.left.traitLocation);
|
|
265
|
-
expect(leftTraitAfterRedo.length).to.equal(2);
|
|
266
|
-
});
|
|
267
|
-
it('works for out-of-order SetValue', () => {
|
|
268
|
-
const newNode = testTree.buildLeaf(testTree.generateNodeId());
|
|
269
|
-
sharedTree.applyEdit(...Change.insertTree(newNode, StablePlace.after(testTree.left)));
|
|
270
|
-
afterEdit();
|
|
271
|
-
const testPayload = 10;
|
|
272
|
-
const { id } = sharedTree.applyEdit(Change.setPayload(newNode.identifier, testPayload));
|
|
273
|
-
afterEdit();
|
|
274
|
-
sharedTree.applyEdit(...Change.insertTree(newNode, StablePlace.after(testTree.left)));
|
|
275
|
-
afterEdit();
|
|
276
|
-
expect(sharedTree.edits.length).to.equal(4);
|
|
277
|
-
if (!localMode) {
|
|
278
|
-
containerRuntimeFactory.processAllMessages();
|
|
279
|
-
}
|
|
280
|
-
// Undo testing
|
|
281
|
-
const undoId = expectDefined(undo(undoSharedTree, id));
|
|
282
|
-
if (!localMode) {
|
|
283
|
-
containerRuntimeFactory.processAllMessages();
|
|
284
|
-
}
|
|
285
|
-
expect(sharedTree.edits.length).to.equal(5);
|
|
286
|
-
// Check the node whose value was set now has an empty payload
|
|
287
|
-
const leftTraitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);
|
|
288
|
-
const nodeAfterUndo = sharedTree.currentView.getViewNode(leftTraitAfterUndo[1]);
|
|
289
|
-
expect(nodeAfterUndo.payload).to.be.undefined;
|
|
290
|
-
// Redo testing
|
|
291
|
-
redo(undoSharedTree, undoId);
|
|
292
|
-
if (!localMode) {
|
|
293
|
-
containerRuntimeFactory.processAllMessages();
|
|
294
|
-
}
|
|
295
|
-
expect(sharedTree.edits.length).to.equal(6);
|
|
296
|
-
// Check the inserted node was reinserted
|
|
297
|
-
const leftTraitAfterRedo = sharedTree.currentView.getTrait(testTree.left.traitLocation);
|
|
298
|
-
const nodeAfterRedo = sharedTree.currentView.getViewNode(leftTraitAfterRedo[1]);
|
|
299
|
-
expect(nodeAfterRedo.payload).equal(testPayload);
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Generate all possible places in the given trait
|
|
306
|
-
*/
|
|
307
|
-
function leftTraitPlaces(testTree, trait) {
|
|
308
|
-
const places = [];
|
|
309
|
-
places.push({ index: 0, place: StablePlace.atStartOf(testTree.left.traitLocation) });
|
|
310
|
-
for (let i = 0; i < trait.length; i++) {
|
|
311
|
-
places.push({ index: i, place: StablePlace.before(trait[i]) });
|
|
312
|
-
places.push({ index: i + 1, place: StablePlace.after(trait[i]) });
|
|
313
|
-
}
|
|
314
|
-
places.push({ index: 3, place: StablePlace.atEndOf(testTree.left.traitLocation) });
|
|
315
|
-
return places;
|
|
316
|
-
}
|
|
317
|
-
//# sourceMappingURL=UndoRedoTests.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UndoRedoTests.js","sourceRoot":"","sources":["../../../src/test/utilities/UndoRedoTests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAY,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,WAAW,EAA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AAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC/D,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KAClE;IACD,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACnF,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { MockContainerRuntimeFactory } from '@fluidframework/test-runtime-utils';\nimport { expect } from 'chai';\nimport { noop } from '../../Common.js';\nimport { DetachedSequenceId, EditId, NodeId } from '../../Identifiers.js';\nimport { TreeNodeHandle } from '../../TreeNodeHandle.js';\nimport { SharedTree } from '../../SharedTree.js';\nimport { Change, StablePlace, StableRange } from '../../ChangeTypes.js';\nimport { deepCompareNodes } from '../../EditUtilities.js';\nimport { NodeData } from '../../persisted-types/index.js';\nimport { expectDefined } from './TestCommon.js';\nimport { buildLeaf, TestTree } from './TestNode.js';\nimport { setUpTestSharedTree, setUpTestTree, translateId } from './TestUtilities.js';\n\n/** Options used to generate a SharedTree undo/redo test suite. */\ninterface SharedTreeUndoRedoOptions {\n\t/** Determines if the tests should be run in local state or connected state with a remote SharedTree */\n\tlocalMode: boolean;\n\t/** Title used for the test suite describe block. */\n\ttitle: string;\n\t/** Function for undoing an edit on a given tree. */\n\tundo: (tree: SharedTree, editId: EditId) => EditId | undefined;\n\t/** Function for redoing an edit on a given tree. */\n\tredo: (tree: SharedTree, editId: EditId) => EditId | undefined;\n\t/** Optional additional setup to run in a beforeEach block that takes the SharedTrees used in the tests. */\n\tbeforeEach?: (trees: SharedTree[]) => void;\n\t/**\n\t * Function to run after edits. Used for testing the SharedTreeUndoRedoHandler in order to close stack\n\t * operations between edits.\n\t */\n\tafterEdit?: () => void;\n\t/** If true, runs tests for out-of-order undo/redo. True by default. */\n\ttestOutOfOrderRevert?: boolean;\n}\n\n/**\n * Runs undo/redo tests for SharedTree\n */\nexport function runSharedTreeUndoRedoTestSuite(options: SharedTreeUndoRedoOptions): void {\n\tconst { localMode, title, undo, redo, beforeEach: additionalSetup } = options;\n\tconst afterEdit = options.afterEdit ?? noop;\n\tconst testOutOfOrderRevert = options.testOutOfOrderRevert ?? true;\n\n\tconst treeOptions = {\n\t\tlocalMode,\n\t\tallowInvalid: true,\n\t\tallowMalformed: true,\n\t};\n\n\tconst secondTreeOptions = {\n\t\tlocalMode,\n\t\tid: 'secondTestTree',\n\t\tallowInvalid: true,\n\t};\n\n\tdescribe(title, () => {\n\t\tlet testTree: TestTree;\n\t\tlet sharedTree: SharedTree;\n\t\tlet undoSharedTree: SharedTree;\n\t\tlet containerRuntimeFactory: MockContainerRuntimeFactory;\n\n\t\tfunction getTreeHandle() {\n\t\t\treturn new TreeNodeHandle(sharedTree.currentView, testTree.identifier);\n\t\t}\n\n\t\tbeforeEach(() => {\n\t\t\tconst setupResult = setUpTestSharedTree(treeOptions);\n\t\t\tsharedTree = setupResult.tree;\n\t\t\ttestTree = setUpTestTree(sharedTree);\n\t\t\tcontainerRuntimeFactory = setupResult.containerRuntimeFactory;\n\t\t\tconst secondTree = localMode\n\t\t\t\t? undefined\n\t\t\t\t: setUpTestSharedTree({ containerRuntimeFactory, ...secondTreeOptions }).tree;\n\t\t\tundoSharedTree = secondTree ?? sharedTree;\n\n\t\t\tif (additionalSetup !== undefined) {\n\t\t\t\tif (secondTree !== undefined) {\n\t\t\t\t\tadditionalSetup([sharedTree, undoSharedTree]);\n\t\t\t\t} else {\n\t\t\t\t\tadditionalSetup([sharedTree]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tit('can detach and re-insert the same node', () => {\n\t\t\tconst detachedId = 0 as DetachedSequenceId;\n\t\t\tconst { id } = sharedTree.applyEdit(\n\t\t\t\tChange.detach(StableRange.only(testTree.left), detachedId),\n\t\t\t\tChange.insert(detachedId, StablePlace.atStartOf(testTree.left.traitLocation))\n\t\t\t);\n\n\t\t\tif (!localMode) {\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t}\n\n\t\t\texpect(deepCompareNodes(getTreeHandle(), testTree)).to.be.true;\n\n\t\t\tconst undoId: EditId = expectDefined(undo(sharedTree, id));\n\t\t\tif (!localMode) {\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t}\n\n\t\t\texpect(deepCompareNodes(getTreeHandle(), testTree)).to.be.true;\n\n\t\t\tredo(sharedTree, undoId);\n\t\t\tif (!localMode) {\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t}\n\n\t\t\texpect(deepCompareNodes(getTreeHandle(), testTree)).to.be.true;\n\t\t});\n\n\t\tit('works for Insert', () => {\n\t\t\tconst newNode = testTree.buildLeaf();\n\n\t\t\tconst { id } = sharedTree.applyEdit(...Change.insertTree(newNode, StablePlace.after(testTree.left)));\n\t\t\tafterEdit();\n\t\t\texpect(sharedTree.edits.length).to.equal(2);\n\n\t\t\tif (!localMode) {\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t}\n\n\t\t\t// Undo testing\n\t\t\tconst undoId: EditId = expectDefined(undo(undoSharedTree, id));\n\n\t\t\tif (!localMode) {\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t}\n\n\t\t\texpect(sharedTree.edits.length).to.equal(3);\n\n\t\t\t// Check the inserted node was deleted\n\t\t\tconst leftTraitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);\n\t\t\texpect(leftTraitAfterUndo.length).to.equal(1);\n\n\t\t\t// Redo testing\n\t\t\tredo(undoSharedTree, undoId);\n\n\t\t\tif (!localMode) {\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t}\n\n\t\t\texpect(sharedTree.edits.length).to.equal(4);\n\n\t\t\t// Check the inserted node was reinserted\n\t\t\tconst leftTraitAfterRedo = sharedTree.currentView.getTrait(testTree.left.traitLocation);\n\t\t\texpect(leftTraitAfterRedo.length).to.equal(2);\n\t\t});\n\n\t\t// Scope of detach code and fixtures\n\t\t{\n\t\t\tfor (let startIndex = 0; startIndex < 8; ++startIndex) {\n\t\t\t\tfor (let endIndex = startIndex; endIndex < 8; ++endIndex) {\n\t\t\t\t\tit(`works for Detach [${startIndex} -> ${endIndex}]`, () => {\n\t\t\t\t\t\tconst leftTraitNodes = [\n\t\t\t\t\t\t\ttestTree.buildLeaf(testTree.generateNodeId()),\n\t\t\t\t\t\t\ttestTree.left,\n\t\t\t\t\t\t\ttestTree.buildLeaf(testTree.generateNodeId()),\n\t\t\t\t\t\t];\n\t\t\t\t\t\tconst places = leftTraitPlaces(testTree, leftTraitNodes);\n\n\t\t\t\t\t\tsharedTree.applyEdit(\n\t\t\t\t\t\t\t...Change.insertTree(leftTraitNodes[0], StablePlace.before(testTree.left))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tafterEdit();\n\t\t\t\t\t\tsharedTree.applyEdit(...Change.insertTree(leftTraitNodes[2], StablePlace.after(testTree.left)));\n\t\t\t\t\t\tafterEdit();\n\t\t\t\t\t\texpect(sharedTree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(3);\n\n\t\t\t\t\t\tconst range = {\n\t\t\t\t\t\t\tstart: places[startIndex].place,\n\t\t\t\t\t\t\tend: places[endIndex].place,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst countDetached = places[endIndex].index - places[startIndex].index;\n\t\t\t\t\t\tconst { id } = sharedTree.applyEdit(Change.delete(range));\n\t\t\t\t\t\tafterEdit();\n\n\t\t\t\t\t\texpect(sharedTree.edits.length).to.equal(4);\n\t\t\t\t\t\texpect(sharedTree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(\n\t\t\t\t\t\t\t3 - countDetached\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (!localMode) {\n\t\t\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Undo testing\n\t\t\t\t\t\tconst undoId: EditId = expectDefined(undo(undoSharedTree, id));\n\n\t\t\t\t\t\tif (!localMode) {\n\t\t\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\texpect(sharedTree.edits.length).to.equal(5);\n\t\t\t\t\t\texpect(sharedTree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(3);\n\n\t\t\t\t\t\t// Redo testing\n\t\t\t\t\t\tredo(undoSharedTree, undoId);\n\n\t\t\t\t\t\tif (!localMode) {\n\t\t\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\texpect(sharedTree.edits.length).to.equal(6);\n\t\t\t\t\t\texpect(sharedTree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(\n\t\t\t\t\t\t\t3 - countDetached\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tit('works for SetValue', () => {\n\t\t\tconst newNode = testTree.buildLeaf(testTree.generateNodeId());\n\n\t\t\tsharedTree.applyEdit(...Change.insertTree(newNode, StablePlace.after(testTree.left)));\n\t\t\tafterEdit();\n\t\t\tconst testPayload = 5;\n\t\t\tconst { id } = sharedTree.applyEdit(Change.setPayload(newNode.identifier, testPayload));\n\t\t\tafterEdit();\n\t\t\texpect(sharedTree.edits.length).to.equal(3);\n\n\t\t\tif (!localMode) {\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t}\n\n\t\t\t// Undo testing\n\t\t\tconst undoId: EditId = expectDefined(undo(undoSharedTree, id));\n\n\t\t\tif (!localMode) {\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t}\n\n\t\t\texpect(sharedTree.edits.length).to.equal(4);\n\n\t\t\t// Check the node whose value was set now has an empty payload\n\t\t\tconst leftTraitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);\n\t\t\tconst nodeAfterUndo = sharedTree.currentView.getViewNode(leftTraitAfterUndo[1]);\n\t\t\texpect(nodeAfterUndo.payload).to.be.undefined;\n\n\t\t\t// Redo testing\n\t\t\tredo(undoSharedTree, undoId);\n\n\t\t\tif (!localMode) {\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t}\n\n\t\t\texpect(sharedTree.edits.length).to.equal(5);\n\n\t\t\t// Check the inserted node was reinserted\n\t\t\tconst leftTraitAfterRedo = sharedTree.currentView.getTrait(testTree.left.traitLocation);\n\t\t\tconst nodeAfterRedo = sharedTree.currentView.getViewNode(leftTraitAfterRedo[1]);\n\t\t\texpect(nodeAfterRedo.payload).equal(testPayload);\n\t\t});\n\n\t\tit('works for conflicting edits', () => {\n\t\t\tconst newNodeId = sharedTree.generateNodeId();\n\t\t\tconst newNode = buildLeaf(newNodeId);\n\t\t\tsharedTree.applyEdit(...Change.insertTree(newNode, StablePlace.atStartOf(testTree.left.traitLocation)));\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\t// First tree deletes the new node under left trait\n\t\t\tsharedTree.applyEdit(Change.detach(StableRange.only(newNode)));\n\t\t\tafterEdit();\n\n\t\t\t// Second tree also deletes new left node\n\t\t\tconst translatedNodeId = translateId(newNodeId, sharedTree, undoSharedTree);\n\t\t\tconst { id } = undoSharedTree.applyEdit(Change.detach(StableRange.only(translatedNodeId)));\n\t\t\tafterEdit();\n\n\t\t\t// Synchronize; the first tree's edit will apply but the second tree's will be invalid\n\t\t\tif (!localMode) {\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t}\n\n\t\t\t// The undo should succeed but do nothing\n\t\t\tundo(undoSharedTree, id);\n\n\t\t\t// Check that the undo had no effect\n\t\t\tconst traitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);\n\t\t\texpect(traitAfterUndo.length).equals(1);\n\t\t});\n\n\t\tif (testOutOfOrderRevert === true) {\n\t\t\tit('works for out-of-order Insert', () => {\n\t\t\t\tconst firstNode = testTree.buildLeaf();\n\t\t\t\tconst secondNode = testTree.buildLeaf(testTree.generateNodeId());\n\n\t\t\t\tconst { id } = sharedTree.applyEdit(...Change.insertTree(firstNode, StablePlace.after(testTree.left)));\n\t\t\t\tafterEdit();\n\t\t\t\tsharedTree.applyEdit(...Change.insertTree(secondNode, StablePlace.after(testTree.left)));\n\t\t\t\tafterEdit();\n\t\t\t\texpect(sharedTree.edits.length).to.equal(3);\n\n\t\t\t\tif (!localMode) {\n\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t}\n\n\t\t\t\t// Undo testing\n\t\t\t\tconst undoId: EditId = expectDefined(undo(undoSharedTree, id));\n\n\t\t\t\tif (!localMode) {\n\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t}\n\n\t\t\t\tconst editsAfterUndo = sharedTree.edits;\n\t\t\t\texpect(editsAfterUndo.length).to.equal(4);\n\n\t\t\t\tconst leftTraitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);\n\t\t\t\texpect(leftTraitAfterUndo.length).to.equal(2);\n\n\t\t\t\t// Check that the node under the left trait is the second node\n\t\t\t\tconst nodeAfterUndo = sharedTree.currentView.getViewNode(leftTraitAfterUndo[1]);\n\t\t\t\texpect(nodeAfterUndo.identifier).to.equal(secondNode.identifier);\n\n\t\t\t\t// Redo testing\n\t\t\t\tredo(undoSharedTree, undoId);\n\n\t\t\t\tif (!localMode) {\n\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t}\n\n\t\t\t\texpect(sharedTree.edits.length).to.equal(5);\n\n\t\t\t\tconst leftTraitAfterRedo = sharedTree.currentView.getTrait(testTree.left.traitLocation);\n\t\t\t\texpect(leftTraitAfterRedo.length).to.equal(3);\n\t\t\t});\n\n\t\t\tit('works for out-of-order Detach', () => {\n\t\t\t\tconst firstNode = testTree.buildLeaf(testTree.generateNodeId());\n\t\t\t\tconst secondNode = testTree.buildLeaf();\n\n\t\t\t\tsharedTree.applyEdit(...Change.insertTree(firstNode, StablePlace.after(testTree.left)));\n\t\t\t\tafterEdit();\n\t\t\t\tconst { id } = sharedTree.applyEdit(Change.delete(StableRange.only(firstNode)));\n\t\t\t\tafterEdit();\n\t\t\t\tsharedTree.applyEdit(...Change.insertTree(secondNode, StablePlace.after(testTree.left)));\n\t\t\t\tafterEdit();\n\t\t\t\texpect(sharedTree.edits.length).to.equal(4);\n\n\t\t\t\tif (!localMode) {\n\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t}\n\n\t\t\t\t// Undo testing\n\t\t\t\tconst undoId: EditId = expectDefined(undo(undoSharedTree, id));\n\n\t\t\t\tif (!localMode) {\n\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t}\n\n\t\t\t\texpect(sharedTree.edits.length).to.equal(5);\n\n\t\t\t\tconst leftTraitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);\n\t\t\t\texpect(leftTraitAfterUndo.length).to.equal(3);\n\n\t\t\t\t// Check the first node is the second one under the left trait\n\t\t\t\tconst nodeAfterUndo = sharedTree.currentView.getViewNode(leftTraitAfterUndo[1]);\n\t\t\t\texpect(nodeAfterUndo.identifier).to.equal(firstNode.identifier);\n\n\t\t\t\t// Redo testing\n\t\t\t\tredo(undoSharedTree, undoId);\n\n\t\t\t\tif (!localMode) {\n\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t}\n\n\t\t\t\texpect(sharedTree.edits.length).to.equal(6);\n\n\t\t\t\tconst leftTraitAfterRedo = sharedTree.currentView.getTrait(testTree.left.traitLocation);\n\t\t\t\texpect(leftTraitAfterRedo.length).to.equal(2);\n\t\t\t});\n\n\t\t\tit('works for out-of-order SetValue', () => {\n\t\t\t\tconst newNode = testTree.buildLeaf(testTree.generateNodeId());\n\n\t\t\t\tsharedTree.applyEdit(...Change.insertTree(newNode, StablePlace.after(testTree.left)));\n\t\t\t\tafterEdit();\n\t\t\t\tconst testPayload = 10;\n\t\t\t\tconst { id } = sharedTree.applyEdit(Change.setPayload(newNode.identifier, testPayload));\n\t\t\t\tafterEdit();\n\t\t\t\tsharedTree.applyEdit(...Change.insertTree(newNode, StablePlace.after(testTree.left)));\n\t\t\t\tafterEdit();\n\t\t\t\texpect(sharedTree.edits.length).to.equal(4);\n\n\t\t\t\tif (!localMode) {\n\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t}\n\n\t\t\t\t// Undo testing\n\t\t\t\tconst undoId: EditId = expectDefined(undo(undoSharedTree, id));\n\n\t\t\t\tif (!localMode) {\n\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t}\n\n\t\t\t\texpect(sharedTree.edits.length).to.equal(5);\n\n\t\t\t\t// Check the node whose value was set now has an empty payload\n\t\t\t\tconst leftTraitAfterUndo = sharedTree.currentView.getTrait(testTree.left.traitLocation);\n\t\t\t\tconst nodeAfterUndo = sharedTree.currentView.getViewNode(leftTraitAfterUndo[1]);\n\t\t\t\texpect(nodeAfterUndo.payload).to.be.undefined;\n\n\t\t\t\t// Redo testing\n\t\t\t\tredo(undoSharedTree, undoId);\n\n\t\t\t\tif (!localMode) {\n\t\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\t\t}\n\n\t\t\t\texpect(sharedTree.edits.length).to.equal(6);\n\n\t\t\t\t// Check the inserted node was reinserted\n\t\t\t\tconst leftTraitAfterRedo = sharedTree.currentView.getTrait(testTree.left.traitLocation);\n\t\t\t\tconst nodeAfterRedo = sharedTree.currentView.getViewNode(leftTraitAfterRedo[1]);\n\t\t\t\texpect(nodeAfterRedo.payload).equal(testPayload);\n\t\t\t});\n\t\t}\n\t});\n}\n\n/**\n * Generate all possible places in the given trait\n */\nfunction leftTraitPlaces(testTree: TestTree, trait: NodeData<NodeId>[]): { index: number; place: StablePlace }[] {\n\tconst places: { index: number; place: StablePlace }[] = [];\n\tplaces.push({ index: 0, place: StablePlace.atStartOf(testTree.left.traitLocation) });\n\tfor (let i = 0; i < trait.length; i++) {\n\t\tplaces.push({ index: i, place: StablePlace.before(trait[i]) });\n\t\tplaces.push({ index: i + 1, place: StablePlace.after(trait[i]) });\n\t}\n\tplaces.push({ index: 3, place: StablePlace.atEndOf(testTree.left.traitLocation) });\n\treturn places;\n}\n"]}
|
|
File without changes
|