use rat_widget::msgdialog::MsgDialogState;
use crate::status;
pub(crate) fn open() -> MsgDialogState {
MsgDialogState::new_active(
format!("About {}", status::NAME),
format!("{} {}", status::NAME, status::VERSION),
)
}
#[cfg(test)]
mod tests {
use super::*;
use crate::dialog::testing::{REGION, picture, theme};
use crate::overlay::Overlay;
use ratatui_core::buffer::Buffer;
#[test]
fn the_about_dialog_carries_the_name_and_the_version() {
let mut dialog = Overlay::up(open());
let mut buffer = Buffer::empty(REGION);
crate::dialog::draw(REGION, &mut buffer, &mut dialog, &theme());
let frame = picture(&buffer);
assert!(
frame.contains(&format!("About {}", status::NAME)),
"the dialog has no title: {frame:?}"
);
assert!(
frame.contains(&format!("{} {}", status::NAME, status::VERSION)),
"the dialog does not carry the name and the version: {frame:?}"
);
assert!(frame.contains("Ok"), "the dialog has no way out: {frame:?}");
}
}