Skip to content

RS-21803: Col Widths and Custom CSS test - #71

Open
SurreyHughesDisplayr wants to merge 2 commits into
RS-21803-headervisibilityandcellformattingfrom
RS-21803-colwidthsandcustomcss
Open

RS-21803: Col Widths and Custom CSS test#71
SurreyHughesDisplayr wants to merge 2 commits into
RS-21803-headervisibilityandcellformattingfrom
RS-21803-colwidthsandcustomcss

Conversation

@SurreyHughesDisplayr

Copy link
Copy Markdown

Summary

Adds unit test coverage for col.widths and custom CSS in CreateCustomTable (R/createcustomtable.R) — 14 test blocks.

  • Pins the emitted <col> tags exactly, including the literal surrounding spaces that paste(..., sep = " ") produces: <col width=' 200px '>. Percentage widths are pinned as an explicit vector so the assertion fails if col.widths is ignored and the default 25% is emitted instead.
  • Covers col.widths counting the row-header column, fewer widths than columns, and more widths than columns (7 widths against a 5-column render, asserting the surplus is emitted untruncated).
  • col.widths.fill.container on and off, with the extracted <table> tag length-guarded so an empty match cannot pass vacuously.
  • Asserts the calc() table-width offset tracks cell.border.width — pinned at a non-default 5, verified to change with the argument rather than coming from elsewhere.
  • Covers the wrapper switch: with no custom CSS and no scrolling the widget is boxIframeless (can-run-in-root-dom set); any non-empty custom.css, or a row.height, switches it to a plain Box.
  • Covers override.borders, including the case that pins its substring match as genuinely unanchored — an unrelated .x:nth-child(2) rule alongside border-top suppresses the border. This is the argument's intended opt-out escape hatch, not a defect.

Every argument under test uses a distinctive non-default value, so no assertion can pass while the argument is ignored.

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

Stacked PR

Based on RS-21803-headervisibilityandcellformatting (#70), not master — these plans all add tests to tests/testthat/test-createcustomtable.R and share its helpers. Merge order: #66, #67, #68, #69, #70, 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')"

245 passing, 0 failures, 0 warnings.

🤖 Generated with Claude Code

SurreyHughesDisplayr and others added 2 commits August 21, 2026 11:57
Add 15 test_that blocks covering col.widths tag emission (single,
comma-separated, vector, NULL, rownames-dependent default, mismatched
lengths), col.widths.fill.container's calc() table width, custom.css
reaching the emitted HTML, the override.borders substring heuristic
across celldefault/colheaderdefault/rowheaderdefault, and the
boxIframeless vs Box widget-host selection driven by custom.css and
scrolling.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Genuinely exercise surplus col.widths, pin expected tag vectors instead
of vacuous equality checks, add a case that pins the override.borders
unanchored-substring heuristic, remove a redundant default-valued block,
use a distinct row.header.border.color, add missing expect_length
guards, and fix a stale column-count comment.

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