Lines
88.24 %
Functions
100 %
Branches
//! The note of an empty rows field names the field, not tags.
use super::body::Block;
use super::render_field;
use crate::form::Form;
use crate::tabs::reports::ReportKind;
use crate::widgets::grid::GridLine;
#[test]
fn an_empty_groups_field_names_groups() {
let form = Form::report(ReportKind::Activity, &forms::FormValues::default());
let Some(field) = form.fields.iter().find(|f| f.key == Some("groups")) else {
panic!("groups field");
};
let Block::Grid(grid) = render_field(0, field, 0, 8, None, Some("C-n")) else {
panic!("a grid block");
let texts: Vec<_> = grid
.lines
.iter()
.filter_map(|line| match line {
GridLine::Text { text, .. } => Some(text.as_str()),
GridLine::Cells { .. } => None,
})
.collect();
assert!(texts.contains(&"(no groups: C-n adds one)"), "{texts:?}");
assert!(
!texts.iter().any(|text| text.contains("no tags")),
"{texts:?}"
);
}