All files / dist/react VgCard.js

80% Statements 8/10
40% Branches 2/5
100% Functions 2/2
80% Lines 8/10

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        7x 4x 4x     4x   4x       4x 4x   4x                                    
import React, { forwardRef, useRef, useEffect } from "react";
import "../index.js";
import { useEventListener } from "./react-utils.js";
 
export const VgCard = forwardRef((props, forwardedRef) => {
  const ref = useRef(null);
  const { interactive, heading, variant, ...filteredProps } = props;
 
  /** Event listeners - run once */
  useEventListener(ref, "vg-action", props.onVgAction);
 
  return React.createElement(
    "vg-card",
    {
      ref: (node) => {
        ref.current = node;
        Iif (typeof forwardedRef === "function") {
          forwardedRef(node);
        } else Iif (forwardedRef) {
          forwardedRef.current = node;
        }
      },
      ...filteredProps,
      heading: props.heading,
      variant: props.variant,
      class: props.className,
      exportparts: props.exportparts,
      for: props.htmlFor,
      part: props.part,
      tabindex: props.tabIndex,
      interactive: props.interactive ? "" : undefined,
      style: { ...props.style },
    },
    props.children
  );
});