Skip to content

Commit

Permalink
test: add tailwind escape test (withastro#2816)
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored Mar 17, 2022
1 parent 4cfbd40 commit 915ab92
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div id="complex" class="w-10/12 2xl:w-[80%]"></div>
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
// Component Imports
import Button from '../components/Button.astro';
import Complex from '../components/Complex.astro';
import "../styles/global.css";
// Full Astro Component Syntax:
Expand All @@ -16,5 +18,6 @@ import "../styles/global.css";

<body>
<Button>I’m a Tailwind Button!</Button>
<Complex />
</body>
</html>
7 changes: 7 additions & 0 deletions packages/astro/test/tailwindcss.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ describe('Tailwind', () => {
expect(button.hasClass('lg:py-3'), 'responsive class').to.be.true;
expect(button.hasClass('font-[900]', 'arbitrary value')).to.be.true;
});

it('handles complex classes in HTML', async () => {
const button = $('#complex');

expect(button.hasClass('w-10/12'), 'solidus').to.be.true;
expect(button.hasClass('2xl:w-[80%]'), 'complex class').to.be.true;
});
});

// with "build" handling CSS checking, the dev tests are mostly testing the paths resolve in dev
Expand Down

0 comments on commit 915ab92

Please sign in to comment.