diff --git a/core/__tests__/Cartesian.js b/core/__tests__/Cartesian.js
index 6beae216..2e101fa3 100644
--- a/core/__tests__/Cartesian.js
+++ b/core/__tests__/Cartesian.js
@@ -1,25 +1,45 @@
-import React from 'react'
-import styled from 'styled-components'
-import { render } from 'react-testing-library'
-import { color, space, fontSize } from 'styled-system'
+import React from 'react';
+import styled from 'styled-components';
+import { render } from 'react-testing-library';
+import { color, space, fontSize } from 'styled-system';
-import { Cartesian } from '../src'
+import { Cartesian } from '../src';
const buttonProps = {
children: 'Hello, world!',
fontSize: [1, 2, 3],
px: [2, 3],
- backgroundColor: ['pink', 'tomato', 'purple']
-}
+ backgroundColor: ['pink', 'tomato', 'purple'],
+};
const Button = styled.a`
${color}
${fontSize}
${space}
-`
+`;
+
+const Container = styled.div`
+ padding: 1rem;
+`;
test('Cartesian renders all examples', () => {
- const { container } = render()
+ const { container } = render(
+ ,
+ );
+
+ expect(container).toMatchSnapshot();
+});
+
+test('Cartesian renders all examples in a container', () => {
+ const { getByTestId, container } = render(
+ }
+ />,
+ );
- expect(container).toMatchSnapshot()
-})
+ const containerNode = getByTestId('container');
+ expect(containerNode.nodeName).toBe('DIV');
+ expect(container).toMatchSnapshot();
+});
diff --git a/core/__tests__/__snapshots__/Cartesian.js.snap b/core/__tests__/__snapshots__/Cartesian.js.snap
index d95e704e..47e05a1a 100644
--- a/core/__tests__/__snapshots__/Cartesian.js.snap
+++ b/core/__tests__/__snapshots__/Cartesian.js.snap
@@ -112,3 +112,80 @@ exports[`Cartesian renders all examples 1`] = `
`;
+
+exports[`Cartesian renders all examples in a container 1`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
diff --git a/core/src/Cartesian.js b/core/src/Cartesian.js
index fdfa9e14..d4e68bb0 100644
--- a/core/src/Cartesian.js
+++ b/core/src/Cartesian.js
@@ -1,13 +1,18 @@
import React, { Fragment } from 'react'
import { cartesianProduct } from './util'
-export default ({ component, ...props }) => {
+export default ({ component, container = Fragment, ...props }) => {
const combinations = cartesianProduct(props)
const Component = component
-
+ const Container = container
+
return (
- {combinations.map((props, i) => )}
+ {combinations.map((props, i) => (
+
+
+
+ ))}
)
}