@@ -13,6 +13,7 @@ import {
1313 defaultTaskId ,
1414 addNote ,
1515 extractSections ,
16+ extractUnsectionedBody ,
1617 initProtocol ,
1718 loadTask ,
1819 slugify ,
@@ -108,6 +109,45 @@ describe("Taskr protocol", () => {
108109 expect ( sections [ "Progress Log" ] ) . toBe ( "Empty." ) ;
109110 } ) ;
110111
112+ it ( "keeps content outside protocol sections available for detail rendering" , ( ) => {
113+ const body = [
114+ "# Task title already shown in detail header" ,
115+ "" ,
116+ "Intro note before sections." ,
117+ "" ,
118+ "## Request" ,
119+ "" ,
120+ "Do the work." ,
121+ "" ,
122+ "## Test HTML Fragments" ,
123+ "" ,
124+ '<section class="demo">' ,
125+ " <h3>Rendered</h3>" ,
126+ "</section>" ,
127+ "" ,
128+ "## Acceptance Criteria" ,
129+ "" ,
130+ "- [ ] It works." ,
131+ ] . join ( "\n" ) ;
132+
133+ expect ( extractSections ( body ) ) . toMatchObject ( {
134+ Request : "Do the work." ,
135+ "Acceptance Criteria" : "- [ ] It works." ,
136+ "Test HTML Fragments" : '<section class="demo">\n <h3>Rendered</h3>\n</section>' ,
137+ } ) ;
138+ expect ( extractUnsectionedBody ( body ) ) . toBe (
139+ [
140+ "Intro note before sections." ,
141+ "" ,
142+ "## Test HTML Fragments" ,
143+ "" ,
144+ '<section class="demo">' ,
145+ " <h3>Rendered</h3>" ,
146+ "</section>" ,
147+ ] . join ( "\n" ) ,
148+ ) ;
149+ } ) ;
150+
111151 it ( "creates opt-in research report files and records task references" , ( ) => {
112152 const repo = tempRepo ( ) ;
113153 initProtocol ( repo ) ;
@@ -215,6 +255,7 @@ describe("Taskr protocol", () => {
215255 expect (
216256 model . tasks . find ( ( task ) => task . id === "implement-board-visualization" ) ?. sections . Request ,
217257 ) . toContain ( "Implement board visualization" ) ;
258+ expect ( model . tasks [ 0 ] . unsectionedBody ) . toBe ( "" ) ;
218259 expect ( model . tasks [ 0 ] . createdAt ) . toMatch ( / ^ \d { 4 } - \d { 2 } - \d { 2 } T / ) ;
219260 expect ( html ) . toContain ( "Taskr Board" ) ;
220261 expect ( html ) . toContain ( boardStyles ) ;
@@ -267,7 +308,7 @@ describe("Taskr protocol", () => {
267308 expect ( html ) . toContain ( "commitStatusLabel" ) ;
268309 expect ( html ) . toContain ( "renderTaskrMarkdown" ) ;
269310 expect ( html ) . toContain ( "markdown-content" ) ;
270- expect ( html ) . toContain ( "detailSectionNames " ) ;
311+ expect ( html ) . toContain ( "coreSectionNames " ) ;
271312 expect ( html ) . toContain ( "grid-template-columns: auto minmax(0, 1fr);" ) ;
272313 expect ( html ) . toContain ( "appearance: none;" ) ;
273314 expect ( html ) . toContain ( "border-color: rgba(34, 197, 94, 0.72);" ) ;
0 commit comments