Skip to main content

meter_html

Function meter_html 

Source
pub fn meter_html(meter: &Meter<'_>, opts: &Emit) -> String
Expand description

A meter as a filled trough.

use makeover_layout::{Meter, Tone};
use makeover_webview::{Emit, meter::meter_html};

let meter = Meter::new(3, 7).tone(Tone::Success).label("subtasks");
let html = meter_html(&meter, &Emit::default());

assert!(html.contains(r#"aria-label="3 of 7 subtasks""#));
assert!(html.contains(r#"data-tone="success""#));
// The two counts, not the 42% they come to: `progress_rules` divides.
assert!(html.contains("--meter-done: 3; --meter-total: 7"));
assert!(!html.contains("--meter-fill"));

aria-valuenow is done as it stands, so an over-run reports above aria-valuemax. The clamp that used to sit here was a derivation and could not survive a residual; see meter_html_into for the whole argument.