@@ -132,19 +132,41 @@ suite.define(() => {
132132 probe . className = "chat-text" ;
133133 probe . style . width = "900px" ;
134134 probe . innerHTML = `
135+ <ol class="probe-list"><li>First</li></ol>
136+ <blockquote class="probe-quote"><p>Quoted block</p></blockquote>
135137 <table>
136138 <thead><tr><th>Dimension</th><th>Sentiment signal</th></tr></thead>
137139 <tbody><tr><td>Demographics</td><td>Experience-dependent sentiment.</td></tr></tbody>
138140 </table>
139- <ol><li>One central pattern</li><li>Another central pattern</li></ol>
140- <p><strong>Overall characterization:</strong> Pragmatic adoption under suspicion.</p>
141+ <p class="probe-table-copy"><strong>Overall characterization:</strong> Pragmatic adoption under suspicion.</p>
142+ <ul class="probe-task-list"><li class="task-list-item"><input class="task-list-item-checkbox" type="checkbox" disabled /> Task</li></ul>
143+ <details class="probe-details"><summary>More details</summary><p>Body</p></details>
144+ <ul class="probe-unordered"><li>Unordered</li></ul>
145+ <ol class="probe-ordered"><li>Ordered</li></ol>
141146 ` ;
142147 document . body . append ( probe ) ;
148+ const list = probe . querySelector ( ".probe-list" ) ;
149+ const quote = probe . querySelector ( ".probe-quote" ) ;
143150 const dimension = probe . querySelector ( "th:first-child" ) ;
144151 const demographics = probe . querySelector ( "td:first-child" ) ;
145- const list = probe . querySelector ( "ol" ) ;
146- const summary = probe . querySelector ( "ol + p" ) ;
147- if ( ! dimension || ! demographics || ! list || ! summary ) {
152+ const table = probe . querySelector ( "table" ) ;
153+ const tableCopy = probe . querySelector ( ".probe-table-copy" ) ;
154+ const taskList = probe . querySelector ( ".probe-task-list" ) ;
155+ const details = probe . querySelector ( ".probe-details" ) ;
156+ const unordered = probe . querySelector ( ".probe-unordered" ) ;
157+ const ordered = probe . querySelector ( ".probe-ordered" ) ;
158+ if (
159+ ! dimension ||
160+ ! demographics ||
161+ ! list ||
162+ ! quote ||
163+ ! table ||
164+ ! tableCopy ||
165+ ! taskList ||
166+ ! details ||
167+ ! unordered ||
168+ ! ordered
169+ ) {
148170 throw new Error ( "Chat Markdown style probe did not render" ) ;
149171 }
150172 const lineCount = ( element : Element ) => {
@@ -156,18 +178,42 @@ suite.define(() => {
156178 demographicsLineCount : lineCount ( demographics ) ,
157179 dimensionLineCount : lineCount ( dimension ) ,
158180 firstColumnWidth : dimension . getBoundingClientRect ( ) . width ,
159- postListGap : summary . getBoundingClientRect ( ) . top - list . getBoundingClientRect ( ) . bottom ,
160- postListMargin : Number . parseFloat ( getComputedStyle ( summary ) . marginTop ) ,
161- summaryFontSize : Number . parseFloat ( getComputedStyle ( summary ) . fontSize ) ,
181+ listToQuoteGap : quote . getBoundingClientRect ( ) . top - list . getBoundingClientRect ( ) . bottom ,
182+ quoteMargin : Number . parseFloat ( getComputedStyle ( quote ) . marginTop ) ,
183+ tableToCopyGap :
184+ tableCopy . getBoundingClientRect ( ) . top - table . getBoundingClientRect ( ) . bottom ,
185+ tableCopyMargin : Number . parseFloat ( getComputedStyle ( tableCopy ) . marginTop ) ,
186+ taskListToDetailsGap :
187+ details . getBoundingClientRect ( ) . top - taskList . getBoundingClientRect ( ) . bottom ,
188+ detailsMargin : Number . parseFloat ( getComputedStyle ( details ) . marginTop ) ,
189+ unorderedToOrderedGap :
190+ ordered . getBoundingClientRect ( ) . top - unordered . getBoundingClientRect ( ) . bottom ,
191+ orderedMargin : Number . parseFloat ( getComputedStyle ( ordered ) . marginTop ) ,
192+ blockFontSize : Number . parseFloat ( getComputedStyle ( tableCopy ) . fontSize ) ,
162193 } ;
163194 probe . remove ( ) ;
164195 return result ;
165196 } ) ;
166197 expect ( chatMarkdownStyles . dimensionLineCount ) . toBe ( 1 ) ;
167198 expect ( chatMarkdownStyles . demographicsLineCount ) . toBe ( 1 ) ;
168199 expect ( chatMarkdownStyles . firstColumnWidth ) . toBeGreaterThanOrEqual ( 128 ) ;
169- expect ( chatMarkdownStyles . postListGap ) . toBeGreaterThan ( 0 ) ;
170- expect ( chatMarkdownStyles . postListMargin / chatMarkdownStyles . summaryFontSize ) . toBeCloseTo (
200+ expect ( chatMarkdownStyles . listToQuoteGap ) . toBeGreaterThan ( 0 ) ;
201+ expect ( chatMarkdownStyles . tableToCopyGap ) . toBeGreaterThan ( 0 ) ;
202+ expect ( chatMarkdownStyles . taskListToDetailsGap ) . toBeGreaterThan ( 0 ) ;
203+ expect ( chatMarkdownStyles . unorderedToOrderedGap ) . toBeGreaterThan ( 0 ) ;
204+ expect ( chatMarkdownStyles . quoteMargin / chatMarkdownStyles . blockFontSize ) . toBeCloseTo (
205+ 0.75 ,
206+ 2 ,
207+ ) ;
208+ expect ( chatMarkdownStyles . tableCopyMargin / chatMarkdownStyles . blockFontSize ) . toBeCloseTo (
209+ 0.75 ,
210+ 2 ,
211+ ) ;
212+ expect ( chatMarkdownStyles . detailsMargin / chatMarkdownStyles . blockFontSize ) . toBeCloseTo (
213+ 0.75 ,
214+ 2 ,
215+ ) ;
216+ expect ( chatMarkdownStyles . orderedMargin / chatMarkdownStyles . blockFontSize ) . toBeCloseTo (
171217 0.75 ,
172218 2 ,
173219 ) ;
0 commit comments