All files / components/Common SortCaret.js

100% Statements 8/8
100% Branches 7/7
100% Functions 2/2
100% Lines 7/7

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  808x 517x 2x   515x 26x   489x       808x            
export function getSortCaret(header) {
  if (!header.column.getCanSort()) return "";
  if (header.column.getIsSorted() === "asc") {
    return "🔼";
  }
  if (header.column.getIsSorted() === "desc") {
    return "🔽";
  }
  return "";
}
 
export default function SortCaret({ header, testId = "testid" }) {
  return (
    <span data-testid={`${testId}-header-${header.column.id}-sort-carets`}>
      {getSortCaret(header)}
    </span>
  );
}