important-modifier-prefix.test.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { run, html, css, defaults } from './util/run'
  2. test('important modifier with prefix', () => {
  3. let config = {
  4. important: false,
  5. prefix: 'tw-',
  6. darkMode: 'class',
  7. content: [
  8. {
  9. raw: html`<!-- The string "!*" can cause problems if we don't handle it, let's include it -->
  10. <div class="!*"></div>
  11. <div class="!tw-container"></div>
  12. <div class="!tw-font-bold"></div>
  13. <div class="hover:!tw-text-center"></div>
  14. <div class="lg:!tw-opacity-50"></div>
  15. <div class="xl:focus:disabled:!tw-float-right"></div> `,
  16. },
  17. ],
  18. corePlugins: { preflight: false },
  19. }
  20. let input = css`
  21. @tailwind base;
  22. @tailwind components;
  23. @tailwind utilities;
  24. `
  25. return run(input, config).then((result) => {
  26. expect(result.css).toMatchFormattedCss(css`
  27. ${defaults}
  28. .\!tw-container {
  29. width: 100% !important;
  30. }
  31. @media (min-width: 640px) {
  32. .\!tw-container {
  33. max-width: 640px !important;
  34. }
  35. }
  36. @media (min-width: 768px) {
  37. .\!tw-container {
  38. max-width: 768px !important;
  39. }
  40. }
  41. @media (min-width: 1024px) {
  42. .\!tw-container {
  43. max-width: 1024px !important;
  44. }
  45. }
  46. @media (min-width: 1280px) {
  47. .\!tw-container {
  48. max-width: 1280px !important;
  49. }
  50. }
  51. @media (min-width: 1536px) {
  52. .\!tw-container {
  53. max-width: 1536px !important;
  54. }
  55. }
  56. .\!tw-font-bold {
  57. font-weight: 700 !important;
  58. }
  59. .hover\:\!tw-text-center:hover {
  60. text-align: center !important;
  61. }
  62. @media (min-width: 1024px) {
  63. .lg\:\!tw-opacity-50 {
  64. opacity: 0.5 !important;
  65. }
  66. }
  67. @media (min-width: 1280px) {
  68. .xl\:focus\:disabled\:\!tw-float-right:disabled:focus {
  69. float: right !important;
  70. }
  71. }
  72. `)
  73. })
  74. })