Skip to content

Commit

Permalink
Demonstrate/test nested grids
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codes committed Dec 3, 2018
1 parent 298d9c1 commit abc5b95
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
17 changes: 17 additions & 0 deletions components/grid/docs/Grid.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ Using a 12-column grid layout, the `Grid` provides both visual consistency betwe
</Grid>
</Playground>

## Nesting Grids

<Playground>
<Grid data-test="outer-grid">
<GridItem xs={2}>x2</GridItem>
<GridItem xs={4}>x4</GridItem>
<GridItem xs={6}>
<Grid data-test="nested-grid">
<GridItem xs={2} data-test="x2">x2</GridItem>
<GridItem xs={4} data-test="x4">x4</GridItem>
<GridItem xs={6} data-test="x6">x6</GridItem>
</Grid>
</GridItem>
</Grid>

</Playground>

## Grid API

<PropsTable of={Grid} />
Expand Down
13 changes: 13 additions & 0 deletions cypress/integration/components/Grid.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,17 @@ context('@andrew-codes/grid', () => {
'column-reverse',
);
});

it('grids can be nested', () => {
cy.get('[data-test="nested-grid"]').as('nestedGrid');
cy.get('@nestedGrid')
.find('[data-test="x2"]')
.should('have.css', 'width', '63px');
cy.get('@nestedGrid')
.find('[data-test="x4"]')
.should('have.css', 'width', '126px');
cy.get('@nestedGrid')
.find('[data-test="x6"]')
.should('have.css', 'width', '190px');
});
});

0 comments on commit abc5b95

Please sign in to comment.