combined-selectors.test.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. /* --- */
  26. :root,
  27. .a {
  28. color: black;
  29. }
  30. ${defaults}
  31. `)
  32. })
  33. })
  34. it('should generate the partial selector, if only a partial is used (utilities layer)', () => {
  35. let config = {
  36. content: [{ raw: html`<div class="a"></div>` }],
  37. corePlugins: { preflight: false },
  38. }
  39. let input = css`
  40. @tailwind utilities;
  41. @layer utilities {
  42. :root {
  43. font-weight: bold;
  44. }
  45. /* --- */
  46. :root,
  47. .a {
  48. color: black;
  49. }
  50. }
  51. `
  52. return run(input, config).then((result) => {
  53. return expect(result.css).toMatchFormattedCss(css`
  54. :root {
  55. font-weight: bold;
  56. }
  57. /* --- */
  58. :root,
  59. .a {
  60. color: black;
  61. }
  62. `)
  63. })
  64. })