Skip to content

Commit

Permalink
Don't generate invalid CSS when given an array of property values (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace authored Dec 10, 2021
1 parent 4c5cb76 commit 61826fe
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
- Don't generate invalid CSS when given an array of property values ([#224](https://github.com/tailwindlabs/tailwindcss-typography/pull/224))

## [0.5.0] - 2021-12-09

Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ function configToCss(config = {}, { target, className, prefix }) {
return [k, v]
}

if (Array.isArray(v)) {
return [k, v]
}

if (isObject(v)) {
let nested = Object.values(v).some(isObject)
if (nested) {
Expand Down
28 changes: 28 additions & 0 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -803,3 +803,31 @@ test('element variants with custom class name', async () => {
`)
})
})

test.only("customizing defaults with multiple values does not result in invalid css", async () => {
let config = {
plugins: [typographyPlugin()],
content: [
{
raw: html`<div class="prose"></div>`,
},
],
theme: {
typography: {
DEFAULT: {
css: {
textAlign: ['-webkit-match-parent', 'match-parent'],
}
}
}
},
}
return run(config).then((result) => {
// TODO: Fix this test. It should list both properties but there's a bug in tailwind that's overriding them.
expect(result.css).toMatchFormattedCss(css`
.prose {
text-align: match-parent;
}
`)
})
})

1 comment on commit 61826fe

@vercel
Copy link

@vercel vercel bot commented on 61826fe Dec 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.