responsive-and-variants-atrules.test.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import fs from 'fs'
  2. import path from 'path'
  3. import { run, css } from './util/run'
  4. test('responsive and variants atrules', () => {
  5. let config = {
  6. content: [path.resolve(__dirname, './responsive-and-variants-atrules.test.html')],
  7. corePlugins: { preflight: false },
  8. }
  9. let input = css`
  10. @tailwind components;
  11. @tailwind utilities;
  12. @layer utilities {
  13. @responsive {
  14. .responsive-in-utilities {
  15. color: blue;
  16. }
  17. }
  18. @variants {
  19. .variants-in-utilities {
  20. color: red;
  21. }
  22. }
  23. @responsive {
  24. @variants {
  25. .both-in-utilities {
  26. color: green;
  27. }
  28. }
  29. }
  30. }
  31. @responsive {
  32. .responsive-at-root {
  33. color: white;
  34. }
  35. }
  36. @variants {
  37. .variants-at-root {
  38. color: orange;
  39. }
  40. }
  41. @responsive {
  42. @variants {
  43. .both-at-root {
  44. color: pink;
  45. }
  46. }
  47. }
  48. @layer components {
  49. @responsive {
  50. .responsive-in-components {
  51. color: blue;
  52. }
  53. }
  54. @variants {
  55. .variants-in-components {
  56. color: red;
  57. }
  58. }
  59. @responsive {
  60. @variants {
  61. .both-in-components {
  62. color: green;
  63. }
  64. }
  65. }
  66. }
  67. `
  68. return run(input, config).then((result) => {
  69. let expectedPath = path.resolve(__dirname, './responsive-and-variants-atrules.test.css')
  70. let expected = fs.readFileSync(expectedPath, 'utf8')
  71. expect(result.css).toMatchFormattedCss(expected)
  72. })
  73. })