How to use ivi-html - 10 common examples

To help you get started, we’ve selected a few ivi-html examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github localvoid / ivi / packages / ivi / src / vdom / __tests__ / vnode_children.spec.ts View on Github external
test(`{ mapRange(0, 2, (i) =&gt; <div></div>) }`, () =&gt; {
  const v1 = h.div().k("a");
  const v2 = h.div().k("b");
  const v = h.div().c(mapRange(0, 2, i =&gt; i === 0 ? v1 : v2));

  expect(v._c).toBe(v1);
  expect(v1._f &amp; VNodeFlags.Key).toBeTruthy();
  expect(v1._k).toBe("a");
  expect(v2._f &amp; VNodeFlags.Key).toBeTruthy();
  expect(v2._k).toBe("b");
  expect(v1._l).toBe(v2);
  expect(v1._r).toBe(v2);
  expect(v2._l).toBe(v1);
  expect(v2._r).toBeNull();
});
github localvoid / ivi / packages / ivi / src / vdom / __tests__ / vnode_children.spec.ts View on Github external
test(`<div></div>`, () =&gt; {
  const v1 = h.div();
  const v = h.div().c(v1);

  expect(v._c).toBe(v1);
  expect(v1._f &amp; VNodeFlags.Key).toBeFalsy();
  expect(v1._k).toBe(0);
  expect(v1._l).toBe(v1);
  expect(v1._r).toBeNull();
});
github localvoid / ivi / packages / ivi / src / vdom / __tests__ / vnode_children.spec.ts View on Github external
test(`<div></div><div></div>`, () =&gt; {
  const v1 = h.div();
  const v2 = h.div();
  const v = h.div().c(v1, v2);

  expect(v._c).toBe(v1);
  expect(v1._f &amp; VNodeFlags.Key).toBeFalsy();
  expect(v1._k).toBe(0);
  expect(v2._f &amp; VNodeFlags.Key).toBeFalsy();
  expect(v2._k).toBe(1);
  expect(v1._l).toBe(v2);
  expect(v1._r).toBe(v2);
  expect(v2._l).toBe(v1);
  expect(v2._r).toBeNull();
});
github localvoid / ivi / packages / ivi / src / vdom / __tests__ / vnode_children.spec.ts View on Github external
test(`{ children(<div></div><div></div>) }`, () =&gt; {
  const v1 = h.div();
  const v2 = h.div();
  const v = h.div().c(fragment(v1, v2));

  expect(v._c).toBe(v1);
  expect(v1._f &amp; VNodeFlags.Key).toBeFalsy();
  expect(v1._k).toBe(0);
  expect(v2._f &amp; VNodeFlags.Key).toBeFalsy();
  expect(v2._k).toBe(1);
  expect(v1._l).toBe(v2);
  expect(v1._r).toBe(v2);
  expect(v2._l).toBe(v1);
  expect(v2._r).toBeNull();
});
github localvoid / ivi / packages / ivi / src / vdom / __tests__ / vnode_children.spec.ts View on Github external
test(`{ children(<div></div><div></div>) }`, () =&gt; {
  const v1 = h.div();
  const v2 = h.div();
  const v = h.div().c(fragment(v1, v2));

  expect(v._c).toBe(v1);
  expect(v1._f &amp; VNodeFlags.Key).toBeFalsy();
  expect(v1._k).toBe(0);
  expect(v2._f &amp; VNodeFlags.Key).toBeFalsy();
  expect(v2._k).toBe(1);
  expect(v1._l).toBe(v2);
  expect(v1._r).toBe(v2);
  expect(v2._l).toBe(v1);
  expect(v2._r).toBeNull();
});
github localvoid / ivi / packages / ivi / src / vdom / __tests__ / fragment.spec.ts View on Github external
test(`<div></div>`, () =&gt; {
  const v1 = h.div();
  const first = fragment(v1);

  expect(first).toBe(v1);
  expect(v1._l).toBe(v1);
  expect(v1._r).toBeNull();
});
github localvoid / ivi / packages / ivi-test / src / __tests__ / snapshot.spec.ts View on Github external
test("<div class="a">", () =&gt; {
    expect(render(h.div("a")).toSnapshot()).toMatchSnapshot();
  });
</div>
github localvoid / ivi / packages / ivi-test / src / __tests__ / snapshot.spec.ts View on Github external
test("<div class="a b">", () =&gt; {
    expect(render(h.div("a b")).toSnapshot()).toMatchSnapshot();
  });
</div>
github localvoid / ivi / packages / ivi / src / vdom / __tests__ / sync_components_root.spec.ts View on Github external
render() {
    if (this.state === 1) {
      return h.span().c(1);
    }
    return h.div().c(0);
  }
github localvoid / ivi / packages / ivi / src / vdom / __tests__ / vnode_element.spec.ts View on Github external
  expect(() =&gt; h.div("", { unsafeHTML: UNSAFE_HTML("<span></span>") }).c("abc")).toThrow(Error);
});

ivi-html

Virtual DOM factories for HTML elements

MIT
Latest version published 5 years ago

Package Health Score

48 / 100
Full package analysis

Popular ivi-html functions