Skip to content

Commit

Permalink
bugfix for lineheight unit when pixel
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Aug 22, 2021
1 parent 6b4e626 commit b2b04fa
Show file tree
Hide file tree
Showing 9 changed files with 86,436 additions and 106 deletions.
Binary file added _resources/Plugin Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _resources/design-tokens-v5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _resources/promo-v5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,982 changes: 1,981 additions & 1 deletion dist/plugin.js

Large diffs are not rendered by default.

42,274 changes: 42,223 additions & 51 deletions dist/ui.html

Large diffs are not rendered by default.

42,274 changes: 42,223 additions & 51 deletions dist/ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/extractor/extractFonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const extractFonts: extractorInterface = (tokenNodes: TextStyle[], prefixArray:
lineHeight: {
// @ts-ignore
value: roundWithDecimals(node.lineHeight.value) || 'normal',
unit: node.lineHeight.unit.toLowerCase(),
unit: node.lineHeight.unit.toLowerCase() === 'pixels' ? 'pixel' : node.lineHeight.unit.toLowerCase(),
type: (Object.prototype.hasOwnProperty.call(node.lineHeight, 'value') ? 'number' : 'string') as PropertyType
},
paragraphIndent: {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/exportRawTokenArray.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@ describe('exportRawTokenArray', () => {
}
]
// @ts-ignore
expect(exportRawTokenArray('', defaultSettings)).toStrictEqual(output)
expect(exportRawTokenArray('', { ...defaultSettings, ...{ exclusionPrefix: '*' } })).toStrictEqual(output)
})
})
8 changes: 7 additions & 1 deletion tests/unit/filterByNameProperty.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import filterByNameProperty from '../../src/utilities/filterByNameProperty'

describe('getTokenStyles', () => {
test('exclude _ prefix', () => {
test('exclude _ . and * prefix', () => {
expect([
{
id: 'valid',
Expand All @@ -20,6 +20,12 @@ describe('getTokenStyles', () => {
type: 'PAINT',
name: '.invalid',
description: ''
},
{
id: 'invalid',
type: 'PAINT',
name: '*invalid',
description: ''
}
].filter(item => filterByNameProperty(item, ['*']))).toStrictEqual([
{
Expand Down

0 comments on commit b2b04fa

Please sign in to comment.