# All files / src/mock-data tree-data.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 0/0
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57

    3x

    3x
    3x
     import { getNodePaths, prepareTreeDataForAutocomplete } from '../utils';

    export const treeData = [
      {
        label: 'Item 1',
        id: 'item_1',
        items: [
          {
            label: 'Item 1a',
            id: 'item_1a',
          },
          {
            label: 'Item 1b',
            id: 'item_1b',
            items: [
              {
                label: 'Item 1b A',
                id: 'item_1b_A',
              },
              {
                label: 'Item 1b B',
                id: 'item_1b_B',
              },
            ],
            tags: ['tag2', 'tag3'],
          },
        ],
      },
      {
        label: 'Some Item 2',
        id: 'item_2',
      },
      {
        label: 'Another reaaaaalllllyyyyy looooooong Item 3',
        id: 'item_3',
        items: [
          {
            label: 'Item 3a (single child, open by default)',
            id: 'item_3a',
            items: [
              {
                label: 'Item 3a A',
                id: 'item_3a_A',
              },
              {
                label: 'Item 3a B',
                id: 'item_3a_B',
              },
            ],
          },
        ],
      },
    ];

    const flatPaths = getNodePaths(treeData);
    export const flattenedPaths = prepareTreeDataForAutocomplete(flatPaths);