Skip to content

test(tui): add tests for diff viewer in tui - #13072

Merged
davidpdrsn merged 3 commits into
masterfrom
dp-tui-diff-tests
Mar 27, 2026
Merged

test(tui): add tests for diff viewer in tui#13072
davidpdrsn merged 3 commits into
masterfrom
dp-tui-diff-tests

Conversation

@davidpdrsn

@davidpdrsn davidpdrsn commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

@vercel

vercel Bot commented Mar 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
gitbutler-web Ignored Ignored Preview Mar 27, 2026 6:14pm

Request Review

@github-actions github-actions Bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Mar 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds snapshot-based tests for the legacy status TUI “details/diff” viewer by introducing a terminal-buffer-to-SVG renderer and committing the resulting SVG snapshots.

Changes:

  • Add details_tests module with snapshot tests covering toggling details, selection updates, scrolling, wrapping, and multi-hunk rendering.
  • Extend TUI test utilities with SVG rendering/assertion helpers for ratatui::backend::TestBackend.
  • Add SVG snapshot artifacts for the new details/diff viewer test cases.

Reviewed changes

Copilot reviewed 3 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/but/src/command/legacy/status/tui/tests/utils.rs Adds assert_rendered_term_svg_eq and SVG rendering helpers for snapshot assertions.
crates/but/src/command/legacy/status/tui/tests/mod.rs Registers the new details_tests module.
crates/but/src/command/legacy/status/tui/tests/details_tests.rs Introduces new snapshot tests for details/diff viewer behavior.
crates/but/src/command/legacy/status/tui/tests/snapshots/toggling_details_off_and_on_resets_scroll_position_003.svg New SVG snapshot for scroll reset behavior.
crates/but/src/command/legacy/status/tui/tests/snapshots/toggle_details_view_for_commit_003.svg New SVG snapshot for details toggle sequence.
crates/but/src/command/legacy/status/tui/tests/snapshots/toggle_details_view_for_commit_001.svg New SVG snapshot for details toggle sequence.
crates/but/src/command/legacy/status/tui/tests/snapshots/details_view_updates_with_selection_changes_001.svg New SVG snapshot validating details updates on selection changes.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_message_wraps_in_details_view_003.svg New SVG snapshot validating commit message wrapping in details pane.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_message_wraps_in_details_view_002.svg New SVG snapshot validating commit message wrapping in details pane.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_message_wraps_in_details_view_001.svg New SVG snapshot validating commit message wrapping in details pane.

Comment thread crates/but/src/command/legacy/status/tui/tests/utils.rs
Comment thread crates/but/src/command/legacy/status/tui/tests/utils.rs
Base automatically changed from dp-move-mode to master March 27, 2026 18:00
@davidpdrsn
davidpdrsn enabled auto-merge March 27, 2026 18:15
@davidpdrsn
davidpdrsn merged commit 1c42284 into master Mar 27, 2026
37 checks passed
@davidpdrsn
davidpdrsn deleted the dp-tui-diff-tests branch March 27, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants