From a77221ffd2defe61eaf4a19a804fefc31d661acb Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Fri, 19 Nov 2021 16:36:58 +0100 Subject: [PATCH] fix toJSON value --- src/types/YArray.js | 2 +- src/utils/ListIterator.js | 2 +- tests/doc.tests.js | 1 + tests/undo-redo.tests.js | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/types/YArray.js b/src/types/YArray.js index cd1cad71..0fc6f70f 100644 --- a/src/types/YArray.js +++ b/src/types/YArray.js @@ -2,7 +2,6 @@ * @module YArray */ -import { useSearchMarker } from 'tests/testHelper.js' import { YEvent, AbstractType, @@ -10,6 +9,7 @@ import { callTypeObservers, transact, ListIterator, + useSearchMarker, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Transaction, Item // eslint-disable-line } from '../internals.js' diff --git a/src/utils/ListIterator.js b/src/utils/ListIterator.js index fe6da753..cfa03692 100644 --- a/src/utils/ListIterator.js +++ b/src/utils/ListIterator.js @@ -430,6 +430,6 @@ const sliceArrayContent = (itemcontent, start, len) => { * @param {Array} added */ const concatArrayContent = (content, added) => { - content.push(added) + content.push(...added) return content } diff --git a/tests/doc.tests.js b/tests/doc.tests.js index 994ecaeb..c167019e 100644 --- a/tests/doc.tests.js +++ b/tests/doc.tests.js @@ -40,6 +40,7 @@ export const testToJSON = tc => { const arr = doc.getArray('array') arr.push(['test1']) + t.compare(arr.toJSON(), ['test1']) const map = doc.getMap('map') map.set('k1', 'v1') diff --git a/tests/undo-redo.tests.js b/tests/undo-redo.tests.js index 991225ca..1bf25c82 100644 --- a/tests/undo-redo.tests.js +++ b/tests/undo-redo.tests.js @@ -1,4 +1,4 @@ -import { init, compare, applyRandomTests, Doc } from './testHelper.js' // eslint-disable-line +import { init, compare, applyRandomTests, Doc, UndoManager } from './testHelper.js' // eslint-disable-line import * as Y from '../src/index.js' import * as t from 'lib0/testing'