Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
smason0 committed Oct 10, 2023
1 parent 7dc21fe commit aef2559
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/terra-data-grid/tests/jest/Cell.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,31 @@ describe('Cell', () => {
expect(wrapper).toMatchSnapshot();
});

it('verifies that the cell rendered is marked blank when the cell content is empty and isRowHeader is true', () => {
const wrapper = shallowWithIntl(
<IntlProvider locale="en">
<Cell
rowId="RowID"
columnId="ColumnId"
rowIndex={1}
columnIndex={2}
key="key"
onCellSelect={jest.fn}
hasNoResult
isRowHeader
/>
</IntlProvider>,
).dive().dive();

const blankCell = wrapper.find('th.blank');
expect(blankCell).toHaveLength(1);

const cellContent = blankCell.find('div');
expect(cellContent.text()).toBe('Terra.dataGrid.blank');

expect(wrapper).toMatchSnapshot();
});

it('verifies that a selected cell has the correct styles when isSelected prop is true', () => {
const wrapper = shallowWithIntl(
<IntlProvider locale="en">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,52 @@ exports[`Cell verifies that the cell rendered is marked blank when the cell cont
</td>
`;
exports[`Cell verifies that the cell rendered is marked blank when the cell content is empty and isRowHeader is true 1`] = `
<th
aria-selected={false}
className="cell selectable blank"
onKeyDown={[Function]}
onMouseDown={[Function]}
role="rowheader"
scope="row"
style={
Object {
"left": null,
}
}
tabIndex={-1}
>
<FocusTrap
_createFocusTrap={[Function]}
active={false}
focusTrapOptions={
Object {
"clickOutsideDeactivates": true,
"escapeDeactivates": false,
"onDeactivate": [Function],
"returnFocusOnDeactivate": true,
}
}
paused={false}
>
<div
className="cell-content"
style={
Object {
"height": undefined,
}
}
>
<span
className="no-data-cell"
>
Terra.dataGrid.blank
</span>
</div>
</FocusTrap>
</th>
`;
exports[`Cell verifies that the cell rendered is marked selectable when isSelectable prop is true 1`] = `
<td
aria-selected={false}
Expand Down

0 comments on commit aef2559

Please sign in to comment.