import { M as s, X as u, ak as d, H as v, I as h, k as m, L as o, gp as w } from "./56c67d3b.js";
import "react";
import "react-dom";
const r = new s({
  v1: u,
  v2: d
}, (a) => a).setPropertyViewFn(() => /* @__PURE__ */ v(h, {})).build(), c = {
  value: {
    v1: "v1: {{a + 1}}",
    v2: "{{a + 2}}"
  }
};
describe("withParams", () => {
  it("normal", () => {
    const a = m(r, ["a"]);
    let e = new a(c);
    e = o(e);
    let t = e.getView();
    expect(t.v1).toEqual("v1: 1"), expect(t.v2).toEqual(2), e = e.reduce(a.setPartialParamDataAction({
      a: "10"
    })), e = o(e), t = e.getView(), expect(t.v1).toEqual("v1: 101"), expect(t.v2).toEqual(102);
  }), it("normal with default", () => {
    const a = w(r, {
      a: 10
    });
    let e = new a(c);
    e = o(e);
    let t = e.getView();
    expect(t.v1).toEqual("v1: 11"), expect(t.v2).toEqual(12), e = e.reduce(a.setPartialParamDataAction({
      a: "10"
    })), e = o(e), t = e.getView(), expect(t.v1).toEqual("v1: 101"), expect(t.v2).toEqual(102);
  }), it("keep node stable", () => {
    var p, l, i, n;
    const a = m(r, ["a"]);
    let e = new a(c);
    e = o(e);
    const t = e.setParams({
      a: 0
    });
    expect(t.getComp().node() === e.getComp().node()).toBeTruthy(), expect(((p = t.node()) == null ? void 0 : p.children.comp.child) === ((l = e.node()) == null ? void 0 : l.children.comp.child)).toBeTruthy(), expect(t.extraNode() === e.extraNode()).toBeTruthy(), expect(((i = t.node()) == null ? void 0 : i.children.wrap) === ((n = e.node()) == null ? void 0 : n.children.wrap)).toBeTruthy();
  });
});
