mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-28 21:41:35 +00:00
Add test for basic chained attributes
This commit is contained in:
parent
71d99927a6
commit
ce84543b69
1
testing/templates/nested-attr.html
Normal file
1
testing/templates/nested-attr.html
Normal file
@ -0,0 +1 @@
|
||||
{{ inner.holder.a }}
|
@ -93,6 +93,25 @@ fn test_attr() {
|
||||
}
|
||||
|
||||
|
||||
struct NestedHolder {
|
||||
holder: Holder,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "nested-attr.html")]
|
||||
struct NestedAttrTemplate {
|
||||
inner: NestedHolder,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nested_attr() {
|
||||
let t = NestedAttrTemplate {
|
||||
inner: NestedHolder { holder: Holder { a: 5 } }
|
||||
};
|
||||
assert_eq!(t.render(), "5");
|
||||
}
|
||||
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "option.html")]
|
||||
struct OptionTemplate<'a> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user