mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[CLEANUP] run prettier on the codebase
This commit is contained in:
@@ -227,7 +227,7 @@ export class Fiber {
|
|||||||
}
|
}
|
||||||
// In self mode, we *know* we are to take possession of the target
|
// In self mode, we *know* we are to take possession of the target
|
||||||
// Hence we manually create the corresponding VNode and copy the "key" in data
|
// Hence we manually create the corresponding VNode and copy the "key" in data
|
||||||
const selfVnodeData = fiber.vnode!.data ? {key: fiber.vnode!.data.key} : {};
|
const selfVnodeData = fiber.vnode!.data ? { key: fiber.vnode!.data.key } : {};
|
||||||
const selfVnode = h(fiber.vnode!.sel, selfVnodeData);
|
const selfVnode = h(fiber.vnode!.sel, selfVnodeData);
|
||||||
selfVnode.elm = target;
|
selfVnode.elm = target;
|
||||||
target = selfVnode;
|
target = selfVnode;
|
||||||
|
|||||||
+5
-1
@@ -133,7 +133,11 @@ const UTILS: Utils = {
|
|||||||
},
|
},
|
||||||
getScope(obj, property: string) {
|
getScope(obj, property: string) {
|
||||||
const obj0 = obj;
|
const obj0 = obj;
|
||||||
while (obj && !obj.hasOwnProperty(property) && !(obj.hasOwnProperty('__access_mode__') && obj.__access_mode__ === 'ro')) {
|
while (
|
||||||
|
obj &&
|
||||||
|
!obj.hasOwnProperty(property) &&
|
||||||
|
!(obj.hasOwnProperty("__access_mode__") && obj.__access_mode__ === "ro")
|
||||||
|
) {
|
||||||
const newObj = obj.__proto__;
|
const newObj = obj.__proto__;
|
||||||
if (!newObj || isComponent(newObj)) {
|
if (!newObj || isComponent(newObj)) {
|
||||||
return obj0;
|
return obj0;
|
||||||
|
|||||||
@@ -29,25 +29,29 @@ describe("mount targets", () => {
|
|||||||
test("can attach a component to an existing node (if same tagname)", async () => {
|
test("can attach a component to an existing node (if same tagname)", async () => {
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
static template = xml`<div t-att-class="state.customClass">app<p>another tag</p></div>`;
|
static template = xml`<div t-att-class="state.customClass">app<p>another tag</p></div>`;
|
||||||
state = useState({customClass: 'custom'});
|
state = useState({ customClass: "custom" });
|
||||||
}
|
}
|
||||||
const div = document.createElement("div");
|
const div = document.createElement("div");
|
||||||
div.classList.add('arbitrary');
|
div.classList.add("arbitrary");
|
||||||
div.innerHTML = `<p>pre-existing</p>`;
|
div.innerHTML = `<p>pre-existing</p>`;
|
||||||
fixture.appendChild(div);
|
fixture.appendChild(div);
|
||||||
|
|
||||||
const app = new App();
|
const app = new App();
|
||||||
await app.mount(div, { position: "self" });
|
await app.mount(div, { position: "self" });
|
||||||
|
|
||||||
expect(fixture.innerHTML).toBe(`<div class="arbitrary custom"><p>pre-existing</p>app<p>another tag</p></div>`);
|
expect(fixture.innerHTML).toBe(
|
||||||
|
`<div class="arbitrary custom"><p>pre-existing</p>app<p>another tag</p></div>`
|
||||||
|
);
|
||||||
expect(div).toBe(app.el);
|
expect(div).toBe(app.el);
|
||||||
|
|
||||||
app.state.customClass = 'custom2';
|
app.state.customClass = "custom2";
|
||||||
await nextTick();
|
await nextTick();
|
||||||
expect(fixture.innerHTML).toBe(`<div class="arbitrary custom2"><p>pre-existing</p>app<p>another tag</p></div>`);
|
expect(fixture.innerHTML).toBe(
|
||||||
|
`<div class="arbitrary custom2"><p>pre-existing</p>app<p>another tag</p></div>`
|
||||||
|
);
|
||||||
expect(div).toBe(app.el);
|
expect(div).toBe(app.el);
|
||||||
|
|
||||||
app.unmount()
|
app.unmount();
|
||||||
// This assert is a best guess
|
// This assert is a best guess
|
||||||
// The use case it covers was not really thought through
|
// The use case it covers was not really thought through
|
||||||
// and may change in the future
|
// and may change in the future
|
||||||
|
|||||||
@@ -965,7 +965,10 @@ describe("t-call (template calling", () => {
|
|||||||
|
|
||||||
</templates>
|
</templates>
|
||||||
`);
|
`);
|
||||||
const root = { val: "a", children: [{ val: "b", children: [{ val: "c" , children: [{val: "d"}] }] }] };
|
const root = {
|
||||||
|
val: "a",
|
||||||
|
children: [{ val: "b", children: [{ val: "c", children: [{ val: "d" }] }] }]
|
||||||
|
};
|
||||||
const expected =
|
const expected =
|
||||||
"<div><div><p>a 2</p><div><p>b 3</p><div><p>c 4</p><div><p>d 5</p></div></div></div></div></div>";
|
"<div><div><p>a 2</p><div><p>b 3</p><div><p>c 4</p><div><p>d 5</p></div></div></div></div></div>";
|
||||||
expect(renderToString(qweb, "Parent", { root })).toBe(expected);
|
expect(renderToString(qweb, "Parent", { root })).toBe(expected);
|
||||||
|
|||||||
Reference in New Issue
Block a user