[FIX] *: remove useless values to t-else and t-debug

The actual value does not matter, only the fact that it is present.

closes #564
This commit is contained in:
Géry Debongnie
2019-12-11 11:01:54 +01:00
committed by aab-odoo
parent 0762eeb010
commit 41cb5f1abd
6 changed files with 22 additions and 22 deletions
+1 -1
View File
@@ -946,7 +946,7 @@ For example, here is how we could implement an `ErrorBoundary` component:
<t t-if="state.error">
Error handled
</t>
<t t-else="1">
<t t-else="">
<t t-slot="default" />
</t>
</div>
+1 -1
View File
@@ -57,7 +57,7 @@ class SomeComponent extends Component {
<t t-if=device.isMobile>
some simplified user interface
</t>
<t t-else="1">
<t t-else="">
a more advanced user interface
</t>
</div>`;
+2 -2
View File
@@ -28,7 +28,7 @@ generate a virtual dom representation of the HTML.
```xml
<div>
<span t-if="somecondition">Some string</span>
<ul t-else="1">
<ul t-else="">
<li t-foreach="messages" t-as="message">
<t t-esc="message"/>
</li>
@@ -101,7 +101,7 @@ precisely, the result of a template rendering should have a single root node:
<!–– ok: result has one single root node ––>
<t>
<div t-if="someCondition">foo</div>
<span t-else="1">bar</span>
<span t-else="">bar</span>
</t>
```
+13 -13
View File
@@ -618,7 +618,7 @@ describe("lifecycle hooks", () => {
<t t-if="state.ok">
<t t-component="child"/>
</t>
<t t-else="1">
<t t-else="">
<div/>
</t>
</div>`
@@ -1399,7 +1399,7 @@ describe("composition", () => {
static template = xml`
<div>
<h1 t-if="state.flag">hey</h1>
<h2 t-else="1">noo</h2>
<h2 t-else="">noo</h2>
<span><ChildWidget/></span>
<t t-if="state.flag"><span>test</span></t>
</div>`;
@@ -2425,7 +2425,7 @@ describe("other directives with t-component", () => {
`
<div>
<div t-if="state.flag">somediv</div>
<t t-else="1" t-component="child"/>
<t t-else="" t-component="child"/>
</div>`
);
class Child extends Widget {}
@@ -4414,7 +4414,7 @@ describe("t-slot directive", () => {
env.qweb.addTemplates(`
<templates>
<div t-name="Parent">
<Dialog><t t-set="content" t-debug="1">abc</t></Dialog>
<Dialog><t t-set="content" t-debug="">abc</t></Dialog>
</div>
<span t-name="Dialog">
<t t-slot="content"/>
@@ -4892,7 +4892,7 @@ describe("t-model directive", () => {
<input type="checkbox" t-model="state.flag"/>
<span>
<t t-if="state.flag">yes</t>
<t t-else="1">no</t>
<t t-else="">no</t>
</span>
</div>
</templates>`);
@@ -5171,7 +5171,7 @@ describe("environment and plugins", () => {
static template = xml`
<div>
<t t-if="env.someFlag">Red</t>
<t t-else="1">Blue</t>
<t t-else="">Blue</t>
</div>
`;
}
@@ -5234,7 +5234,7 @@ describe("component error handling (catchError)", () => {
static template = xml`
<div>
<t t-if="state.error">Error handled</t>
<t t-else="1"><t t-slot="default" /></t>
<t t-else=""><t t-slot="default" /></t>
</div>`;
state = useState({ error: false });
@@ -5310,7 +5310,7 @@ describe("component error handling (catchError)", () => {
static template = xml`
<div>
<t t-if="state.error">Error handled</t>
<t t-else="1"><t t-slot="default" /></t>
<t t-else=""><t t-slot="default" /></t>
</div>`;
state = useState({ error: false });
@@ -5346,7 +5346,7 @@ describe("component error handling (catchError)", () => {
static template = xml`
<div>
<t t-if="state.error">Error handled</t>
<t t-else="1"><t t-slot="default" /></t>
<t t-else=""><t t-slot="default" /></t>
</div>`;
state = useState({ error: false });
@@ -5382,7 +5382,7 @@ describe("component error handling (catchError)", () => {
<templates>
<div t-name="ErrorBoundary">
<t t-if="state.error">Error handled</t>
<t t-else="1"><t t-slot="default" /></t>
<t t-else=""><t t-slot="default" /></t>
</div>
<div t-name="ErrorComponent">Some text</div>
<div t-name="App">
@@ -5429,7 +5429,7 @@ describe("component error handling (catchError)", () => {
static template = xml`
<div>
<t t-if="state.error">Error handled</t>
<t t-else="1"><t t-slot="default" /></t>
<t t-else=""><t t-slot="default" /></t>
</div>`;
state = useState({ error: false });
@@ -5456,7 +5456,7 @@ describe("component error handling (catchError)", () => {
<templates>
<div t-name="ErrorBoundary">
<t t-if="state.error">Error handled</t>
<t t-else="1"><t t-slot="default" /></t>
<t t-else=""><t t-slot="default" /></t>
</div>
<div t-name="ErrorComponent">Some text</div>
<div t-name="App">
@@ -5500,7 +5500,7 @@ describe("component error handling (catchError)", () => {
static template = xml`
<div>
<t t-if="state.error">Error handled</t>
<t t-else="1"><t t-slot="default" /></t>
<t t-else=""><t t-slot="default" /></t>
</div>`;
state = useState({ error: false });
+3 -3
View File
@@ -426,7 +426,7 @@ describe("t-if", () => {
});
test("t-esc with t-elif", () => {
qweb.addTemplate("test", `<div><t t-if="false">abc</t><t t-else="1" t-esc="'x'"/></div>`);
qweb.addTemplate("test", `<div><t t-if="false">abc</t><t t-else="" t-esc="'x'"/></div>`);
expect(renderToString(qweb, "test")).toBe("<div>x</div>");
});
@@ -1644,7 +1644,7 @@ describe("debugging", () => {
console.log = jest.fn();
qweb.addTemplate(
"test",
`<div t-debug="1"><t t-if="true"><span t-debug="1">hey</span></t></div>`
`<div t-debug=""><t t-if="true"><span t-debug="">hey</span></t></div>`
);
qweb.render("test");
expect(qweb.templates.test.fn.toString()).toMatchSnapshot();
@@ -1658,7 +1658,7 @@ describe("debugging", () => {
console.log = jest.fn();
qweb.addTemplates(`
<templates>
<p t-name="sub" t-debug="1">coucou</p>
<p t-name="sub" t-debug="">coucou</p>
<div t-name="test">
<t t-call="sub"/>
</div>
+2 -2
View File
@@ -1101,7 +1101,7 @@ const RESPONSIVE_XML = `<templates>
<t t-raw="maincontent"/>
</div>
</div>
<t t-else="1">
<t t-else="">
<t t-raw="maincontent"/>
</t>
</div>
@@ -1438,7 +1438,7 @@ const FORM_XML = `<templates>
<div>Text: <t t-esc="state.text"/></div>
<div>Other Text: <t t-esc="state.othertext"/></div>
<div>Number: <t t-esc="state.number"/></div>
<div>Boolean: <t t-if="state.bool">True</t><t t-else="1">False</t></div>
<div>Boolean: <t t-if="state.bool">True</t><t t-else="">False</t></div>
<div>Color: <t t-esc="state.color"/></div>
</div>
</templates>