Skip to content

Commit

Permalink
Merge pull request #1927 from olivroy/snap
Browse files Browse the repository at this point in the history
Use more human readable snapshots with tests
  • Loading branch information
rich-iannone authored Nov 27, 2024
2 parents 96c4dba + 23123d1 commit 31c1632
Show file tree
Hide file tree
Showing 22 changed files with 47,565 additions and 927 deletions.
457 changes: 433 additions & 24 deletions tests/testthat/_snaps/cols_align_decimal.md

Large diffs are not rendered by default.

399 changes: 371 additions & 28 deletions tests/testthat/_snaps/cols_merge.md

Large diffs are not rendered by default.

3,423 changes: 3,351 additions & 72 deletions tests/testthat/_snaps/data_color.md

Large diffs are not rendered by default.

488 changes: 468 additions & 20 deletions tests/testthat/_snaps/fmt_auto.md

Large diffs are not rendered by default.

3,288 changes: 3,284 additions & 4 deletions tests/testthat/_snaps/fmt_duration.md

Large diffs are not rendered by default.

1,746 changes: 1,740 additions & 6 deletions tests/testthat/_snaps/fmt_fraction.md

Large diffs are not rendered by default.

261 changes: 259 additions & 2 deletions tests/testthat/_snaps/fmt_markdown.md

Large diffs are not rendered by default.

131 changes: 125 additions & 6 deletions tests/testthat/_snaps/footer.md

Large diffs are not rendered by default.

4,402 changes: 4,338 additions & 64 deletions tests/testthat/_snaps/group_column_label.md

Large diffs are not rendered by default.

50 changes: 48 additions & 2 deletions tests/testthat/_snaps/quarto.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,53 @@
# Quarto produces the valid output

Code
render_as_html(gt_tbl)
cat(render_as_html(gt_tbl))
Output
[1] "<table class=\"gt_table\" data-quarto-disable-processing=\"false\" data-quarto-bootstrap=\"false\">\n <thead>\n <tr class=\"gt_heading\">\n <td colspan=\"3\" class=\"gt_heading gt_title gt_font_normal gt_bottom_border\" style><span data-qmd-base64=\"dGl0bGU=\"><span class='gt_from_md'>title</span></span></td>\n </tr>\n \n <tr class=\"gt_col_headings gt_spanner_row\">\n <th class=\"gt_col_heading gt_columns_bottom_border gt_right\" rowspan=\"2\" colspan=\"1\" scope=\"col\" id=\"num\">num</th>\n <th class=\"gt_center gt_columns_top_border gt_column_spanner_outer\" rowspan=\"1\" colspan=\"2\" scope=\"colgroup\" id=\"problem\">\n <div class=\"gt_column_spanner\"><span data-qmd-base64=\"cHJvYmxlbQ==\"><span class='gt_from_md'>problem</span></span></div>\n </th>\n </tr>\n <tr class=\"gt_col_headings\">\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"char\">char<span class=\"gt_footnote_marks\" style=\"white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;\"><sup>1</sup></span></th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_center\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"fctr\"><span data-qmd-base64=\"RmFjdG9y\"><span class='gt_from_md'>Factor</span></span><span class=\"gt_footnote_marks\" style=\"white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;\"><sup>2</sup></span></th>\n </tr>\n </thead>\n <tbody class=\"gt_table_body\">\n <tr><td headers=\"num\" class=\"gt_row gt_right\"><span class=\"gt_footnote_marks\" style=\"white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;\"><sup>3</sup></span> <span data-qmd-base64=\"MC4xMTEx\"><span class='gt_from_md'>0.1111</span></span></td>\n<td headers=\"char\" class=\"gt_row gt_left\">apricot</td>\n<td headers=\"fctr\" class=\"gt_row gt_center\">one</td></tr>\n <tr><td headers=\"num\" class=\"gt_row gt_right\"><span data-qmd-base64=\"Mi4yMjI=\"><span class='gt_from_md'>2.222</span></span></td>\n<td headers=\"char\" class=\"gt_row gt_left\">banana</td>\n<td headers=\"fctr\" class=\"gt_row gt_center\">two</td></tr>\n <tr><td headers=\"num\" class=\"gt_row gt_right\"><span data-qmd-base64=\"MzMuMzM=\"><span class='gt_from_md'>33.33</span></span></td>\n<td headers=\"char\" class=\"gt_row gt_left\">coconut</td>\n<td headers=\"fctr\" class=\"gt_row gt_center\">three</td></tr>\n <tr><td headers=\"num\" class=\"gt_row gt_right\"><span data-qmd-base64=\"NDQ0LjQ=\"><span class='gt_from_md'>444.4</span></span></td>\n<td headers=\"char\" class=\"gt_row gt_left\">durian</td>\n<td headers=\"fctr\" class=\"gt_row gt_center\">four</td></tr>\n <tr><td headers=\"num\" class=\"gt_row gt_right\"><span data-qmd-base64=\"NTU1MA==\"><span class='gt_from_md'>5550</span></span></td>\n<td headers=\"char\" class=\"gt_row gt_left\">NA</td>\n<td headers=\"fctr\" class=\"gt_row gt_center\">five</td></tr>\n </tbody>\n \n <tfoot class=\"gt_footnotes\">\n <tr>\n <td class=\"gt_footnote\" colspan=\"3\"><span class=\"gt_footnote_marks\" style=\"white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;\"><sup>1</sup></span> Not a problem</td>\n </tr>\n <tr>\n <td class=\"gt_footnote\" colspan=\"3\"><span class=\"gt_footnote_marks\" style=\"white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;\"><sup>2</sup></span> A problem because fctr is labelled with md</td>\n </tr>\n <tr>\n <td class=\"gt_footnote\" colspan=\"3\"><span class=\"gt_footnote_marks\" style=\"white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;\"><sup>3</sup></span> <span data-qmd-base64=\"UHJvYmxlbSBiZWNhdXNlIG51bSByb3cgMSBpcyBmbXRfbWFya2Rvd24oKSArIGFsc28gdGhlIGZvb3Rub3RlIGlzIHdyYXBwZWQgaW4gbWQu\"><span class='gt_from_md'>Problem because num row 1 is fmt_markdown() + also the footnote is wrapped in md.</span></span></td>\n </tr>\n </tfoot>\n</table>"
<table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<td colspan="3" class="gt_heading gt_title gt_font_normal gt_bottom_border" style><span data-qmd-base64="dGl0bGU="><span class='gt_from_md'>title</span></span></td>
</tr>
<tr class="gt_col_headings gt_spanner_row">
<th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="2" colspan="1" scope="col" id="num">num</th>
<th class="gt_center gt_columns_top_border gt_column_spanner_outer" rowspan="1" colspan="2" scope="colgroup" id="problem">
<div class="gt_column_spanner"><span data-qmd-base64="cHJvYmxlbQ=="><span class='gt_from_md'>problem</span></span></div>
</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="char">char<span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;"><sup>1</sup></span></th>
<th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="fctr"><span data-qmd-base64="RmFjdG9y"><span class='gt_from_md'>Factor</span></span><span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;"><sup>2</sup></span></th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr><td headers="num" class="gt_row gt_right"><span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;"><sup>3</sup></span> <span data-qmd-base64="MC4xMTEx"><span class='gt_from_md'>0.1111</span></span></td>
<td headers="char" class="gt_row gt_left">apricot</td>
<td headers="fctr" class="gt_row gt_center">one</td></tr>
<tr><td headers="num" class="gt_row gt_right"><span data-qmd-base64="Mi4yMjI="><span class='gt_from_md'>2.222</span></span></td>
<td headers="char" class="gt_row gt_left">banana</td>
<td headers="fctr" class="gt_row gt_center">two</td></tr>
<tr><td headers="num" class="gt_row gt_right"><span data-qmd-base64="MzMuMzM="><span class='gt_from_md'>33.33</span></span></td>
<td headers="char" class="gt_row gt_left">coconut</td>
<td headers="fctr" class="gt_row gt_center">three</td></tr>
<tr><td headers="num" class="gt_row gt_right"><span data-qmd-base64="NDQ0LjQ="><span class='gt_from_md'>444.4</span></span></td>
<td headers="char" class="gt_row gt_left">durian</td>
<td headers="fctr" class="gt_row gt_center">four</td></tr>
<tr><td headers="num" class="gt_row gt_right"><span data-qmd-base64="NTU1MA=="><span class='gt_from_md'>5550</span></span></td>
<td headers="char" class="gt_row gt_left">NA</td>
<td headers="fctr" class="gt_row gt_center">five</td></tr>
</tbody>
<tfoot class="gt_footnotes">
<tr>
<td class="gt_footnote" colspan="3"><span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;"><sup>1</sup></span> Not a problem</td>
</tr>
<tr>
<td class="gt_footnote" colspan="3"><span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;"><sup>2</sup></span> A problem because fctr is labelled with md</td>
</tr>
<tr>
<td class="gt_footnote" colspan="3"><span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;"><sup>3</sup></span> <span data-qmd-base64="UHJvYmxlbSBiZWNhdXNlIG51bSByb3cgMSBpcyBmbXRfbWFya2Rvd24oKSArIGFsc28gdGhlIGZvb3Rub3RlIGlzIHdyYXBwZWQgaW4gbWQu"><span class='gt_from_md'>Problem because num row 1 is fmt_markdown() + also the footnote is wrapped in md.</span></span></td>
</tr>
</tfoot>
</table>

Loading

9 comments on commit 31c1632

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.