RS-21803: Banded Rows test - #69
Open
SurreyHughesDisplayr wants to merge 3 commits into
Open
Conversation
Adds unit tests for CreateCustomTable's banded.rows/banded.cols behaviour: no CSS emitted by default, the odd/even row-banding rule (pinning the confirmed unscoped tr:nth-child(even) clause), custom fill colours, per-cell background suppression shared by both flags, the verbatim td:nth-child(2n+3)/even column rule, both flags together, and row-count independence of the emitted rule count. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…plan-mistake comment Pins the whole banded.cols verbatim CSS rule (both the 2n+3 and even clauses with their fill values) instead of only half of it, and adds a scoping-leak check mirroring the existing banded.rows one, confirming the unscoped `td:nth-child(even)` clause is a real, unticketed defect. Removes the incorrect "defect"/"corrected odd/even split" framing for the 2n+3/even selector pair, which is disjoint and correct as coded - that was a plan-authoring mistake, not a production bug. Guards the container-selector regex extraction with expect_length() so a failed match can't pass vacuously. Pins the paired custom banded.odd.fill / banded.even.fill values so swapping them would fail. Tightens two cell-fill assertions to include the trailing " ;" for anchoring. Moves the banded.rows/banded.cols section to after the last row.spans test it had been accidentally inserted into the middle of. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merge the odd/even grepl pairs for banded.rows (default and custom fill cases) into single contiguous-string assertions, mirroring the existing banded.cols test. As two independent greps, inserting content between the odd and even clauses in production would not have failed these assertions. Also drop "deliberately" from a comment asserting unestablished author intent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds unit test coverage for the
banded.rowsandbanded.colsarguments ofCreateCustomTable(R/createcustomtable.R).banded.odd.fillwithbanded.even.fill, fails the test.nth-childrule is emitted at all when banding is off.td:nth-child(2n+3)/td:nth-child(even)pair as coded.expect_length(containerSel, 1)so the assertion cannot pass on an empty match.Pinned production defect
The second clause of each banding rule is emitted without the container prefix —
;} tr:nth-child(even)for rows and;} td:nth-child(even)for columns — so it is not scoped to this table and leaks to every table on the page. Both halves are pinned as current behaviour and will fail when the scoping is fixed. Genuine defect, no ticket filed.Plan corrections
Two of the plan's expectations did not survive checking and were corrected rather than encoded:
;.cata()writes viacat(..., sep = " "), so real output isbackground-color: rgb(250,250,250) ;— the plan's string never occurs. Tests pin the real text.2n+3/evencolumn selectors as overlapping and asks for that to be logged as a defect. They are provably disjoint:2n+3= {3, 5, 7, …} andeven= {2, 4, …}. With row headers shown the header cell occupiesnth-child(1), so data columns land on 2, 3, 4 and alternate correctly. Not a defect. (One genuine gap the plan did not raise: withshow.row.headers = FALSE, column 1 matches neither selector and is left unbanded. Noted in a comment, not asserted.)Jira: https://numbers.atlassian.net/browse/RS-21803
Stacked PR
Based on
RS-21803-rowspans(#68), notmaster— these plans all add tests totests/testthat/test-createcustomtable.Rand share its helpers. Merge order: #66, #67, #68, then this. The diff against that base is this plan's work only.Test plan
137 passing, 0 failures, 0 warnings.
🤖 Generated with Claude Code