How to use the inferno-vnode-flags.VNodeFlags.HtmlElement function in inferno-vnode-flags

To help you get started, we’ve selected a few inferno-vnode-flags 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 infernojs / inferno / packages / inferno / __tests__ / rendering.spec.jsx View on Github external
it('Should create new object when dom exists', () => {
    const bar = createVNode(VNodeFlags.HtmlElement, 'div', null, createTextVNode('123'), ChildFlags.HasVNodeChildren);
    const foo = createVNode(VNodeFlags.HtmlElement, 'div', null, bar, ChildFlags.HasVNodeChildren);

    render(foo, container);
    expect(container.innerHTML).toEqual('<div><div>123</div></div>');

    render(null, container);

    render(foo, container);
    expect(container.innerHTML).toEqual('<div><div>123</div></div>');
  });
github infernojs / inferno / packages / inferno / __tests__ / patching.spec.jsx View on Github external
it('Should do nothing if lastVNode strictly equals nextVnode', () =&gt; {
    const yar = createVNode(VNodeFlags.HtmlElement, 'div', null, createTextVNode('123'), ChildFlags.HasVNodeChildren, null, null, null);
    const bar = createVNode(VNodeFlags.HtmlElement, 'div', null, createTextVNode('123'), ChildFlags.HasVNodeChildren, null, null, null);
    let foo = createVNode(VNodeFlags.HtmlElement, 'div', null, [bar, yar], ChildFlags.HasNonKeyedChildren, null, null, null);

    render(foo, container);
    expect(container.innerHTML).toEqual('<div><div>123</div><div>123</div></div>');

    foo = createVNode(VNodeFlags.HtmlElement, 'div', null, [bar, yar], ChildFlags.HasNonKeyedChildren, null, null, null);

    render(foo, container);
    expect(container.innerHTML).toEqual('<div><div>123</div><div>123</div></div>');
  });
github infernojs / inferno / packages / inferno / __tests__ / rendering.spec.jsx View on Github external
it('Should throw error when trying to render to document.body', () => {
    const div = createVNode(VNodeFlags.HtmlElement, 'div', null, createTextVNode('1'), ChildFlags.HasVNodeChildren);
    try {
      render(div, document.body);
    } catch (e) {
      expect(e.message).toEqual('Inferno Error: you cannot render() to the "document.body". Use an empty element as a container instead.');
    }
  });