Skip to content

Commit 779e1d0

Browse files
authored
fix: allow for fontSize overrides (#9248)
1 parent 69864fb commit 779e1d0

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

packages/@react-spectrum/s2/style/__tests__/style-macro.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,23 @@ describe('style-macro', () => {
173173
expect(js({}, overrides)).toMatchInlineSnapshot('" Tm12 Qm12 Sm12 Rm12"');
174174
});
175175

176+
it('should support allowed overrides for fontSize', () => {
177+
let {js} = testStyle(
178+
{
179+
fontSize: 'heading-3xl'
180+
},
181+
['fontSize']
182+
);
183+
184+
let {js: overrides} = testStyle({
185+
fontSize: 'ui-xs'
186+
});
187+
188+
expect(js()).toMatchInlineSnapshot('" -_6BNtrc-woabcc12 vx12"');
189+
expect(overrides).toMatchInlineSnapshot('" -_6BNtrc-a12 vx12"');
190+
expect(js({}, overrides)).toMatchInlineSnapshot('" -_6BNtrc-a12 vx12"');
191+
});
192+
176193
it("should support allowed overrides for values that aren't defined", () => {
177194
let {js} = testStyle(
178195
{

packages/@react-spectrum/s2/style/spectrum-theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ export const style = createTheme({
757757
},
758758
code: 'source-code-pro, "Source Code Pro", Monaco, monospace'
759759
},
760-
fontSize: new ExpandedProperty<keyof typeof fontSize>(['fontSize', 'lineHeight'], (value) => {
760+
fontSize: new ExpandedProperty<keyof typeof fontSize>(['--fs', 'fontSize'], (value) => {
761761
if (typeof value === 'number') {
762762
return {
763763
'--fs': `pow(1.125, ${value})`,

0 commit comments

Comments
 (0)