4.1: the review's test and comment fixes
This commit is contained in:
+1
-1
@@ -72,7 +72,7 @@ export function isAdfMark(value: unknown): value is AdfMark {
|
||||
return !('attrs' in value) || isAttributes(value['attrs'])
|
||||
}
|
||||
|
||||
export function nodeAttrs(node: { attrs?: AdfAttributes }): AdfAttributes {
|
||||
export function nodeAttrs(node: { attrs?: AdfAttributes }): Readonly<AdfAttributes> {
|
||||
return node.attrs ?? {}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ test('merges adjacent text nodes carrying identical marks, at every level', () =
|
||||
{ text: 'e', type: 'text' },
|
||||
{ attrs: { localId: '01a0a06b-5281-7f27-9022-8d3a74b0ab0d' }, text: 'f', type: 'text' },
|
||||
{ text: 'g', type: 'text' },
|
||||
{ attrs: {}, text: 'h', type: 'text' },
|
||||
]
|
||||
assert.deepEqual(toEditorNormal({ content: [{ attrs: { panelType: 'info' }, content: [{ content, type: 'paragraph' }], type: 'panel' }], type: 'doc', version: 1 }), {
|
||||
content: [
|
||||
@@ -27,7 +28,7 @@ test('merges adjacent text nodes carrying identical marks, at every level', () =
|
||||
{ type: 'hardBreak' },
|
||||
{ text: 'e', type: 'text' },
|
||||
{ attrs: { localId: '01a0a06b-5281-7f27-9022-8d3a74b0ab0d' }, text: 'f', type: 'text' },
|
||||
{ text: 'g', type: 'text' },
|
||||
{ text: 'gh', type: 'text' },
|
||||
],
|
||||
type: 'paragraph',
|
||||
},
|
||||
|
||||
@@ -11,7 +11,6 @@ export function sameMark(candidate: AdfMark, mark: AdfMark): boolean {
|
||||
return markKey(candidate) === markKey(mark)
|
||||
}
|
||||
|
||||
// AGENTS.md §2: adjacent text nodes carrying identical marks and no attributes are one node.
|
||||
export function mergeAdjacentText(nodes: readonly AdfNode[]): AdfNode[] {
|
||||
const merged: AdfNode[] = []
|
||||
for (const node of nodes) {
|
||||
|
||||
Reference in New Issue
Block a user