Unit testing
Unit testing can be done by using the `Dom::assert_eq` function, which
tests your DOM against a certain XML string:
```rust
struct DataModel;
fn render_counter(count: usize) -> Dom {
Dom::div().with_class("test").with_child(
Dom::label(format!("{}", count))
)
}
#[test]
fn test_counter_ui() {
let expected = r#"
"#;
let dom = render_counter(5);
dom.assert_eq(expected);
}
```
You can technically also use `assert_eq!(expected, got);`, however, if the test fails,
the `Dom::assert_eq` error message has a much nicer format:
```xml
thread 'widgets::test_counter_ui' panicked at '
Expected DOM did not match:
expected: ----------
5
4