tailwind-screens.test.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { run, html, css } from './util/run'
  2. test('class variants are inserted at `@tailwind variants`', async () => {
  3. let config = {
  4. content: [{ raw: html`<div class="font-bold hover:font-bold md:font-bold"></div>` }],
  5. }
  6. let input = css`
  7. @tailwind utilities;
  8. @tailwind variants;
  9. .foo {
  10. color: black;
  11. }
  12. `
  13. return run(input, config).then((result) => {
  14. expect(result.css).toMatchFormattedCss(css`
  15. .font-bold {
  16. font-weight: 700;
  17. }
  18. .hover\:font-bold:hover {
  19. font-weight: 700;
  20. }
  21. @media (min-width: 768px) {
  22. .md\:font-bold {
  23. font-weight: 700;
  24. }
  25. }
  26. .foo {
  27. color: black;
  28. }
  29. `)
  30. })
  31. })
  32. test('`@tailwind screens` works as an alias for `@tailwind variants`', async () => {
  33. let config = {
  34. content: [{ raw: html`<div class="font-bold hover:font-bold md:font-bold"></div>` }],
  35. }
  36. let input = css`
  37. @tailwind utilities;
  38. @tailwind screens;
  39. .foo {
  40. color: black;
  41. }
  42. `
  43. return run(input, config).then((result) => {
  44. expect(result.css).toMatchFormattedCss(css`
  45. .font-bold {
  46. font-weight: 700;
  47. }
  48. .hover\:font-bold:hover {
  49. font-weight: 700;
  50. }
  51. @media (min-width: 768px) {
  52. .md\:font-bold {
  53. font-weight: 700;
  54. }
  55. }
  56. .foo {
  57. color: black;
  58. }
  59. `)
  60. })
  61. })