Added tests proving that the explicit context is evaluated using the global context of the partial containing the block (NOT the inline partial, which is where the explicit context is written).
This commit is contained in:
@@ -314,6 +314,7 @@ impl<'a> DustRenderer<'a> {
|
||||
}
|
||||
DustTag::DTInlinePartial(_named_block) => {
|
||||
// Inline partials are blank during rendering (they get injected into blocks)
|
||||
// TODO: We will need to support explicit contexts for inline partials.
|
||||
return Ok("".to_owned());
|
||||
}
|
||||
DustTag::DTBlock(named_block) => {
|
||||
@@ -660,6 +661,7 @@ impl<'a> DustRenderer<'a> {
|
||||
Some(_) => Vec::with_capacity(3),
|
||||
None => breadcrumbs.clone(),
|
||||
};
|
||||
// TODO: Can sections have parameters, and if so, what happens then? Currently when there is an injected context or an explicit context it gets inserted behind the current context, so 1->2->3 becomes 1->2->injected->3 or explicit->3. When there is a new context(4) with injected we're doing 1->2->3->injected->4. When there is an explicit context and a new context we're doing explicit->4. But what happens if there is a section with parameters and an explicit context, hitting all the categories? Would it be parameters->explicit->4? I would definitely have to change the parameters to this function since right now iteration variables and parameters are both sharing injected_context.
|
||||
injected_context.map(|ctx| {
|
||||
// Special case: when there is no explicit context or new
|
||||
// context element, the injected context gets inserted 1
|
||||
|
||||
Reference in New Issue
Block a user