custom-separator.test.js 886 B

1234567891011121314151617181920212223242526272829303132
  1. import fs from 'fs'
  2. import path from 'path'
  3. import { run } from './util/run'
  4. test('custom separator', () => {
  5. let config = {
  6. darkMode: 'class',
  7. content: [path.resolve(__dirname, './custom-separator.test.html')],
  8. separator: '_',
  9. }
  10. return run('@tailwind utilities', config).then((result) => {
  11. let expectedPath = path.resolve(__dirname, './custom-separator.test.css')
  12. let expected = fs.readFileSync(expectedPath, 'utf8')
  13. expect(result.css).toMatchFormattedCss(expected)
  14. })
  15. })
  16. test('dash is not supported', () => {
  17. let config = {
  18. darkMode: 'class',
  19. content: [{ raw: 'lg-hover-font-bold' }],
  20. separator: '-',
  21. }
  22. return expect(run('@tailwind utilities', config)).rejects.toThrowError(
  23. "The '-' character cannot be used as a custom separator in JIT mode due to parsing ambiguity. Please use another character like '_' instead."
  24. )
  25. })