let row_label = HTML::escape(row.label.as_ref());
let col_label = HTML::escape(col);
let instances: Option<&Vec<Option<String>>> = row.entries.get(col);
- let class = HTML::from(if instances.is_none() { "" } else { "yes" });
+ let is_empty = match instances {
+ None => true,
+ Some(is) => is.iter().all(|ins| match ins {
+ None => false,
+ Some(content) => content == "×",
+ }),
+ };
+ let class = HTML::from(if is_empty { "" } else { "yes" });
let contents = match instances {
None => HTML::from(""),
Some(is) => render_instances(is),
r#"<td class="yes" onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')">5 𝍷</td>"#
)
);
+ assert_eq!(
+ render_cell(
+ "foo",
+ &mut Row {
+ label: "nope".to_owned(),
+ entries: HashMap::from([("foo".to_owned(), vec![Some("×".to_owned())])]),
+ }
+ ),
+ HTML::from(
+ r#"<td class="" onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')">×</td>"#
+ )
+ );
assert_eq!(
render_cell(
"heart",