space-utilities.test.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { run, html, css, defaults } from './util/run'
  2. test('space-x uses non-logical properties', () => {
  3. let config = {
  4. future: {
  5. logicalSiblingUtilities: false,
  6. },
  7. content: [{ raw: html`<div class="space-x-4"></div>` }],
  8. corePlugins: { preflight: false },
  9. }
  10. return run('@tailwind base; @tailwind utilities;', config).then((result) => {
  11. expect(result.css).toMatchFormattedCss(css`
  12. ${defaults}
  13. .space-x-4 > :not([hidden]) ~ :not([hidden]) {
  14. --tw-space-x-reverse: 0;
  15. margin-right: calc(1rem * var(--tw-space-x-reverse));
  16. margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse)));
  17. }
  18. `)
  19. })
  20. })
  21. test('space-x uses logical properties', () => {
  22. let config = {
  23. future: {
  24. logicalSiblingUtilities: true,
  25. },
  26. content: [{ raw: html`<div class="space-x-4"></div>` }],
  27. corePlugins: { preflight: false },
  28. }
  29. return run('@tailwind base; @tailwind utilities;', config).then((result) => {
  30. expect(result.css).toMatchFormattedCss(css`
  31. ${defaults}
  32. .space-x-4 > :not([hidden]) ~ :not([hidden]) {
  33. --tw-space-x-reverse: 0;
  34. margin-inline-start: calc(1rem * calc(1 - var(--tw-space-x-reverse)));
  35. margin-inline-end: calc(1rem * var(--tw-space-x-reverse));
  36. }
  37. `)
  38. })
  39. })