diff --git a/src/lib/components/layout/Grid/Grid.jsx b/src/lib/components/layout/Grid/Grid.jsx index bff52c22..3ec15465 100644 --- a/src/lib/components/layout/Grid/Grid.jsx +++ b/src/lib/components/layout/Grid/Grid.jsx @@ -26,7 +26,7 @@ export const Grid = ({ id={id} className={styles.root} style={{ - '--rui-local-auto-flow': autoFlow, + ...(typeof autoFlow !== 'undefined' ? { '--rui-local-auto-flow': autoFlow } : {}), ...generateResponsiveCustomProperties(columns, 'columns'), ...generateResponsiveCustomProperties(columnGap, 'column-gap'), ...generateResponsiveCustomProperties(rows, 'rows'), @@ -65,7 +65,7 @@ Grid.propTypes = { * Content alignment. Accepts any valid value of `align-content` CSS property. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-content) for more. */ - alignContent: PropTypes.oneOf([ + alignContent: PropTypes.oneOfType([ PropTypes.string, PropTypes.shape({ xs: PropTypes.string, @@ -81,7 +81,7 @@ Grid.propTypes = { * Items alignment. Accepts any valid value of `align-items` CSS property. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) for more. */ - alignItems: PropTypes.oneOf([ + alignItems: PropTypes.oneOfType([ PropTypes.string, PropTypes.shape({ xs: PropTypes.string, @@ -106,7 +106,7 @@ Grid.propTypes = { * Gap between columns. Accepts any valid value of `grid-column-gap` CSS property. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap) for more. */ - columnGap: PropTypes.oneOf([ + columnGap: PropTypes.oneOfType([ PropTypes.string, PropTypes.shape({ xs: PropTypes.string, @@ -122,7 +122,7 @@ Grid.propTypes = { * Grid columns. Accepts any valid value of `grid-template-columns` CSS property. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns) for more. */ - columns: PropTypes.oneOf([ + columns: PropTypes.oneOfType([ PropTypes.string, PropTypes.shape({ xs: PropTypes.string, @@ -142,7 +142,7 @@ Grid.propTypes = { * Content justification. Accepts any valid value of `justify-content` CSS property. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) for more. */ - justifyContent: PropTypes.oneOf([ + justifyContent: PropTypes.oneOfType([ PropTypes.string, PropTypes.shape({ xs: PropTypes.string, @@ -158,7 +158,7 @@ Grid.propTypes = { * Items justification. Accepts any valid value of `justify-items` CSS property. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items) for more. */ - justifyItems: PropTypes.oneOf([ + justifyItems: PropTypes.oneOfType([ PropTypes.string, PropTypes.shape({ xs: PropTypes.string, @@ -174,7 +174,7 @@ Grid.propTypes = { * Gap between rows. Accepts any valid value of `grid-row-gap` CSS property. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap) for more. */ - rowGap: PropTypes.oneOf([ + rowGap: PropTypes.oneOfType([ PropTypes.string, PropTypes.shape({ xs: PropTypes.string, @@ -190,7 +190,7 @@ Grid.propTypes = { * Grid rows. Accepts any valid value of `grid-template-rows` CSS property. * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows) for more. */ - rows: PropTypes.oneOf([ + rows: PropTypes.oneOfType([ PropTypes.string, PropTypes.shape({ xs: PropTypes.string, diff --git a/src/lib/components/layout/Grid/GridSpan.jsx b/src/lib/components/layout/Grid/GridSpan.jsx index 022368a7..8ea13470 100644 --- a/src/lib/components/layout/Grid/GridSpan.jsx +++ b/src/lib/components/layout/Grid/GridSpan.jsx @@ -47,7 +47,7 @@ GridSpan.propTypes = { /** * Number of columns to span. */ - columns: PropTypes.oneOf([ + columns: PropTypes.oneOfType([ PropTypes.number, PropTypes.shape({ xs: PropTypes.number, @@ -66,7 +66,7 @@ GridSpan.propTypes = { /** * Number of rows to span. */ - rows: PropTypes.oneOf([ + rows: PropTypes.oneOfType([ PropTypes.number, PropTypes.shape({ xs: PropTypes.number, diff --git a/src/lib/components/layout/Grid/__tests__/Grid.test.jsx b/src/lib/components/layout/Grid/__tests__/Grid.test.jsx index c246e3b1..aff45275 100644 --- a/src/lib/components/layout/Grid/__tests__/Grid.test.jsx +++ b/src/lib/components/layout/Grid/__tests__/Grid.test.jsx @@ -32,4 +32,58 @@ describe('rendering', () => { expect(tree).toMatchSnapshot(); }); + + it('renders correctly with simple props', () => { + const tree = shallow(( + +
content
+
+ )); + + expect(tree).toMatchSnapshot(); + }); + + it('renders correctly with complex props', () => { + const tree = shallow(( + +
content
+
+ )); + + expect(tree).toMatchSnapshot(); + }); }); diff --git a/src/lib/components/layout/Grid/__tests__/GridSpan.test.jsx b/src/lib/components/layout/Grid/__tests__/GridSpan.test.jsx index 1d9ec1ab..79eb41d9 100644 --- a/src/lib/components/layout/Grid/__tests__/GridSpan.test.jsx +++ b/src/lib/components/layout/Grid/__tests__/GridSpan.test.jsx @@ -32,4 +32,38 @@ describe('rendering', () => { expect(tree).toMatchSnapshot(); }); + + it('renders correctly with simple props', () => { + const tree = shallow(( + +
content
+
+ )); + + expect(tree).toMatchSnapshot(); + }); + + it('renders correctly with complex props', () => { + const tree = shallow(( + +
content
+
+ )); + + expect(tree).toMatchSnapshot(); + }); }); diff --git a/src/lib/components/layout/Grid/__tests__/__snapshots__/Grid.test.jsx.snap b/src/lib/components/layout/Grid/__tests__/__snapshots__/Grid.test.jsx.snap index 31fe5bbb..3d633aa2 100644 --- a/src/lib/components/layout/Grid/__tests__/__snapshots__/Grid.test.jsx.snap +++ b/src/lib/components/layout/Grid/__tests__/__snapshots__/Grid.test.jsx.snap @@ -3,9 +3,33 @@ exports[`rendering renders correctly with a single child 1`] = `
+
+ content +
+
+`; + +exports[`rendering renders correctly with complex props 1`] = ` +
@@ -18,11 +42,7 @@ exports[`rendering renders correctly with a single child 1`] = ` exports[`rendering renders correctly with multiple children 1`] = `
content 1 @@ -37,3 +57,27 @@ exports[`rendering renders correctly with multiple children 1`] = ` `; exports[`rendering renders correctly with no children 1`] = `""`; + +exports[`rendering renders correctly with simple props 1`] = ` +
+
+ content +
+
+`; diff --git a/src/lib/components/layout/Grid/__tests__/__snapshots__/GridSpan.test.jsx.snap b/src/lib/components/layout/Grid/__tests__/__snapshots__/GridSpan.test.jsx.snap index f7ea3626..9988dfeb 100644 --- a/src/lib/components/layout/Grid/__tests__/__snapshots__/GridSpan.test.jsx.snap +++ b/src/lib/components/layout/Grid/__tests__/__snapshots__/GridSpan.test.jsx.snap @@ -11,6 +11,25 @@ exports[`rendering renders correctly with a single child 1`] = `
`; +exports[`rendering renders correctly with complex props 1`] = ` +
+
+ content +
+
+`; + exports[`rendering renders correctly with multiple children 1`] = `
+
+ content +
+
+`;