File tree Expand file tree Collapse file tree
workspace-mcp-server/src/__tests__/mocks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515class MockElement {
1616 tagName : string ;
17- textContent : string ;
1817 nodeType : number ;
1918 childNodes : MockNode [ ] ;
2019 nextSibling : MockNode | null ;
2120 attributes : { [ key : string ] : string } ;
2221
2322 constructor ( tagName : string ) {
2423 this . tagName = tagName ;
25- this . textContent = '' ;
2624 this . nodeType = 1 ; // Element node
2725 this . childNodes = [ ] ;
2826 this . nextSibling = null ;
2927 this . attributes = { } ;
3028 }
3129
30+ get textContent ( ) : string {
31+ return this . childNodes . map ( child => child . textContent ) . join ( '' ) ;
32+ }
33+
34+
3235 toLowerCase ( ) {
3336 return this . tagName . toLowerCase ( ) ;
3437 }
@@ -68,7 +71,7 @@ class MockDocument {
6871 querySelector ( selector : string ) : MockElement | null {
6972 // Simple implementation for our use case (mostly just tag names)
7073 const tagName = selector . toUpperCase ( ) ;
71-
74+
7275 const queue : MockNode [ ] = [ ...this . body . childNodes ] ;
7376 while ( queue . length > 0 ) {
7477 const node = queue . shift ( ) ! ;
You can’t perform that action at this time.
0 commit comments