Files
odoo_source/addons/web/static/lib/qweb/qweb-test-call.xml
T
Xavier Morel d5e3d121e3 [ADD] qweb: call directive's body
* __content__ can't be used in Python implementation because safe_eval, so use
  ``0`` from Python implementation instead
* remove postfix from t-call tests because due to implementation details all
  whitespace crap following a t-name is added to rendered template in Python
  impl, and don't want to normalize whitespace.
2014-10-06 19:13:45 +02:00

59 lines
1.7 KiB
XML

<templates>
<t t-name="_basic-callee">ok</t>
<t t-name="_callee-printsbody"><t t-esc="0"/></t>
<t t-name="_callee-uses-foo"><t t-esc="foo"/></t>
<t t-name="basic-caller">
<t t-call="_basic-callee"/>
</t>
<result id="basic-caller">ok</result>
<t t-name="with-unused-body">
<t t-call="_basic-callee">WHEEE</t>
</t>
<result id="with-unused-body">ok</result>
<t t-name="with-unused-setbody">
<t t-call="_basic-callee">
<t t-set="qux" t-value="3"/>
</t>
</t>
<result id="with-unused-setbody">ok</result>
<t t-name="with-used-body">
<t t-call="_callee-printsbody">ok</t>
</t>
<result id="with-used-body">ok</result>
<t t-name="with-used-setbody">
<t t-call="_callee-uses-foo">
<t t-set="foo" t-value="'ok'"/>
</t>
</t>
<result id="with-used-setbody">ok</result>
<!--
postfix to call removed because Python impl appends all whitespace
following called template's root to template result (+= element.tail)
-> ends up with bunch of extra whitespace in the middle of the
generated content. Could normalize, not sure current impl can be
fixed as-is
-->
<t t-name="inherit-context">
<t t-set="foo" t-value="1"/>
<t t-call="_callee-uses-foo"/><!-- - <t t-esc="foo"/> -->
</t>
<result id="inherit-context">1<!-- - 1 --></result>
<t t-name="scoped-parameter">
<t t-call="_basic-callee">
<t t-set="foo" t-value="42"/>
</t>
<!-- should not print anything -->
<t t-esc="foo"/>
</t>
<result id="scoped-parameter">
ok
</result>
</templates>