combined-selectors.test.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import { run, html, css, defaults } from './util/run'
  2. it('should generate the partial selector, if only a partial is used (base layer)', () => {
  3. let config = {
  4. content: [{ raw: html`<div></div>` }],
  5. corePlugins: { preflight: false },
  6. }
  7. let input = css`
  8. @tailwind base;
  9. @layer base {
  10. :root {
  11. font-weight: bold;
  12. }
  13. /* --- */
  14. :root,
  15. .a {
  16. color: black;
  17. }
  18. }
  19. `
  20. return run(input, config).then((result) => {
  21. return expect(result.css).toMatchFormattedCss(css`
  22. :root {
  23. font-weight: bold;
  24. }
  25. :root,
  26. .a {
  27. color: #000;
  28. }
  29. ${defaults}
  30. `)
  31. })
  32. })
  33. it('should generate the partial selector, if only a partial is used (utilities layer)', () => {
  34. let config = {
  35. content: [{ raw: html`<div class="a"></div>` }],
  36. corePlugins: { preflight: false },
  37. }
  38. let input = css`
  39. @tailwind utilities;
  40. @layer utilities {
  41. :root {
  42. font-weight: bold;
  43. }
  44. /* --- */
  45. :root,
  46. .a {
  47. color: black;
  48. }
  49. }
  50. `
  51. return run(input, config).then((result) => {
  52. return expect(result.css).toMatchFormattedCss(css`
  53. :root {
  54. font-weight: bold;
  55. }
  56. :root,
  57. .a {
  58. color: #000;
  59. }
  60. `)
  61. })
  62. })