mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
@@ -500,6 +500,15 @@ will result in :
|
||||
</div>
|
||||
```
|
||||
|
||||
This can be used to define variables scoped to a sub template:
|
||||
|
||||
```xml
|
||||
<t t-call="other-template">
|
||||
<t t-set="var" t-value="1"/>
|
||||
</t>
|
||||
<!-- "var" does not exist here -->
|
||||
```
|
||||
|
||||
### Translations
|
||||
|
||||
By default, QWeb specify that templates should be translated. If this behaviour
|
||||
|
||||
+1
-2
@@ -137,8 +137,7 @@ export class Portal extends Component<any, any> {
|
||||
}
|
||||
this.__checkVNodeStructure(vnode);
|
||||
const shouldDeploy =
|
||||
(!this.portal || this.el!.contains(this.portal.elm!)) &&
|
||||
!this.doTargetLookUp;
|
||||
(!this.portal || this.el!.contains(this.portal.elm!)) && !this.doTargetLookUp;
|
||||
|
||||
if (!this.doTargetLookUp && !shouldDeploy) {
|
||||
// Only on pure patching, provided the
|
||||
|
||||
+1
-1
@@ -650,7 +650,7 @@ export class QWeb extends EventBus {
|
||||
if (!name.startsWith("t-") && !(<Element>node).getAttribute("t-attf-" + name)) {
|
||||
const attID = ctx.generateID();
|
||||
if (name === "class") {
|
||||
if (value = value.trim()) {
|
||||
if ((value = value.trim())) {
|
||||
let classDef = value
|
||||
.split(/\s+/)
|
||||
.map(a => `'${a}':true`)
|
||||
|
||||
+13
-13
@@ -563,16 +563,16 @@ describe("Portal: Basic use and DOM placement", () => {
|
||||
const parent = new Parent();
|
||||
await parent.mount(fixture);
|
||||
|
||||
expect(outside.innerHTML).toBe('<span>gloria</span>');
|
||||
expect(parent.el!.innerHTML).toBe('<portal></portal>');
|
||||
expect(outside.innerHTML).toBe("<span>gloria</span>");
|
||||
expect(parent.el!.innerHTML).toBe("<portal></portal>");
|
||||
|
||||
parent.unmount();
|
||||
expect(outside.innerHTML).toBe('');
|
||||
expect(parent.el!.innerHTML).toBe('<portal><span>gloria</span></portal>');
|
||||
expect(outside.innerHTML).toBe("");
|
||||
expect(parent.el!.innerHTML).toBe("<portal><span>gloria</span></portal>");
|
||||
|
||||
await parent.mount(fixture);
|
||||
expect(outside.innerHTML).toBe('<span>gloria</span>');
|
||||
expect(parent.el!.innerHTML).toBe('<portal></portal>');
|
||||
expect(outside.innerHTML).toBe("<span>gloria</span>");
|
||||
expect(parent.el!.innerHTML).toBe("<portal></portal>");
|
||||
});
|
||||
|
||||
test("portal manual unmount with subcomponent", async () => {
|
||||
@@ -587,7 +587,7 @@ describe("Portal: Basic use and DOM placement", () => {
|
||||
}
|
||||
}
|
||||
class Parent extends Component<any, any> {
|
||||
static components = { Portal , Child };
|
||||
static components = { Portal, Child };
|
||||
static template = xml`
|
||||
<div>
|
||||
<Portal target="'#outside'">
|
||||
@@ -599,16 +599,16 @@ describe("Portal: Basic use and DOM placement", () => {
|
||||
const parent = new Parent();
|
||||
await parent.mount(fixture);
|
||||
|
||||
expect(outside.innerHTML).toBe('<span>gloria</span>');
|
||||
expect(parent.el!.innerHTML).toBe('<portal></portal>');
|
||||
expect(outside.innerHTML).toBe("<span>gloria</span>");
|
||||
expect(parent.el!.innerHTML).toBe("<portal></portal>");
|
||||
|
||||
parent.unmount();
|
||||
expect(outside.innerHTML).toBe('');
|
||||
expect(parent.el!.innerHTML).toBe('<portal><span>gloria</span></portal>');
|
||||
expect(outside.innerHTML).toBe("");
|
||||
expect(parent.el!.innerHTML).toBe("<portal><span>gloria</span></portal>");
|
||||
|
||||
await parent.mount(fixture);
|
||||
expect(outside.innerHTML).toBe('<span>gloria</span>');
|
||||
expect(parent.el!.innerHTML).toBe('<portal></portal>');
|
||||
expect(outside.innerHTML).toBe("<span>gloria</span>");
|
||||
expect(parent.el!.innerHTML).toBe("<portal></portal>");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user