Skip to content

Commit

Permalink
Merge pull request #6900 from Sage/flat-table-rtl-2
Browse files Browse the repository at this point in the history
refactor(flat-table-cell): convert unit tests to RTL
  • Loading branch information
edleeks87 committed Aug 27, 2024
2 parents 20a6430 + 7f9c714 commit 25e5555
Show file tree
Hide file tree
Showing 11 changed files with 1,099 additions and 869 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useRef } from "react";
import { PaddingProps } from "styled-system";
import { TableBorderSize, TableCellAlign } from "..";

import { TableBorderSize, TableCellAlign } from "..";
import { TagProps } from "../../../__internal__/utils/helpers/tags";
import {
StyledFlatTableCell,
StyledCellContent,
Expand All @@ -10,7 +11,9 @@ import Icon from "../../icon";
import guid from "../../../__internal__/utils/helpers/guid";
import useTableCell from "../__internal__/use-table-cell";

export interface FlatTableCellProps extends PaddingProps {
export interface FlatTableCellProps
extends PaddingProps,
Omit<TagProps, "data-component"> {
/** Content alignment */
align?: TableCellAlign;
/** Cell content */
Expand Down Expand Up @@ -43,6 +46,8 @@ export const FlatTableCell = ({
colspan,
rowspan,
id,
"data-element": dataElement,
"data-role": dataRole,
...rest
}: FlatTableCellProps) => {
const internalId = useRef(id || guid());
Expand Down Expand Up @@ -73,7 +78,9 @@ export const FlatTableCell = ({
makeCellSticky={makeCellSticky}
className={makeCellSticky ? "isSticky" : undefined}
align={align}
data-element="flat-table-cell"
data-component="flat-table-cell"
data-element={dataElement || "flat-table-cell"}
data-role={dataRole}
pl={pl}
onClick={isExpandableCell ? onClick : undefined}
tabIndex={isExpandableCell ? tabIndex : undefined}
Expand All @@ -94,6 +101,7 @@ export const FlatTableCell = ({
truncate && !title && typeof children === "string" ? children : title
}
expandable={expandable}
data-role="flat-table-cell-content"
>
{expandable && isFirstCell && (
<Icon type="chevron_down_thick" mr="8px" />
Expand Down
183 changes: 0 additions & 183 deletions src/components/flat-table/flat-table-cell/flat-table-cell.spec.tsx

This file was deleted.

Loading

0 comments on commit 25e5555

Please sign in to comment.