How to use the inferno-vnode-flags.ChildFlags.HasNonKeyedChildren 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-test-utils / __tests__ / snapshots.spec.jsx View on Github external
it('Should render fragment', () => {
        const fragmentA = createFragment([<div id="a1">A1</div>, <div>A2</div>], ChildFlags.HasNonKeyedChildren, 'A');

        const fragmentB = createFragment([<div id="b1">B1</div>], ChildFlags.HasNonKeyedChildren, 'B');

        const fragmentC = createFragment([<div id="c1">C1</div>, <div>C2</div>, <div>C3</div>], ChildFlags.HasNonKeyedChildren, 'C');

        expect(
          renderToSnapshot(
            <div>
              {fragmentA}
              {fragmentB}
              {fragmentC}
            </div>
          )
        ).toMatchSnapshot();
      });
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-create-element / __tests__ / createElement.fragment.spec.js View on Github external
it('Should be possible to move component with fragment root', () =&gt; {
      const fragmentA = createFragment([createElement('div', { id: 'a1' }, 'A1'), createElement('div', null, 'A2')], ChildFlags.HasNonKeyedChildren, 'A');
      const fragmentB = createFragment([createElement('div', { id: 'b1' }, 'B1')], ChildFlags.HasNonKeyedChildren, 'B');
      const fragmentC = createFragment(
        [createElement('div', { id: 'c1' }, 'C1'), createElement('div', null, 'C2'), createElement('div', null, 'C3')],
        ChildFlags.HasNonKeyedChildren,
        'C'
      );

      const content = [fragmentC];

      function SFC() {
        return createElement(Fragment, null, createElement('span', null, '1'), createElement(Fragment, null, content), createElement('span', null, '2'));
      }

      render(createElement(Fragment, null, fragmentA, createElement(SFC, { key: 'sfc' }), fragmentB, fragmentC), container);

      const FragmentAHtml = '<div id="a1">A1</div><div>A2</div>';
      const FragmentBHtml = '<div id="b1">B1</div>';
      const FragmentCHtml = '<div id="c1">C1</div><div>C2</div><div>C3</div>';
      const SFCHtml = '<span>1</span>' + FragmentCHtml + '<span>2</span>';
github infernojs / inferno / packages / inferno / __tests__ / patching.spec.jsx View on Github external
it('Should not patch same innerHTML', () =&gt; {
    container.innerHTML = '<span><span><span>child</span></span></span>';

    const childelem = container.firstElementChild.firstElementChild;
    const props = { dangerouslySetInnerHTML: { __html: '<span>child</span>' } };

    const bar = createVNode(VNodeFlags.HtmlElement, 'span', null, null, ChildFlags.HasInvalidChildren, props, null, null);
    const foo = createVNode(VNodeFlags.HtmlElement, 'span', null, [bar], ChildFlags.HasNonKeyedChildren, null, null, null);

    render(foo, container);

    expect(childelem).toBe(container.firstElementChild.firstElementChild);
  });
github infernojs / inferno / packages / inferno-test-utils / __tests__ / snapshots.spec.jsx View on Github external
it('Should render fragment', () =&gt; {
        const fragmentA = createFragment([<div id="a1">A1</div>, <div>A2</div>], ChildFlags.HasNonKeyedChildren, 'A');

        const fragmentB = createFragment([<div id="b1">B1</div>], ChildFlags.HasNonKeyedChildren, 'B');

        const fragmentC = createFragment([<div id="c1">C1</div>, <div>C2</div>, <div>C3</div>], ChildFlags.HasNonKeyedChildren, 'C');

        expect(
          renderToSnapshot(
            <div>
              {fragmentA}
              {fragmentB}
              {fragmentC}
            </div>
          )
        ).toMatchSnapshot();
      });
github infernojs / inferno / packages / inferno-create-element / __tests__ / validations.spec.jsx View on Github external
it('Should if there is one that cannot be keyed for example array', () =&gt; {
        const errorNode = (
          <div>
            {createTextVNode('foo', 'foo')}
            {null}
          </div>
        );

        expect(() =&gt; render(errorNode, container)).toThrowError(
          'Inferno Error: Encountered invalid node with mixed keys. Location: \n&gt;&gt; InvalidVNode(null)\n&gt;&gt; <div>'
        );
      });
</div>
github infernojs / inferno / packages / inferno-hydrate / __tests__ / hydrate.spec.jsx View on Github external
render() {
            return createFragment([<div>First</div>, <div>second</div>], ChildFlags.HasNonKeyedChildren);
          }
        }
github infernojs / inferno / packages / inferno-create-element / __tests__ / createElement.fragment.spec.js View on Github external
function FunctionalComp() {
        return createFragment([createElement('div', null, 'Functional')], ChildFlags.HasNonKeyedChildren);
      }
github infernojs / inferno / packages / inferno-hydrate / __tests__ / hydrate.spec.jsx View on Github external
render() {
            return createFragment(
              [<div>First</div>, createFragment([<div>Sub1</div>, <div>Sub2</div>], ChildFlags.HasNonKeyedChildren), <div>second</div>],
              ChildFlags.HasNonKeyedChildren
            );
          }
        }