This commit is contained in:
Kevin Jahns 2021-01-09 14:45:51 +01:00
parent 728bb6f1b2
commit edc1f9418f

View File

@ -78,6 +78,29 @@ export const testBasicFormat = tc => {
compare(users)
}
/**
* @param {t.TestCase} tc
*/
export const testMultilineFormat = tc => {
const ydoc = new Y.Doc()
const testText = ydoc.getText('test')
testText.insert(0, 'Test\nMulti-line\nFormatting')
testText.applyDelta([
{ retain: 4, attributes: { bold: true } },
{ retain: 1 }, // newline character
{ retain: 10, attributes: { bold: true } },
{ retain: 1 }, // newline character
{ retain: 10, attributes: { bold: true } }
])
t.compare(testText.toDelta(), [
{ insert: 'Test', attributes: { bold: true } },
{ insert: '\n' },
{ insert: 'Multi-line', attributes: { bold: true } },
{ insert: '\n' },
{ insert: 'Formatting', attributes: { bold: true } }
])
}
/**
* @param {t.TestCase} tc
*/
@ -286,7 +309,9 @@ export const testBestCase = tc => {
}
const tryGc = () => {
// @ts-ignore
if (typeof global !== 'undefined' && global.gc) {
// @ts-ignore
global.gc()
}
}