mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] app, compiler: introduce t-out
t-out automatically escaped content when it is a string not marked with the `markup` function t-out renders the raw content if it is a Block, or if it has been marked with the `markup` funtion. t-esc has been kept since it is safe and is optimized to render text nodes. all t-raw calls are in fact the same as t-out.
This commit is contained in:
committed by
Géry Debongnie
parent
2806cda420
commit
6ea40a66da
@@ -149,7 +149,7 @@ describe("t-set", () => {
|
||||
<span><t t-esc="v1"/></span>
|
||||
</t>
|
||||
<t t-set="v1" t-value="'after'"/>
|
||||
<t t-raw="v2"/>
|
||||
<t t-out="v2"/>
|
||||
</div>`;
|
||||
|
||||
expect(renderToString(template)).toBe("<div><span>before</span></div>");
|
||||
@@ -165,7 +165,7 @@ describe("t-set", () => {
|
||||
</t>
|
||||
<t t-set="v1" t-value="'after'"/>
|
||||
<t t-set="v3" t-value="true"/>
|
||||
<t t-raw="v2"/>
|
||||
<t t-out="v2"/>
|
||||
</div>`;
|
||||
|
||||
expect(renderToString(template)).toBe("<div><span>before</span></div>");
|
||||
@@ -181,7 +181,7 @@ describe("t-set", () => {
|
||||
</t>
|
||||
<t t-set="v1" t-value="'after'"/>
|
||||
<t t-set="v3" t-value="false"/>
|
||||
<t t-raw="v2"/>
|
||||
<t t-out="v2"/>
|
||||
</div>`;
|
||||
|
||||
expect(renderToString(template)).toBe("<div>Truthy</div>");
|
||||
|
||||
Reference in New Issue
Block a user