@@ -23,8 +23,7 @@ function MyComponent() {
2323 );
2424}
2525` ;
26-
27- const sections = findSections ( text ) ;
26+ const sections = findSections ( text , 'jsx' ) ;
2827 assert . strictEqual ( sections . length , 3 ) ;
2928 assert . strictEqual ( sections [ 0 ] . name , 'Main Component' ) ;
3029 assert . strictEqual ( sections [ 0 ] . depth , 1 ) ;
@@ -62,29 +61,23 @@ function Layout() {
6261 );
6362}
6463` ;
65-
66- const sections = findSections ( text ) ;
64+ const sections = findSections ( text , 'jsx' ) ;
6765 assert . strictEqual ( sections . length , 5 ) ;
68-
6966 // Main Layout (depth 1)
7067 assert . strictEqual ( sections [ 0 ] . name , 'Main Layout' ) ;
7168 assert . strictEqual ( sections [ 0 ] . depth , 1 ) ;
72-
7369 // Navigation (depth 2)
7470 assert . strictEqual ( sections [ 1 ] . name , 'Navigation' ) ;
7571 assert . strictEqual ( sections [ 1 ] . depth , 2 ) ;
7672 assert . strictEqual ( sections [ 1 ] . parentName , sections [ 0 ] . uniqueId ) ;
77-
7873 // Menu Items (depth 3)
7974 assert . strictEqual ( sections [ 2 ] . name , 'Menu Items' ) ;
8075 assert . strictEqual ( sections [ 2 ] . depth , 3 ) ;
8176 assert . strictEqual ( sections [ 2 ] . parentName , sections [ 1 ] . uniqueId ) ;
82-
8377 // User Actions (depth 3)
8478 assert . strictEqual ( sections [ 3 ] . name , 'User Actions' ) ;
8579 assert . strictEqual ( sections [ 3 ] . depth , 3 ) ;
8680 assert . strictEqual ( sections [ 3 ] . parentName , sections [ 1 ] . uniqueId ) ;
87-
8881 // Main Content (depth 2)
8982 assert . strictEqual ( sections [ 4 ] . name , 'Main Content' ) ;
9083 assert . strictEqual ( sections [ 4 ] . depth , 2 ) ;
@@ -98,8 +91,7 @@ function Component() {
9891 return <div></div>;
9992}
10093` ;
101-
102- const sections = findSections ( text ) ;
94+ const sections = findSections ( text , 'jsx' ) ;
10395 assert . strictEqual ( sections . length , 1 ) ;
10496 assert . strictEqual ( sections [ 0 ] . name , 'Spaced Section' ) ;
10597 assert . strictEqual ( sections [ 0 ] . depth , 1 ) ;
@@ -113,8 +105,7 @@ function Component() {
113105 return <div></div>;
114106}
115107` ;
116-
117- const sections = findSections ( text ) ;
108+ const sections = findSections ( text , 'jsx' ) ;
118109 assert . strictEqual ( sections . length , 1 ) ;
119110 assert . strictEqual ( sections [ 0 ] . name , 'Valid Section' ) ;
120111 } ) ;
@@ -129,8 +120,7 @@ function Component() {
129120 return <div></div>;
130121}
131122` ;
132-
133- const sections = findSections ( text ) ;
123+ const sections = findSections ( text , 'jsx' ) ;
134124 assert . strictEqual ( sections . length , 1 ) ;
135125 assert . strictEqual ( sections [ 0 ] . name , 'Proper Section' ) ;
136126 } ) ;
@@ -150,8 +140,7 @@ function Component() {
150140 );
151141}
152142` ;
153-
154- const sections = findSections ( text ) ;
143+ const sections = findSections ( text , 'jsx' ) ;
155144 assert . strictEqual ( sections . length , 3 ) ;
156145 assert . strictEqual ( sections [ 0 ] . name , 'Traditional JS Comment' ) ;
157146 assert . strictEqual ( sections [ 0 ] . depth , 1 ) ;
@@ -185,8 +174,7 @@ const MyComponent: React.FC<Props> = ({ title }) => {
185174 );
186175};
187176` ;
188-
189- const sections = findSections ( text ) ;
177+ const sections = findSections ( text , 'tsx' ) ;
190178 assert . strictEqual ( sections . length , 3 ) ;
191179 assert . strictEqual ( sections [ 0 ] . name , 'Component Definition' ) ;
192180 assert . strictEqual ( sections [ 0 ] . depth , 1 ) ;
0 commit comments