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

Commit

Permalink
Merge remote-tracking branch 'origin' into UXPLATFORM-9913
Browse files Browse the repository at this point in the history
  • Loading branch information
cm9361 committed Dec 4, 2023
2 parents 3aed2f2 + e383086 commit 8cffbf0
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 60 deletions.
3 changes: 3 additions & 0 deletions packages/terra-data-grid/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Removed console warning message when no pinned columns exist.

## 1.5.0 - (December 1, 2023)

* Changed
Expand Down
7 changes: 0 additions & 7 deletions packages/terra-data-grid/src/utils/constants.js

This file was deleted.

44 changes: 1 addition & 43 deletions packages/terra-data-grid/tests/jest/DataGrid.test.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react';
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { mountWithIntl, shallowWithIntl } from 'terra-enzyme-intl';
import { mountWithIntl } from 'terra-enzyme-intl';
import { v4 as uuidv4 } from 'uuid';
import DataGrid from '../../src/DataGrid';
import ERRORS from '../../src/utils/constants';

// Source data for tests
const dataFile = {
Expand Down Expand Up @@ -244,46 +243,5 @@ describe('with pinned columns', () => {
const pinnedColumnHeaderCells = wrapper.find('.pinned');

expect(pinnedColumnHeaderCells).toHaveLength(1 * (dataFile.rows.length + 1));
expect(console.warn).toHaveBeenCalledWith(expect.stringContaining(ERRORS.PINNED_COLUMNS_UNDEFINED)); // eslint-disable-line no-console
});
});

describe('Error handling - prop types', () => {
it('throws an error if rowHeaderIndex is not an integer', () => {
shallowWithIntl(
<DataGrid
id="test-terra-data-grid"
rows={dataFile.rows}
rowHeaderIndex="2"
/>,
);

expect(console.error).toHaveBeenCalledWith(expect.stringContaining(ERRORS.ROW_HEADER_INDEX_NOT_AN_INTEGER)); // eslint-disable-line no-console
});

it('throws an error if rowHeaderIndex is not a positive integer', () => {
shallowWithIntl(
<DataGrid
id="test-terra-data-grid"
rows={dataFile.rows}
rowHeaderIndex={-1}
/>,
);

expect(console.error).toHaveBeenCalledWith(expect.stringContaining(ERRORS.ROW_HEADER_INDEX_LESS_THAN_ZERO)); // eslint-disable-line no-console
});

it('throws an error if rowHeaderIndex is greater than the length of pinned columns', () => {
shallowWithIntl(
<DataGrid
id="test-terra-data-grid"
pinnedColumns={dataFile.cols.slice(0, 2)}
overflowColumns={dataFile.cols.slice(2)}
rowHeaderIndex={2}
rows={dataFile.rows}
/>,
);

expect(console.error).toHaveBeenCalledWith(expect.stringContaining(ERRORS.ROW_HEADER_INDEX_EXCEEDS_PINNED)); // eslint-disable-line no-console
});
});
3 changes: 3 additions & 0 deletions packages/terra-table/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

* Added
* Exported the row selection column width via the `TableConstants.ROW_SELECTION_COLUMN_WIDTH`` constant.

* Changed
* Removed console warning message when no pinned columns exist.

## 5.2.1 - (December 1, 2023)

Expand Down
6 changes: 0 additions & 6 deletions packages/terra-table/src/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Section from './subcomponents/Section';
import ColumnHeader from './subcomponents/ColumnHeader';
import ColumnContext from './utils/ColumnContext';
import columnShape from './proptypes/columnShape';
import ERRORS from './utils/constants';
import GridContext, { GridConstants } from './utils/GridContext';
import rowShape from './proptypes/rowShape';
import validateRowHeaderIndex from './proptypes/validators';
Expand Down Expand Up @@ -212,11 +211,6 @@ function Table(props) {
intl,
} = props;

if (pinnedColumns.length === 0) {
// eslint-disable-next-line no-console
console.warn(ERRORS.PINNED_COLUMNS_UNDEFINED);
}

// Manage column resize
const [tableHeight, setTableHeight] = useState(0);
const [activeIndex, setActiveIndex] = useState(null);
Expand Down
4 changes: 2 additions & 2 deletions packages/terra-table/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Table, { TableConstants } from './Table';
import Table, { TableConstants, RowSelectionModes } from './Table';
import GridContext, { GridConstants } from './utils/GridContext';
import cellShape from './proptypes/cellShape';
import columnShape from './proptypes/columnShape';
Expand All @@ -8,5 +8,5 @@ import validateRowHeaderIndex from './proptypes/validators';

export default Table;
export {
GridContext, GridConstants, TableConstants, cellShape, columnShape, rowShape, sectionShape, validateRowHeaderIndex,
GridContext, GridConstants, TableConstants, RowSelectionModes, cellShape, columnShape, rowShape, sectionShape, validateRowHeaderIndex,
};
1 change: 0 additions & 1 deletion packages/terra-table/src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const ERRORS = {
ROW_HEADER_INDEX_EXCEEDS_PINNED: 'Prop rowHeaderIndex exceeds the size of pinnedColumns.',
ROW_HEADER_INDEX_LESS_THAN_ZERO: 'Prop rowHeaderIndex must be a positive integer.',
ROW_HEADER_INDEX_NOT_AN_INTEGER: 'Prop rowHeaderIndex must be an integer.',
PINNED_COLUMNS_UNDEFINED: 'To be properly accessible, the row header column should be a pinned column. please set pinned columns',
};

export default ERRORS;
1 change: 0 additions & 1 deletion packages/terra-table/tests/jest/Table.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ describe('with pinned columns', () => {
const pinnedColumnHeaderCells = wrapper.find('.pinned');

expect(pinnedColumnHeaderCells).toHaveLength(1 * (tableData.rows.length + 1));
expect(console.warn).toHaveBeenCalledWith(expect.stringContaining(ERRORS.PINNED_COLUMNS_UNDEFINED)); // eslint-disable-line no-console
});
});

Expand Down

0 comments on commit 8cffbf0

Please sign in to comment.