Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/tailwind/src/__snapshots__/tailwind.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,23 @@ exports[`Tailwind component > with non-inlinable styles > adds css to <head/> an
"
`;

exports[`Tailwind component > with non-inlinable styles > handles non-inlinable styles in custom utilities 1`] = `
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<!--$-->
<style>
.text-body{color:green!important;@media (width>=40rem){color:darkgreen!important}}
</style>
</head>
<body>
<div class="text-body"></div>
<!--/$-->
</body>
</html>
"
`;

exports[`Tailwind component > with non-inlinable styles > persists existing <head/> elements 1`] = `
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
Expand Down
28 changes: 28 additions & 0 deletions packages/tailwind/src/tailwind.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,34 @@ describe('Tailwind component', () => {
).toMatchSnapshot();
});

it('handles non-inlinable styles in custom utilities', async () => {
const actualOutput = await render(
<html lang="en">
<Tailwind
config={{
plugins: [
{
handler: (api) => {
api.addUtilities({
'.text-body': {
'@apply text-[green] sm:text-[darkgreen]': {},
},
});
},
},
],
}}
>
<head />
<body>
<div className="text-body" />
</body>
</Tailwind>
</html>,
).then(pretty);
expect(actualOutput).toMatchSnapshot();
});

it('adds css to <head/> and keep class names', async () => {
const actualOutput = await render(
<html lang="en">
Expand Down
Loading