wraps the FormFieldContainer, NativeSelectWrapper, and NativeSelect for proper styling alignment.
function AdditionalContentWrapper(props) {
if (
@@ -146,7 +194,10 @@ export const NativeSelect = React.forwardRef
(
(labelPosition === LabelPosition.top && !hasLabel)
) {
return (
-
+
{props.children}
);
@@ -154,56 +205,16 @@ export const NativeSelect = React.forwardRef(
return props.children;
}
- return (
-
-
- {labelText}
- {labelText && additionalContent}
- >
- ) : (
- labelText
- )
- }
- labelWidth={labelWidth}
- isInverse={isInverse}
- helperMessage={helperMessage}
- messageStyle={messageStyle}
- ref={ref}
- >
-
-
- {children}
-
-
-
-
- {(labelPosition === 'left' && additionalContent) ||
- (!labelText && additionalContent)}
-
- );
+ if (additionalContent) {
+ return (
+
+ {nativeSelect}
+ {(labelPosition === LabelPosition.left && additionalContent) ||
+ (!labelText && additionalContent)}
+
+ );
+ } else {
+ return nativeSelect;
+ }
}
);
diff --git a/packages/react-magma-dom/src/components/Table/TablePagination.test.js b/packages/react-magma-dom/src/components/Table/TablePagination.test.js
index 96359bf0e..17a92f556 100644
--- a/packages/react-magma-dom/src/components/Table/TablePagination.test.js
+++ b/packages/react-magma-dom/src/components/Table/TablePagination.test.js
@@ -77,11 +77,16 @@ describe('Table Pagination', () => {
);
const rowsSelect = getByTestId('rowPerPageSelect');
- fireEvent.change(rowsSelect, { target: { value: 20 }});
+ const appliedSelection = document.querySelector(
+ 'select[data-testid=rowPerPageSelect]'
+ );
+
+ fireEvent.change(rowsSelect, { target: { value: 20 } });
expect(handlePageChange).toHaveBeenCalledWith(expect.any(Object), 1);
expect(handleRowsPerPageChange).toHaveBeenCalledWith('20');
expect(getByText(/1-20/i)).toBeInTheDocument();
+ expect(appliedSelection).toHaveDisplayValue('20');
});
});
@@ -195,9 +200,7 @@ describe('Table Pagination', () => {
});
it('should hide rows per page component when no onRowsPerPageChanged function passed', () => {
- const { queryByText } = render(
-
- );
+ const { queryByText } = render();
expect(queryByText('Rows per page:')).not.toBeInTheDocument();
});