forked from vercel/satori
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: should respect stringify number for line-height (vercel#543)
Close vercel#535 Co-authored-by: Shu Ding <g@shud.in>
- Loading branch information
1 parent
cde7d7b
commit 23199e1
Showing
4 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+2.9 KB
...test-tsx-test-line-height-test-tsx-line-height-should-work-correctly-1-snap.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
BIN
+2.9 KB
...test-tsx-test-line-height-test-tsx-line-height-should-work-correctly-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { it, describe, expect } from 'vitest' | ||
|
||
import { initFonts, toImage } from './utils.js' | ||
import satori from '../src/index.js' | ||
|
||
describe('line-height', () => { | ||
let fonts | ||
initFonts((f) => (fonts = f)) | ||
it('should work correctly', async () => { | ||
const svgs = await Promise.all( | ||
[1, '1'].map((lineHeight) => | ||
satori( | ||
<div | ||
style={{ | ||
margin: 0, | ||
padding: 0, | ||
fontSize: '30px', | ||
width: '100px', | ||
height: '100px', | ||
background: 'white', | ||
lineHeight, | ||
}} | ||
> | ||
Hello I am some text that is here. | ||
</div>, | ||
{ width: 100, height: 100, fonts, embedFont: true } | ||
) | ||
) | ||
) | ||
|
||
svgs.forEach((svg) => { | ||
expect(toImage(svg, 100)).toMatchImageSnapshot() | ||
}) | ||
}) | ||
}) |