Skip to content

Commit 9bd03aa

Browse files
committed
Adds E2E tests for components "displayName"
1 parent a148f29 commit 9bd03aa

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

examples/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,13 @@ import IterativeAreas from './recipes/IterativeAreas'
118118
storiesOf('Recipes|All', module).add('Iterative areas', IterativeAreas)
119119

120120
/**
121-
* Bugfixes
121+
* Regression
122122
*/
123+
import DisplayNames from './regression/DisplayNames'
123124
import StylesUndefined from './regression/StylesUndefined'
124125
import SingleResponsiveProp from './regression/SingleResponsiveProp'
125126

126127
storiesOf('Regression|All', module)
128+
.add('Display names', DisplayNames)
127129
.add('Styles undefined', StylesUndefined)
128130
.add('Single responsive prop', SingleResponsiveProp)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from 'react'
2+
import { Box, Composition, Only, Visible, MediaQuery } from 'atomic-layout'
3+
4+
const DisplayNames = () => (
5+
<div>
6+
<Box id="box">{Box.displayName}</Box>
7+
<Composition
8+
id="composition"
9+
areas="one"
10+
data-display-name={Composition.displayName}
11+
>
12+
{(Areas) => (
13+
<Areas.One id="composition-area">{Areas.One.displayName}</Areas.One>
14+
)}
15+
</Composition>
16+
<Only id="only" from="xs">
17+
{Only.displayName}
18+
</Only>
19+
<Visible id="visible" from="xs">
20+
{Visible.displayName}
21+
</Visible>
22+
<MediaQuery matches={true}>
23+
{() => <p id="media-query">{MediaQuery.displayName}</p>}
24+
</MediaQuery>
25+
</div>
26+
)
27+
28+
export default DisplayNames
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
describe('Display names', () => {
2+
before(() => {
3+
cy.loadStory(['regression', 'all'], ['display-names'])
4+
})
5+
6+
it('Box should have a meaningful display name', () => {
7+
cy.get('#box').should('have.text', 'Box')
8+
})
9+
10+
it('Composition should have meaningful display name', () => {
11+
cy.get('#composition').should(
12+
'have.attr',
13+
'data-display-name',
14+
'Composition',
15+
)
16+
})
17+
18+
it('Composition areas should have meaningful display name', () => {
19+
cy.get('#composition-area').should('have.text', 'Area(One)')
20+
})
21+
22+
it('Only should have meaningful display name', () => {
23+
cy.get('#only').should('have.text', 'Only')
24+
})
25+
26+
it('Visible should have meaningful display name', () => {
27+
cy.get('#visible').should('have.text', 'Visible')
28+
})
29+
30+
it('MediaQuery should have meaningful display name', () => {
31+
cy.get('#media-query').should('have.text', 'MediaQuery')
32+
})
33+
})

0 commit comments

Comments
 (0)