Skip to content

Commit d84c114

Browse files
committed
Merge branch 'FW-6747' into FW-6747-screenshots
2 parents 33f4a05 + 050b9d0 commit d84c114

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

core/src/themes/base/default.tokens.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export const defaultTheme: DefaultTheme = {
8787
},
8888

8989
borderWidth: {
90+
0: '0',
9091
25: '1px',
9192
50: '2px',
9293
75: '3px',

core/src/utils/test/theme.spec.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -233,20 +233,24 @@ describe('generateCSSVars', () => {
233233
components: {},
234234
};
235235

236-
const css = generateCSSVars(theme);
236+
const css = generateCSSVars(theme).replace(/\s/g, '');
237237

238-
expect(css).toContain('--ion-border-width-sm: 4px;');
239-
expect(css).toContain('--ion-spacing-md: 12px;');
240-
expect(css).toContain('--ion-scaling-0: 0;');
241-
expect(css).toContain('--ion-radii-lg: 8px;');
242-
expect(css).toContain('--ion-dynamic-font: -apple-system-body;');
243-
expect(css).toContain('--ion-font-family: Roboto, "Helvetica Neue", sans-serif;');
244-
expect(css).toContain('--ion-font-weights-semi-bold: 600;');
245-
expect(css).toContain('--ion-font-sizes-sm: 14px;');
246-
expect(css).toContain('--ion-font-sizes-sm-rem: 0.875rem;');
247-
expect(css).toContain('--ion-font-sizes-md: 16px;');
248-
expect(css).toContain('--ion-font-sizes-md-rem: 1rem;');
249-
expect(css).toContain('--ion-line-heights-sm: 1.2;');
238+
const expectedCSS = `
239+
--ion-border-width-sm: 4px;
240+
--ion-spacing-md: 12px;
241+
--ion-scaling-0: 0;
242+
--ion-radii-lg: 8px;
243+
--ion-dynamic-font: -apple-system-body;
244+
--ion-font-family: Roboto, "Helvetica Neue", sans-serif;
245+
--ion-font-weights-semi-bold: 600;
246+
--ion-font-sizes-sm: 14px;
247+
--ion-font-sizes-sm-rem: 0.875rem;
248+
--ion-font-sizes-md: 16px;
249+
--ion-font-sizes-md-rem: 1rem;
250+
--ion-line-heights-sm: 1.2;
251+
`.replace(/\s/g, '');
252+
253+
expect(css).toBe(expectedCSS);
250254
});
251255
});
252256

core/src/utils/theme.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@ export const generateCSSVars = (theme: any, prefix: string = CSS_PROPS_PREFIX):
8181
return [];
8282
}
8383

84+
// if key is camelCase, convert to kebab-case
85+
if (key.match(/([a-z])([A-Z])/g)) {
86+
key = key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
87+
}
88+
8489
// Do not generate CSS variables for excluded keys
8590
const excludedKeys = ['enabled', 'ripple-effect', 'form-highlight'];
8691
if (excludedKeys.includes(key)) {
8792
return [];
8893
}
8994

90-
// if key is camelCase, convert to kebab-case
91-
if (key.match(/([a-z])([A-Z])/g)) {
92-
key = key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
93-
}
94-
9595
// Special handling for 'base' property - don't add suffix
9696
if (key === 'base') {
9797
return [`${prefix.slice(0, -1)}: ${val};`];

0 commit comments

Comments
 (0)