diff --git a/ui-admin/theme/src/theme-css-import.test.ts b/ui-admin/theme/src/theme-css-import.test.ts new file mode 100644 index 000000000..d235b676b --- /dev/null +++ b/ui-admin/theme/src/theme-css-import.test.ts @@ -0,0 +1,20 @@ +/* eslint-disable n/no-sync */ + +import assert from 'node:assert/strict' +import { readFileSync } from 'node:fs' +import { dirname } from 'node:path' +import { join } from 'node:path' +import { describe } from 'node:test' +import { it } from 'node:test' +import { fileURLToPath } from 'node:url' + +const currentDir = dirname(fileURLToPath(import.meta.url)) + +describe('admin theme css import', () => { + it('should reference published global css module', () => { + const source = readFileSync(join(currentDir, 'theme.css.ts'), 'utf-8') + + assert.match(source, /import ['"]\.\/global\.css\.js['"]/) + assert.doesNotMatch(source, /import ['"]\.\/global\.css['"]/) + }) +}) diff --git a/ui-admin/theme/src/theme.css.ts b/ui-admin/theme/src/theme.css.ts index 298294d89..8e6ea4970 100644 --- a/ui-admin/theme/src/theme.css.ts +++ b/ui-admin/theme/src/theme.css.ts @@ -1,4 +1,4 @@ -import './global.css' +import './global.css.js' import { createTheme } from '@vanilla-extract/css' import { createThemeContract } from '@vanilla-extract/css' diff --git a/ui-parts/theme/src/theme-css-import.test.ts b/ui-parts/theme/src/theme-css-import.test.ts new file mode 100644 index 000000000..eab93269a --- /dev/null +++ b/ui-parts/theme/src/theme-css-import.test.ts @@ -0,0 +1,20 @@ +/* eslint-disable n/no-sync */ + +import assert from 'node:assert/strict' +import { readFileSync } from 'node:fs' +import { dirname } from 'node:path' +import { join } from 'node:path' +import { describe } from 'node:test' +import { it } from 'node:test' +import { fileURLToPath } from 'node:url' + +const currentDir = dirname(fileURLToPath(import.meta.url)) + +describe('parts theme css import', () => { + it('should reference published global css module', () => { + const source = readFileSync(join(currentDir, 'theme.css.ts'), 'utf-8') + + assert.match(source, /import ['"]\.\/global\.css\.js['"]/) + assert.doesNotMatch(source, /import ['"]\.\/global\.css['"]/) + }) +}) diff --git a/ui-parts/theme/src/theme.css.ts b/ui-parts/theme/src/theme.css.ts index 177f65d56..ffaa6215e 100644 --- a/ui-parts/theme/src/theme.css.ts +++ b/ui-parts/theme/src/theme.css.ts @@ -1,4 +1,4 @@ -import './global.css' +import './global.css.js' import { createGlobalTheme } from '@vanilla-extract/css'