fix: getDefaultLineHeight should return default font family line height for unknown font (#6399)
* fix(getDefaultLineHeight): make getDefaultLineHeight always has a default value * test: add getDefaultLineHeight test case when using unknown font * test: add getDefaultLineHeight test case when using unknown font * Revert "test: add getDefaultLineHeight test case when using unknown font" This reverts commit d41da5493b6edab9e599a13a23c387d38345bf03. * test: add getDefaultLineHeight test case when using unknown font * newline * newline * tweaks * trigger action * trigger action * fix --------- Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
parent
f8e65bb77e
commit
d2b8f4d2f8
@ -332,6 +332,12 @@ describe("Test getDefaultLineHeight", () => {
|
||||
//@ts-ignore
|
||||
expect(getDefaultLineHeight()).toBe(1.25);
|
||||
});
|
||||
|
||||
it("should return line height using default font family for unknown font", () => {
|
||||
const UNKNOWN_FONT = 5;
|
||||
expect(getDefaultLineHeight(UNKNOWN_FONT)).toBe(1.25);
|
||||
});
|
||||
|
||||
it("should return correct line height", () => {
|
||||
expect(getDefaultLineHeight(FONT_FAMILY.Cascadia)).toBe(1.2);
|
||||
});
|
||||
|
@ -887,7 +887,7 @@ const DEFAULT_LINE_HEIGHT = {
|
||||
};
|
||||
|
||||
export const getDefaultLineHeight = (fontFamily: FontFamilyValues) => {
|
||||
if (fontFamily) {
|
||||
if (fontFamily in DEFAULT_LINE_HEIGHT) {
|
||||
return DEFAULT_LINE_HEIGHT[fontFamily];
|
||||
}
|
||||
return DEFAULT_LINE_HEIGHT[DEFAULT_FONT_FAMILY];
|
||||
|
Loading…
x
Reference in New Issue
Block a user