Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tests to verify initial rendering #25

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,11 @@ impl<'a> Confirm<'a> {
let mut out = Buffer::ansi();

out.set_color(&self.theme.title)?;
write!(out, " {}", self.title)?;
writeln!(out, " {}", self.title)?;
Copy link
Owner

Choose a reason for hiding this comment

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

did you want to remove the 1 column prefix?

I looked at huh and it looks like they actually put a solid line on the side which I don't really like the look of. I don't have a strong preference here, but whatever we do should be consistent across our components I think

Copy link
Owner

Choose a reason for hiding this comment

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

I guess in theory this is something that could be handled via themes if we want to go that route (not sure if huh does that or not)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

AFAIK the line on the side in huh marks the active field in a form/group.


if !self.description.is_empty() {
out.set_color(&self.theme.description)?;
write!(out, " {}", self.description)?;
writeln!(out)?;
}
writeln!(out, "\n")?;

Expand Down Expand Up @@ -217,8 +216,8 @@ mod tests {

assert_eq!(
indoc! {
" Are you sure? This will do a thing.

" Are you sure?
This will do a thing.

Yes! No.

Expand Down
2 changes: 1 addition & 1 deletion src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{theme, Theme};
/// .description("We'll use this to personalize your experience.")
/// .placeholder("Enter your name");
/// let name = input.run().expect("error running input");
/// ````
/// ```
pub struct Input<'a> {
/// The title of the input
pub title: String,
Expand Down