Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mxstbr committed Oct 23, 2016
1 parent 445f045 commit d5165c2
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/fixtures/simple/nesting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import styled from 'styled-components'

// Nesting
const Button = styled.button`
> h1 {
color: blue;
}
`

// Selectors
const Button2 = styled.button`
color: red;
&:hover {
color: blue;
}
`

// Complex selectors
const Button3 = styled.button`
color: red;
&:placeholder {
color: blue;
}
&::-webkit-input-placeholder {
color: blue;
}
`

const color = 'red'

// Selectors + interpolations
const Button4 = styled.button`
color: ${color};
background: ${color};
&:hover {
background-color: ${color};
}
`;
22 changes: 22 additions & 0 deletions test/simple.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,26 @@ describe('simple', () => {
})
})
})

describe('nesting', () => {
beforeAll(() => {
fixture = path.join(__dirname, './fixtures/simple/nesting.js')
})

it('should have one result', () => {
expect(data.results.length).toEqual(1)
})

it('should use the right file', () => {
expect(data.results[0].source).toEqual(fixture)
})

it('should not have errored', () => {
expect(data.errored).toEqual(false)
})

it('should not have any warnings', () => {
expect(data.results[0].warnings.length).toEqual(0)
})
})
})

0 comments on commit d5165c2

Please sign in to comment.