@@ -4,7 +4,7 @@ import { describe, it, expect, beforeEach } from 'vitest';
44import { TestBed } from '@angular/core/testing' ;
55import { Component , signal } from '@angular/core' ;
66import { views } from '@threadplane/render' ;
7- import type { MarkdownTableRowNode } from '@cacheplane/partial-markdown' ;
7+ import type { MarkdownTableCellNode , MarkdownTableRowNode } from '@cacheplane/partial-markdown' ;
88import { MarkdownTableRowComponent } from './markdown-table-row.component' ;
99import { MarkdownTableCellComponent } from './markdown-table-cell.component' ;
1010import { MARKDOWN_VIEW_REGISTRY } from '../markdown-view-registry' ;
@@ -18,6 +18,15 @@ function makeRowNode(isHeader: boolean, children: MarkdownTableRowNode['children
1818 } as MarkdownTableRowNode ;
1919}
2020
21+ function makeCellNode ( id : number ) : MarkdownTableCellNode {
22+ return {
23+ id, type : 'table-cell' , status : 'complete' ,
24+ parent : null , index : null ,
25+ alignment : null ,
26+ children : [ ] ,
27+ } as MarkdownTableCellNode ;
28+ }
29+
2130@Component ( {
2231 standalone : true ,
2332 imports : [ MarkdownTableRowComponent ] ,
@@ -64,4 +73,17 @@ describe('MarkdownTableRowComponent', () => {
6473 const tr = fixture . nativeElement . querySelector ( 'tr' ) ;
6574 expect ( tr . classList . contains ( 'chat-md-table-row--header' ) ) . toBe ( true ) ;
6675 } ) ;
76+
77+ it ( 'renders table-cell components directly under the table row' , ( ) => {
78+ const fixture = TestBed . createComponent ( HostComponent ) ;
79+ fixture . componentInstance . node . set ( makeRowNode ( false , [
80+ makeCellNode ( 3 ) ,
81+ makeCellNode ( 4 ) ,
82+ ] as MarkdownTableRowNode [ 'children' ] ) ) ;
83+ fixture . detectChanges ( ) ;
84+
85+ const tr = fixture . nativeElement . querySelector ( 'tr' ) ;
86+ expect ( tr . querySelector ( ':scope > chat-md-children' ) ) . toBeNull ( ) ;
87+ expect ( tr . querySelectorAll ( ':scope > chat-md-table-cell' ) . length ) . toBe ( 2 ) ;
88+ } ) ;
6789} ) ;
0 commit comments