@inshapardaz/likhari-converters 0.1.0 → 0.1.1-dev.11
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inshapardaz/likhari-converters",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-dev.11",
|
|
4
4
|
"description": "Format transformers (Markdown/HTML/plain-text/Lexical JSON) against the canonical Lexical EditorState, isolated from UI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/plain-text/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { plainTextConverter } from './index.js';
|
|
3
|
-
import { lexicalJsonConverter } from '../lexical-json/index.js';
|
|
4
|
-
describe('plainTextConverter', () => {
|
|
5
|
-
it('joins paragraph blocks with a blank line', () => {
|
|
6
|
-
const state = plainTextConverter.parse('Hello world\n\nSecond paragraph');
|
|
7
|
-
const text = plainTextConverter.serialize(state);
|
|
8
|
-
expect(text).toBe('Hello world\n\nSecond paragraph');
|
|
9
|
-
});
|
|
10
|
-
it('round-trips through lexical-json unchanged', () => {
|
|
11
|
-
const state = plainTextConverter.parse('One\n\nTwo\n\nThree');
|
|
12
|
-
const json = lexicalJsonConverter.serialize(state);
|
|
13
|
-
const restored = lexicalJsonConverter.parse(json);
|
|
14
|
-
expect(plainTextConverter.serialize(restored)).toBe('One\n\nTwo\n\nThree');
|
|
15
|
-
});
|
|
16
|
-
it('produces a single empty paragraph for empty input', () => {
|
|
17
|
-
const state = plainTextConverter.parse('');
|
|
18
|
-
expect(state.root.children).toHaveLength(1);
|
|
19
|
-
expect(plainTextConverter.serialize(state)).toBe('');
|
|
20
|
-
});
|
|
21
|
-
});
|