How to use the inferno.createFragment function in inferno

To help you get started, we’ve selected a few inferno 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-create-element / __tests__ / createElement.fragment.spec.js View on Github external
it('Should be possible to move component with fragment root', () => {
      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>';
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-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__ / createElement.fragment.spec.js View on Github external
it('Should be possible to move component with fragment root #2', () => {
      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,
github infernojs / inferno / packages / inferno-create-element / __tests__ / createElement.fragment.spec.js View on Github external
it('Should clone fragment children if they are passed as reference', () =&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>';
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>';
github infernojs / inferno / packages / inferno-create-element / __tests__ / createElement.fragment.spec.js View on Github external
      const fragmentB = () => createFragment([createElement('div', { id: 'b1' }, 'B1')], ChildFlags.HasNonKeyedChildren, 'B');
github infernojs / inferno / packages / inferno-server / __tests__ / creation.spec.server.jsx View on Github external
render() {
          return createFragment([<div id="m">More</div>, 'Fragments'], ChildFlags.UnknownChildren);
        }
      }
github infernojs / inferno / packages / inferno-hydrate / __tests__ / hydrate.spec.jsx View on Github external
        const fragmentA = () =&gt; createFragment([<div id="a1">A1</div>, <div>A2</div>], ChildFlags.HasNonKeyedChildren, 'A');
github infernojs / inferno / packages / inferno-hydrate / __tests__ / hydrate.spec.jsx View on Github external
        const fragmentC = () =&gt; createFragment([<div id="c1">C1</div>, <div>C2</div>, <div>C3</div>], ChildFlags.HasNonKeyedChildren, 'C');