4.1: the review's test and comment fixes

This commit is contained in:
2026-09-14 19:37:37 +02:00
parent 7672531cdc
commit 276433d635
7 changed files with 7 additions and 28 deletions
+1 -1
View File
@@ -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 ?? {}
}
+2 -1
View File
@@ -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',
},
-1
View File
@@ -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) {