mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: set the dimensions of bound text correctly (#5710)
* fix: set the dimensions of bound text correctly * use original Text when wrapping * fix text align * fix specs * fix * newline
This commit is contained in:
parent
8636ef1017
commit
4cb6f09559
8 changed files with 79 additions and 57 deletions
|
@ -1,3 +1,4 @@
|
|||
import { BOUND_TEXT_PADDING } from "../constants";
|
||||
import { wrapText } from "./textElement";
|
||||
import { FontString } from "./types";
|
||||
|
||||
|
@ -45,7 +46,7 @@ up`,
|
|||
},
|
||||
].forEach((data) => {
|
||||
it(`should ${data.desc}`, () => {
|
||||
const res = wrapText(text, font, data.width);
|
||||
const res = wrapText(text, font, data.width - BOUND_TEXT_PADDING * 2);
|
||||
expect(res).toEqual(data.res);
|
||||
});
|
||||
});
|
||||
|
@ -93,7 +94,7 @@ whats up`,
|
|||
},
|
||||
].forEach((data) => {
|
||||
it(`should respect new lines and ${data.desc}`, () => {
|
||||
const res = wrapText(text, font, data.width);
|
||||
const res = wrapText(text, font, data.width - BOUND_TEXT_PADDING * 2);
|
||||
expect(res).toEqual(data.res);
|
||||
});
|
||||
});
|
||||
|
@ -132,7 +133,7 @@ break it now`,
|
|||
},
|
||||
].forEach((data) => {
|
||||
it(`should ${data.desc}`, () => {
|
||||
const res = wrapText(text, font, data.width);
|
||||
const res = wrapText(text, font, data.width - BOUND_TEXT_PADDING * 2);
|
||||
expect(res).toEqual(data.res);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue