import { v as l, h6 as c, L as m, gn as u, h7 as h, f as i, ct as r } from "./56c67d3b.js";
import "react";
import "react-dom";
const C = l(123), s = "TestComp", n = "comps/lazyLoadComp/lazyLoadComp.test", d = c(s, n);
test("lazyload comp", async () => {
  let e = null;
  e = new d({
    dispatch: (t) => {
      e && (e = e.reduce(t));
    }
  }), expect(e.toJsonValue()).toBe(void 0), await e.load(), expect(e.toJsonValue()).toBe(123), e.dispatchChangeValueAction(345), expect(e.toJsonValue()).toBe(345);
});
test("lazyload comp keep values", async () => {
  let e = null;
  e = new d({
    dispatch: (t) => {
      e && (e = e.reduce(t));
    },
    value: 456
  }), expect(e.toJsonValue()).toBe(456), await e.load(), expect(e.toJsonValue()).toBe(456);
});
test("lazyload comp exposing data", async () => {
  const e = c(s, n, async () => h(i({
    hello: l(123)
  }), (a) => ({
    hello: a.children.hello.getView()
  })));
  let t = null;
  t = new e({
    dispatch: (a) => {
      t && (t = t.reduce(a));
    }
  }), await t.load();
  const o = m(t);
  expect(o.exposingValues.hello).toBe(123);
});
test("lazyload comp execute method", async () => {
  const e = c(s, n, async () => r(i({
    hello: l(123)
  }), [{
    method: {
      name: "add",
      params: [{
        name: "value",
        type: "number"
      }]
    },
    execute: (o, a) => {
      const p = o.children.hello;
      p.dispatchChangeValueAction(p.getView() + a[0]);
    }
  }]));
  let t = null;
  t = new e({
    dispatch: (o) => {
      t && (t = t.reduce(o));
    }
  }), await t.load(), t.reduce(u({
    type: "execute",
    methodName: "add",
    params: [10]
  }, !1)), await new Promise((o) => setTimeout(o, 20)), expect(t.children.hello.getView()).toEqual(133);
});
export {
  C as TestComp
};
