Skip to content

Commit

Permalink
Merge pull request #2813 from openedx/master
Browse files Browse the repository at this point in the history
sync: master to alpha
  • Loading branch information
edx-requirements-bot authored Nov 15, 2023
2 parents 042e5b4 + 84f7b9b commit 2b67057
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/DataTable/ExpandRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import IconButton from '../IconButton';

const EXPAND_COLLAPSE_ICON_SIZE = 'inline';

function ExpandRow({ row, ...rest }) {
function ExpandRow({ row }) {
return (
<span {...row.getToggleRowExpandedProps()} {...rest}>
<span {...row.getToggleRowExpandedProps()}>
{row.isExpanded
? <IconButton src={ExpandLess} iconAs={Icon} alt="Collapse row" size={EXPAND_COLLAPSE_ICON_SIZE} />
: <IconButton src={ExpandMore} iconAs={Icon} alt="Expand row" size={EXPAND_COLLAPSE_ICON_SIZE} />}
Expand Down
3 changes: 1 addition & 2 deletions src/DataTable/selection/ControlledSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
addSelectedRowAction,
} from './data/actions';

function ControlledSelect({ row, ...rest }) {
function ControlledSelect({ row }) {
const {
itemCount,
controlledTableSelections: [, dispatch],
Expand All @@ -34,7 +34,6 @@ function ControlledSelect({ row, ...rest }) {
<CheckboxControl
{...updatedProps}
onChange={toggleSelected}
{...rest}
/>
</div>
);
Expand Down
3 changes: 1 addition & 2 deletions src/DataTable/selection/ControlledSelectHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
setSelectedRowsAction,
} from './data/actions';

function ControlledSelectHeader({ rows, ...rest }) {
function ControlledSelectHeader({ rows }) {
const {
itemCount,
controlledTableSelections: [, dispatch],
Expand Down Expand Up @@ -44,7 +44,6 @@ function ControlledSelectHeader({ rows, ...rest }) {
<CheckboxControl
{...toggleAllPageRowsSelectedProps}
onChange={toggleAllPageRowsSelected}
{...rest}
/>
</div>
);
Expand Down
3 changes: 1 addition & 2 deletions src/DataTable/selection/ControlledSelectionStatus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
getRowIds,
} from './data/helpers';

function ControlledSelectionStatus({ className, clearSelectionText, ...rest }) {
function ControlledSelectionStatus({ className, clearSelectionText }) {
const {
itemCount,
page,
Expand Down Expand Up @@ -44,7 +44,6 @@ function ControlledSelectionStatus({ className, clearSelectionText, ...rest }) {
clearSelectionText,
onSelectAll: () => dispatch(setSelectAllRowsAllPagesAction()),
onClear: () => dispatch(clearSelectionAction()),
...rest,
};
return <BaseSelectionStatus {...selectionStatusProps} />;
}
Expand Down
10 changes: 2 additions & 8 deletions src/DataTable/tests/ExpandRow.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,15 @@ const row = {

describe('<ExpandRow />', () => {
it('renders expand row element if rows is not expanded', () => {
const { getByTestId, getByLabelText } = render(<ExpandRow row={row} data-testid="span-expand-row" />);

const labelWrapper = getByTestId('span-expand-row');
expect(labelWrapper).toBeInTheDocument();
const { getByLabelText } = render(<ExpandRow row={row} />);

const iconButton = getByLabelText('Expand row');
expect(iconButton).toBeInTheDocument();
});

it('renders collapse row element if row is expanded', () => {
const expandedRow = { ...row, isExpanded: true };
const { getByTestId, getByLabelText } = render(<ExpandRow row={expandedRow} data-testid="span-collapse-row" />);

const labelWrapper = getByTestId('span-collapse-row');
expect(labelWrapper).toBeInTheDocument();
const { getByLabelText } = render(<ExpandRow row={expandedRow} />);

const iconButton = getByLabelText('Collapse row');
expect(iconButton).toBeInTheDocument();
Expand Down

0 comments on commit 2b67057

Please sign in to comment.