From 561cad1411e8c3adb3369d9ce72105b53df26fad Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Tue, 11 May 2021 13:35:42 -0400 Subject: [PATCH] Add test for nested theme calls --- tests/themeFunction.test.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/themeFunction.test.js b/tests/themeFunction.test.js index f2027ae8e26b..ae4eea4619be 100644 --- a/tests/themeFunction.test.js +++ b/tests/themeFunction.test.js @@ -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"); }