Skip to content

RS-21803: Header Visibility and Cell Formatting test - #70

Open
SurreyHughesDisplayr wants to merge 3 commits into
RS-21803-bandedrowsfrom
RS-21803-headervisibilityandcellformatting
Open

RS-21803: Header Visibility and Cell Formatting test#70
SurreyHughesDisplayr wants to merge 3 commits into
RS-21803-bandedrowsfrom
RS-21803-headervisibilityandcellformatting

Conversation

@SurreyHughesDisplayr

Copy link
Copy Markdown

Summary

Adds unit test coverage for header visibility and cell formatting in CreateCustomTable (R/createcustomtable.R) — 18 test blocks covering the plan's 19 scenarios.

  • show.row.headers / show.col.headers off, including the force-disable path when row or column names are absent, each with a positive render control so a block cannot pass on empty output.
  • Cell class assignment pinned as whole contiguous rows, e.g. <tr><td class="celldefault1">1</td><td class="celldefault5">5</td><td class="celldefault9">9</td></tr>, so inserting or reordering cells fails the test.
  • row.classes / col.classes applied without index shift — asserted positively on the data cells and negatively on the row-header cell, which is the actual index-shift pin, with a row-count guard so the extraction cannot pass vacuously.
  • Named vs positional col.classes list access produce identical body HTML, compared across the whole post-</thead> block plus a positive control.
  • font.size, alignment padding and per-cell fill rules pinned as exact counts and exact declarations.

Plan corrections

Three of the plan's assertions could not be used as written and were corrected after probing real output:

  • "Assert <th does not appear" is unusable — <thead> substring-matches <th>. Anchored to <th class=" instead (0 with headers off, 4 with them on).
  • "Assert no 2px" is unusable — 2px legitimately appears in border-spacing: 2px 2px. Narrowed to font-size: 2px absent versus font-size: 2em present.
  • Whole-document comparison for named vs positional access is not byte-stable, because each call generates a fresh random container-name stem. Compared the post-</thead> body region, which is stem-free.

Note on cell.inline.styl

createcustomtable.R contains cell.inline.styl <- rbind(...), assigning to a variable that is never read anywhere in the package — a dead store. It looks like a typo for the inline-styles matrix, but renaming it does not fix anything: patching the body to use the apparently-intended name makes every call fail with arguments cannot be recycled to the same length, because the styles matrix never gains a header row. The correct disposition is deletion of the line, and current emitted output is correct. The test therefore pins the real behaviour — the sig.change.fills inline style appears only on the flagged body cell and never in <thead> — rather than describing this as a behavioural defect.

Jira: https://numbers.atlassian.net/browse/RS-21803

Stacked PR

Based on RS-21803-bandedrows (#69), not master — these plans all add tests to tests/testthat/test-createcustomtable.R and share its helpers. Merge order: #66, #67, #68, #69, then this. The diff against that base is this plan's work only.

Test plan

Rscript -e "devtools::load_all('.'); testthat::test_file('tests/testthat/test-createcustomtable.R')"

212 passing, 0 failures, 0 warnings.

🤖 Generated with Claude Code

SurreyHughesDisplayr and others added 3 commits August 21, 2026 10:53
…erage

Covers transpose, show.col.headers/show.row.headers (including the
NULL-dimnames force-disable paths), cell.align.horizontal, font.size and
font.unit propagation, cell.font.size override, col.header.classes/
row.header.classes, col.classes/row.classes (including their positional
list access) and the cell.inline.styl typo's no-op behaviour.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Correct the mislabeled cell.inline.styl block: it is a dead store (never
read under R/), not a confirmed defect, and the intended fix is deletion
not renaming, since renaming would error on the mismatched header row.
Also compare full body-row blocks instead of column 3 only, pin the
font-size: 2em count, assert the row-header cell lacks stray fill
classes, and add positive-render controls to two absence-only blocks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant