syntax-lit-html.test.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { run, css } from './util/run'
  2. test('it detects classes in lit-html templates', () => {
  3. let config = {
  4. content: [
  5. {
  6. raw: `html\`<button class="bg-blue-400 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded">\${data.title}</button>\`;`,
  7. },
  8. ],
  9. corePlugins: { preflight: false },
  10. theme: {},
  11. plugins: [],
  12. }
  13. return run('@tailwind utilities', config).then((result) => {
  14. expect(result.css).toMatchFormattedCss(css`
  15. .rounded {
  16. border-radius: 0.25rem;
  17. }
  18. .bg-blue-400 {
  19. --tw-bg-opacity: 1;
  20. background-color: rgb(96 165 250 / var(--tw-bg-opacity));
  21. }
  22. .px-4 {
  23. padding-left: 1rem;
  24. padding-right: 1rem;
  25. }
  26. .py-2 {
  27. padding-top: 0.5rem;
  28. padding-bottom: 0.5rem;
  29. }
  30. .font-bold {
  31. font-weight: 700;
  32. }
  33. .text-white {
  34. --tw-text-opacity: 1;
  35. color: rgb(255 255 255 / var(--tw-text-opacity));
  36. }
  37. .hover\:bg-blue-600:hover {
  38. --tw-bg-opacity: 1;
  39. background-color: rgb(37 99 235 / var(--tw-bg-opacity));
  40. }
  41. `)
  42. })
  43. })