huridocs/uwazi

View on GitHub
app/react/Markdown/components/specs/__snapshots__/PieChart.spec.js.snap

Summary

Maintainability
Test Coverage
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PieChart Markdown component should render a placeholder when data is undefined 1`] = `
<div
  className="PieChart "
>
  <Loader />
</div>
`;

exports[`PieChart Markdown component should render the data passed by mapStateToProps and ignore "0" values 1`] = `
<div
  className="PieChart custom-class"
>
  <ForwardRef
    height={222}
    width="100%"
  >
    <PieChart
      barCategoryGap="10%"
      barGap={4}
      cx="50%"
      cy="50%"
      endAngle={360}
      height={222}
      innerRadius={0}
      layout="centric"
      margin={
        Object {
          "bottom": 5,
          "left": 5,
          "right": 5,
          "top": 5,
        }
      }
      outerRadius="80%"
      reverseStackOrder={false}
      stackOffset="none"
      startAngle={0}
      syncMethod="index"
      width={222}
    >
      <Pie
        animationBegin={400}
        animationDuration={1500}
        animationEasing="ease"
        blendStroke={false}
        cx="50%"
        cy="50%"
        data={
          Array [
            Object {
              "id": "id2",
              "label": "label2",
              "results": 33,
            },
            Object {
              "id": "id1",
              "label": "label1",
              "results": 25,
            },
            Object {
              "id": "id3",
              "label": "label3",
              "results": 13,
            },
          ]
        }
        dataKey="results"
        endAngle={360}
        fill="#8884d8"
        hide={false}
        innerRadius="0"
        isAnimationActive={true}
        labelLine={false}
        legendType="rect"
        minAngle={0}
        nameKey="label"
        outerRadius="105"
        paddingAngle={0}
        rootTabIndex={0}
        startAngle={0}
        stroke="#fff"
      >
        <Cell
          fill="#ffcc00"
          key="0"
        />
        <Cell
          fill="#ffd633"
          key="1"
        />
        <Cell
          fill="#ffe066"
          key="2"
        />
      </Pie>
      <Tooltip
        accessibilityLayer={false}
        allowEscapeViewBox={
          Object {
            "x": false,
            "y": false,
          }
        }
        animationDuration={400}
        animationEasing="ease"
        contentStyle={Object {}}
        coordinate={
          Object {
            "x": 0,
            "y": 0,
          }
        }
        cursor={true}
        cursorStyle={Object {}}
        filterNull={true}
        isAnimationActive={true}
        itemStyle={Object {}}
        labelStyle={Object {}}
        offset={10}
        reverseDirection={
          Object {
            "x": false,
            "y": false,
          }
        }
        separator=" : "
        trigger="hover"
        useTranslate3d={false}
        viewBox={
          Object {
            "height": 0,
            "width": 0,
            "x": 0,
            "y": 0,
          }
        }
        wrapperStyle={Object {}}
      />
    </PieChart>
  </ForwardRef>
</div>
`;

exports[`PieChart Markdown component when passing maxCategories should not render others when sum is 0 1`] = `
<div
  className="PieChart custom-class"
>
  <ForwardRef
    height={222}
    width="100%"
  >
    <PieChart
      barCategoryGap="10%"
      barGap={4}
      cx="50%"
      cy="50%"
      endAngle={360}
      height={222}
      innerRadius={0}
      layout="centric"
      margin={
        Object {
          "bottom": 5,
          "left": 5,
          "right": 5,
          "top": 5,
        }
      }
      outerRadius="80%"
      reverseStackOrder={false}
      stackOffset="none"
      startAngle={0}
      syncMethod="index"
      width={222}
    >
      <Pie
        animationBegin={400}
        animationDuration={1500}
        animationEasing="ease"
        blendStroke={false}
        cx="50%"
        cy="50%"
        data={
          Array [
            Object {
              "id": "id6",
              "label": "label6",
              "results": 57,
            },
            Object {
              "id": "id2",
              "label": "label2",
              "results": 33,
            },
          ]
        }
        dataKey="results"
        endAngle={360}
        fill="#8884d8"
        hide={false}
        innerRadius="0"
        isAnimationActive={true}
        labelLine={false}
        legendType="rect"
        minAngle={0}
        nameKey="label"
        outerRadius="105"
        paddingAngle={0}
        rootTabIndex={0}
        startAngle={0}
        stroke="#fff"
      >
        <Cell
          fill="#ffcc00"
          key="0"
        />
        <Cell
          fill="#ffd633"
          key="1"
        />
      </Pie>
      <Tooltip
        accessibilityLayer={false}
        allowEscapeViewBox={
          Object {
            "x": false,
            "y": false,
          }
        }
        animationDuration={400}
        animationEasing="ease"
        contentStyle={Object {}}
        coordinate={
          Object {
            "x": 0,
            "y": 0,
          }
        }
        cursor={true}
        cursorStyle={Object {}}
        filterNull={true}
        isAnimationActive={true}
        itemStyle={Object {}}
        labelStyle={Object {}}
        offset={10}
        reverseDirection={
          Object {
            "x": false,
            "y": false,
          }
        }
        separator=" : "
        trigger="hover"
        useTranslate3d={false}
        viewBox={
          Object {
            "height": 0,
            "width": 0,
            "x": 0,
            "y": 0,
          }
        }
        wrapperStyle={Object {}}
      />
    </PieChart>
  </ForwardRef>
</div>
`;

exports[`PieChart Markdown component when passing maxCategories should only render the number of categories passed 1`] = `
<div
  className="PieChart custom-class"
>
  <ForwardRef
    height={222}
    width="100%"
  >
    <PieChart
      barCategoryGap="10%"
      barGap={4}
      cx="50%"
      cy="50%"
      endAngle={360}
      height={222}
      innerRadius={0}
      layout="centric"
      margin={
        Object {
          "bottom": 5,
          "left": 5,
          "right": 5,
          "top": 5,
        }
      }
      outerRadius="80%"
      reverseStackOrder={false}
      stackOffset="none"
      startAngle={0}
      syncMethod="index"
      width={222}
    >
      <Pie
        animationBegin={400}
        animationDuration={1500}
        animationEasing="ease"
        blendStroke={false}
        cx="50%"
        cy="50%"
        data={
          Array [
            Object {
              "id": "id6",
              "label": "label6",
              "results": 57,
            },
            Object {
              "id": "id2",
              "label": "label2",
              "results": 33,
            },
          ]
        }
        dataKey="results"
        endAngle={360}
        fill="#8884d8"
        hide={false}
        innerRadius="0"
        isAnimationActive={true}
        labelLine={false}
        legendType="rect"
        minAngle={0}
        nameKey="label"
        outerRadius="105"
        paddingAngle={0}
        rootTabIndex={0}
        startAngle={0}
        stroke="#fff"
      >
        <Cell
          fill="#ffcc00"
          key="0"
        />
        <Cell
          fill="#ffd633"
          key="1"
        />
      </Pie>
      <Tooltip
        accessibilityLayer={false}
        allowEscapeViewBox={
          Object {
            "x": false,
            "y": false,
          }
        }
        animationDuration={400}
        animationEasing="ease"
        contentStyle={Object {}}
        coordinate={
          Object {
            "x": 0,
            "y": 0,
          }
        }
        cursor={true}
        cursorStyle={Object {}}
        filterNull={true}
        isAnimationActive={true}
        itemStyle={Object {}}
        labelStyle={Object {}}
        offset={10}
        reverseDirection={
          Object {
            "x": false,
            "y": false,
          }
        }
        separator=" : "
        trigger="hover"
        useTranslate3d={false}
        viewBox={
          Object {
            "height": 0,
            "width": 0,
            "x": 0,
            "y": 0,
          }
        }
        wrapperStyle={Object {}}
      />
    </PieChart>
  </ForwardRef>
</div>
`;

exports[`PieChart Markdown component when passing maxCategories should render others when passing aggregateOthers 1`] = `
<div
  className="PieChart custom-class"
>
  <ForwardRef
    height={222}
    width="100%"
  >
    <PieChart
      barCategoryGap="10%"
      barGap={4}
      cx="50%"
      cy="50%"
      endAngle={360}
      height={222}
      innerRadius={0}
      layout="centric"
      margin={
        Object {
          "bottom": 5,
          "left": 5,
          "right": 5,
          "top": 5,
        }
      }
      outerRadius="80%"
      reverseStackOrder={false}
      stackOffset="none"
      startAngle={0}
      syncMethod="index"
      width={222}
    >
      <Pie
        animationBegin={400}
        animationDuration={1500}
        animationEasing="ease"
        blendStroke={false}
        cx="50%"
        cy="50%"
        data={
          Array [
            Object {
              "id": "id6",
              "label": "label6",
              "results": 57,
            },
            Object {
              "id": "id2",
              "label": "label2",
              "results": 33,
            },
            Object {
              "id": "others",
              "label": "others",
              "others": true,
              "results": 40,
            },
          ]
        }
        dataKey="results"
        endAngle={360}
        fill="#8884d8"
        hide={false}
        innerRadius="0"
        isAnimationActive={true}
        labelLine={false}
        legendType="rect"
        minAngle={0}
        nameKey="label"
        outerRadius="105"
        paddingAngle={0}
        rootTabIndex={0}
        startAngle={0}
        stroke="#fff"
      >
        <Cell
          fill="#ffcc00"
          key="0"
        />
        <Cell
          fill="#ffd633"
          key="1"
        />
        <Cell
          fill="#ffe066"
          key="2"
        />
      </Pie>
      <Tooltip
        accessibilityLayer={false}
        allowEscapeViewBox={
          Object {
            "x": false,
            "y": false,
          }
        }
        animationDuration={400}
        animationEasing="ease"
        contentStyle={Object {}}
        coordinate={
          Object {
            "x": 0,
            "y": 0,
          }
        }
        cursor={true}
        cursorStyle={Object {}}
        filterNull={true}
        isAnimationActive={true}
        itemStyle={Object {}}
        labelStyle={Object {}}
        offset={10}
        reverseDirection={
          Object {
            "x": false,
            "y": false,
          }
        }
        separator=" : "
        trigger="hover"
        useTranslate3d={false}
        viewBox={
          Object {
            "height": 0,
            "width": 0,
            "x": 0,
            "y": 0,
          }
        }
        wrapperStyle={Object {}}
      />
    </PieChart>
  </ForwardRef>
</div>
`;

exports[`PieChart Markdown component when passing scatter should display nested values with a composed label 1`] = `
<div
  className="PieChart custom-class"
>
  <ForwardRef
    height={222}
    width="100%"
  >
    <PieChart
      barCategoryGap="10%"
      barGap={4}
      cx="50%"
      cy="50%"
      endAngle={360}
      height={222}
      innerRadius={0}
      layout="centric"
      margin={
        Object {
          "bottom": 5,
          "left": 5,
          "right": 5,
          "top": 5,
        }
      }
      outerRadius="80%"
      reverseStackOrder={false}
      stackOffset="none"
      startAngle={0}
      syncMethod="index"
      width={222}
    >
      <Pie
        animationBegin={400}
        animationDuration={1500}
        animationEasing="ease"
        blendStroke={false}
        cx="50%"
        cy="50%"
        data={
          Array [
            Object {
              "id": "ipqlonrw89k",
              "label": "Nest A - A3",
              "results": 3,
            },
            Object {
              "id": "7pu7fcxl8eg",
              "label": "Nest A - A2",
              "results": 1,
            },
            Object {
              "id": "jpw985bxwwg",
              "label": "Nest B - B1",
              "results": 1,
            },
          ]
        }
        dataKey="results"
        endAngle={360}
        fill="#8884d8"
        hide={false}
        innerRadius="0"
        isAnimationActive={true}
        labelLine={false}
        legendType="rect"
        minAngle={0}
        nameKey="label"
        outerRadius="105"
        paddingAngle={0}
        rootTabIndex={0}
        startAngle={0}
        stroke="#fff"
      >
        <Cell
          fill="#ffcc00"
          key="0"
        />
        <Cell
          fill="#ffd633"
          key="1"
        />
        <Cell
          fill="#ffe066"
          key="2"
        />
      </Pie>
      <Tooltip
        accessibilityLayer={false}
        allowEscapeViewBox={
          Object {
            "x": false,
            "y": false,
          }
        }
        animationDuration={400}
        animationEasing="ease"
        contentStyle={Object {}}
        coordinate={
          Object {
            "x": 0,
            "y": 0,
          }
        }
        cursor={true}
        cursorStyle={Object {}}
        filterNull={true}
        isAnimationActive={true}
        itemStyle={Object {}}
        labelStyle={Object {}}
        offset={10}
        reverseDirection={
          Object {
            "x": false,
            "y": false,
          }
        }
        separator=" : "
        trigger="hover"
        useTranslate3d={false}
        viewBox={
          Object {
            "height": 0,
            "width": 0,
            "x": 0,
            "y": 0,
          }
        }
        wrapperStyle={Object {}}
      />
    </PieChart>
  </ForwardRef>
</div>
`;

exports[`PieChart Markdown component when prop show label should use pieChartLabel 1`] = `
<PieChartLabel
  cx={0}
  cy={0}
  data={
    Array [
      Object {
        "id": "id1",
        "label": "label1",
        "results": 25,
      },
    ]
  }
  index={0}
  innerRadius={0}
  midAngle={0}
  outerRadius={0}
  value={0}
/>
`;