Skip to content

test: add regression tests for issue #279 (facet_wrap spacing with custom height)#288

Open
ANAMASGARD wants to merge 6 commits intomasterfrom
fix-issue-279-facet-height-spacing
Open

test: add regression tests for issue #279 (facet_wrap spacing with custom height)#288
ANAMASGARD wants to merge 6 commits intomasterfrom
fix-issue-279-facet-height-spacing

Conversation

@ANAMASGARD
Copy link
Copy Markdown
Contributor

@ANAMASGARD ANAMASGARD commented Jan 4, 2026

Summary

Adds comprehensive regression tests for issue #279 to prevent reoccurrence of excessive spacing below facet_wrap plots when using custom height parameters.

Background

Issue #279 reported that when using facet_wrap() with a custom height parameter (different from the default 400px), excessive vertical spacing appeared below the faceted plots. The spacing did not scale proportionally with the custom height.

After thorough investigation and testing with version 2025.12.4, this issue appears to be resolved. These tests ensure it doesn't regress in future updates.

Changes

  • Added test-issue-279-facet-wrap-custom-height-spacing.R
  • 3 comprehensive test cases with 16 assertions
  • Tests cover:
    • Vertical facet layout (ncol=1) with 2x and 3x custom heights (800, 1200)
    • Grid layout (2×2, ncol=2) with 1.5x custom height (600)
    • Multiple height values (400, 600, 800, 1000, 1200) to verify proportionality

What the Tests Verify

The key verification is that height_proportion values remain identical across all custom heights:

  1. Custom height parameters are correctly stored in plot.json
  2. Panel layout structure (ROW/COL) remains consistent
  3. height_proportion values are identical regardless of custom height
    • These values control relative spacing between facets
    • If excessive spacing existed, these would differ with custom heights
    • Consistent proportions = correct proportional scaling ✓

Testing

  • All tests pass on current main branch :-
new-279

   Adds comprehensive test cases to verify that facet_wrap spacing
   scales proportionally with custom height parameter.

   Tests cover:
   - Vertical facet layout (ncol=1) with 2x and 3x custom heights
   - 2x2 grid layout with 1.5x custom height
   - Multiple height values to verify proportionality

   This ensures issue #279 (excessive spacing below facets) does not regress.

   All tests pass (16 assertions).

   Refs #279
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.10%. Comparing base (543d0d9) to head (f4b796e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #288   +/-   ##
=======================================
  Coverage   73.09%   73.10%           
=======================================
  Files         164      164           
  Lines        8769     8770    +1     
=======================================
+ Hits         6410     6411    +1     
  Misses       2359     2359           
Flag Coverage Δ
javascript 80.79% <100.00%> (+<0.01%) ⬆️
r 69.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tdhock
Copy link
Copy Markdown
Collaborator

tdhock commented Feb 27, 2026

can you please post a screenshot of the proposed test?

ANAMASGARD and others added 2 commits March 10, 2026 15:50
…facets; replace JSON-only test with browser-based regression test

- Add .style("display","block") to SVG creation in animint.js so browsers
  do not add text-descender whitespace below inline SVG elements (fixes
  visible gap below facet_wrap/facet_grid at any custom height).
- Replace the three animint2dir+JSON tests with a single animint2HTML test
  that renders in a real browser and asserts SVG height stays proportional
  (not height*num_facets) when using theme_animint(height=600) on a
  facet_grid(task_id ~ .) plot with sonar/spam/vowel/waveform/zip data,
  matching the ch20 examples that originally exposed the bug.
@ANAMASGARD
Copy link
Copy Markdown
Contributor Author

ANAMASGARD commented Mar 10, 2026

localhost_8788_issue279-facet-height-600_index html(Surface Pro 7)

@tdhock
Copy link
Copy Markdown
Collaborator

tdhock commented Mar 10, 2026

please fix CI

ANAMASGARD and others added 2 commits March 11, 2026 05:48
The display:block style added to SVGs causes sapply(svg.list, xmlAttrs)
to return a list instead of a matrix when SVGs have inconsistent
attribute counts. Use lapply/sapply with a function to extract id
attributes safely regardless of attribute structure.
@ANAMASGARD ANAMASGARD requested a review from tdhock March 19, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants