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
Aaron Bohy
parent
1761af9c24
commit
b902edc1be
@@ -1,6 +1,7 @@
|
||||
import { TemplateSet } from "../../src/app/template_set";
|
||||
import { mount } from "../../src/blockdom";
|
||||
import { makeTestFixture, renderToBdom, renderToString, snapshotEverything } from "../helpers";
|
||||
import { markup } from "../../src/utils";
|
||||
|
||||
snapshotEverything();
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -497,12 +498,12 @@ describe("t-on", () => {
|
||||
expect(steps).toEqual(["onClick"]);
|
||||
});
|
||||
|
||||
test("t-on combined with t-raw", async () => {
|
||||
test("t-on combined with t-out", async () => {
|
||||
expect.assertions(3);
|
||||
const template = `<div><button t-on-click="onClick" t-raw="html"/></div>`;
|
||||
const template = `<div><button t-on-click="onClick" t-out="html"/></div>`;
|
||||
const steps: string[] = [];
|
||||
const owner = {
|
||||
html: "Click <b>here</b>",
|
||||
html: markup("Click <b>here</b>"),
|
||||
onClick() {
|
||||
steps.push("onClick");
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user