Skip to content

Commit

Permalink
Add test for nested theme calls
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwathan committed May 11, 2021
1 parent d435f02 commit 561cad1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/themeFunction.test.js
Expand Up @@ -68,6 +68,27 @@ test('a default value can be provided', () => {
})
})

test('the default value can use the theme function', () => {
const input = `
.cookieMonster { color: theme('colors.blue', theme('colors.yellow')); }
`

const output = `
.cookieMonster { color: #f7cc50; }
`

return run(input, {
theme: {
colors: {
yellow: '#f7cc50',
},
},
}).then((result) => {
expect(result.css).toEqual(output)
expect(result.warnings().length).toBe(0)
})
})

test('quotes are preserved around default values', () => {
const input = `
.heading { font-family: theme('fontFamily.sans', "Helvetica Neue"); }
Expand Down

0 comments on commit 561cad1

Please sign in to comment.