summaryrefslogtreecommitdiff
path: root/addons/web/static/lib/qweb/qweb-test-call.xml
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/web/static/lib/qweb/qweb-test-call.xml
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/web/static/lib/qweb/qweb-test-call.xml')
-rw-r--r--addons/web/static/lib/qweb/qweb-test-call.xml63
1 files changed, 63 insertions, 0 deletions
diff --git a/addons/web/static/lib/qweb/qweb-test-call.xml b/addons/web/static/lib/qweb/qweb-test-call.xml
new file mode 100644
index 00000000..8cf1d1d6
--- /dev/null
+++ b/addons/web/static/lib/qweb/qweb-test-call.xml
@@ -0,0 +1,63 @@
+<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>
+
+ <t t-name="expression-caller">
+ <t t-call="{{True and '_basic-callee' or 'other'}}"/>
+ </t>
+ <result id="expression-caller">ok</result>
+</templates>