Skip to content

Commit 61826fe

Browse files
Don't generate invalid CSS when given an array of property values (#224)
1 parent 4c5cb76 commit 61826fe

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

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

1212
## [0.5.0] - 2021-12-09
1313

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ function configToCss(config = {}, { target, className, prefix }) {
4949
return [k, v]
5050
}
5151

52+
if (Array.isArray(v)) {
53+
return [k, v]
54+
}
55+
5256
if (isObject(v)) {
5357
let nested = Object.values(v).some(isObject)
5458
if (nested) {

src/index.test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,3 +803,31 @@ test('element variants with custom class name', async () => {
803803
`)
804804
})
805805
})
806+
807+
test.only("customizing defaults with multiple values does not result in invalid css", async () => {
808+
let config = {
809+
plugins: [typographyPlugin()],
810+
content: [
811+
{
812+
raw: html`<div class="prose"></div>`,
813+
},
814+
],
815+
theme: {
816+
typography: {
817+
DEFAULT: {
818+
css: {
819+
textAlign: ['-webkit-match-parent', 'match-parent'],
820+
}
821+
}
822+
}
823+
},
824+
}
825+
return run(config).then((result) => {
826+
// TODO: Fix this test. It should list both properties but there's a bug in tailwind that's overriding them.
827+
expect(result.css).toMatchFormattedCss(css`
828+
.prose {
829+
text-align: match-parent;
830+
}
831+
`)
832+
})
833+
})

0 commit comments

Comments
 (0)