This repository has been archived by the owner on Jan 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(draft): new draft logic (#1489)
- Loading branch information
Showing
15 changed files
with
1,194 additions
and
805 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {Block, BlockNode, Document} from '@mintter/shared' | ||
import {describe, expect, test} from 'vitest' | ||
import {createBlocksMap} from '../documents' | ||
|
||
describe('Draft transformations', () => { | ||
describe('backend to blockMap', () => { | ||
test('single block', () => { | ||
let inputBlock = new Block({ | ||
id: '1', | ||
text: 'hello', | ||
annotations: [], | ||
attributes: {}, | ||
}) | ||
let input = new Document({ | ||
children: [ | ||
new BlockNode({ | ||
block: inputBlock, | ||
children: [], | ||
}), | ||
], | ||
}) | ||
|
||
let output = { | ||
'1': { | ||
parent: '', | ||
left: '', | ||
block: inputBlock, | ||
}, | ||
} | ||
|
||
expect(createBlocksMap(input)).toEqual(output) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.