From 4db044113d5219a426d69c00a80b68319c457fc7 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 1 Sep 2021 18:04:00 +0200 Subject: [PATCH] throw an error when applying the .group utility (aot mode) --- src/util/resolveConfig.js | 5 ++--- tests/jit/apply.test.js | 8 ++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/util/resolveConfig.js b/src/util/resolveConfig.js index 17265125d5e4..ffb94d1a013c 100644 --- a/src/util/resolveConfig.js +++ b/src/util/resolveConfig.js @@ -261,7 +261,6 @@ export default function resolveConfig(configs) { let allConfigs = [ ...extractPluginConfigs(configs), { - content: [], prefix: '', important: false, separator: ':', @@ -302,10 +301,10 @@ function normalizeConfig(config) { content: (() => { let { content, purge } = config - if (Array.isArray(content)) return content - if (Array.isArray(content?.content)) return content.content if (Array.isArray(purge)) return purge if (Array.isArray(purge?.content)) return purge.content + if (Array.isArray(content)) return content + if (Array.isArray(content?.content)) return content.content return [] })(), diff --git a/tests/jit/apply.test.js b/tests/jit/apply.test.js index cfdafe0f870f..e53b3699433b 100644 --- a/tests/jit/apply.test.js +++ b/tests/jit/apply.test.js @@ -11,6 +11,10 @@ function run(input, config = {}) { }) } +function css(templates) { + return templates.join('') +} + test('@apply', () => { let config = { darkMode: 'class', @@ -232,7 +236,7 @@ test('@apply error when using .group utility', async () => { plugins: [], } - let css = ` + let input = css` @tailwind components; @tailwind utilities; @@ -243,7 +247,7 @@ test('@apply error when using .group utility', async () => { } ` - await expect(run(css, config)).rejects.toThrowError( + await expect(run(input, config)).rejects.toThrowError( `@apply should not be used with the 'group' utility` ) })