diff --git a/src/component/fiber.ts b/src/component/fiber.ts index 569721d3..c50407ad 100644 --- a/src/component/fiber.ts +++ b/src/component/fiber.ts @@ -227,7 +227,7 @@ export class Fiber { } // 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 - 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); selfVnode.elm = target; target = selfVnode; diff --git a/src/qweb/qweb.ts b/src/qweb/qweb.ts index 662a841c..d3e8648d 100644 --- a/src/qweb/qweb.ts +++ b/src/qweb/qweb.ts @@ -133,7 +133,11 @@ const UTILS: Utils = { }, getScope(obj, property: string) { 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__; if (!newObj || isComponent(newObj)) { return obj0; diff --git a/tests/component/un_mounting.test.ts b/tests/component/un_mounting.test.ts index 63f1e6bb..052c2a7c 100644 --- a/tests/component/un_mounting.test.ts +++ b/tests/component/un_mounting.test.ts @@ -29,25 +29,29 @@ describe("mount targets", () => { test("can attach a component to an existing node (if same tagname)", async () => { class App extends Component { static template = xml`
app

another tag

`; - state = useState({customClass: 'custom'}); + state = useState({ customClass: "custom" }); } const div = document.createElement("div"); - div.classList.add('arbitrary'); + div.classList.add("arbitrary"); div.innerHTML = `

pre-existing

`; fixture.appendChild(div); const app = new App(); await app.mount(div, { position: "self" }); - expect(fixture.innerHTML).toBe(`

pre-existing

app

another tag

`); + expect(fixture.innerHTML).toBe( + `

pre-existing

app

another tag

` + ); expect(div).toBe(app.el); - app.state.customClass = 'custom2'; + app.state.customClass = "custom2"; await nextTick(); - expect(fixture.innerHTML).toBe(`

pre-existing

app

another tag

`); + expect(fixture.innerHTML).toBe( + `

pre-existing

app

another tag

` + ); expect(div).toBe(app.el); - app.unmount() + app.unmount(); // This assert is a best guess // The use case it covers was not really thought through // and may change in the future diff --git a/tests/qweb/qweb.test.ts b/tests/qweb/qweb.test.ts index e5d75b88..3729d5d3 100644 --- a/tests/qweb/qweb.test.ts +++ b/tests/qweb/qweb.test.ts @@ -965,7 +965,10 @@ describe("t-call (template calling", () => { `); - 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 = "

a 2

b 3

c 4

d 5

"; expect(renderToString(qweb, "Parent", { root })).toBe(expected);