Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/calculateNodeHeight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const HIDDEN_TEXTAREA_STYLE = `

const SIZING_STYLE = [
'letter-spacing',
'word-spacing',
'line-height',
'padding-top',
'padding-bottom',
Expand Down
19 changes: 18 additions & 1 deletion tests/TextArea.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,27 @@ describe('TextArea', () => {
boxSizing: 'border-box',
paddingSize: 4,
sizingStyle:
'letter-spacing:normal;line-height:normal;padding-top:2px;padding-bottom:2px;font-family:-webkit-small-control;font-weight:;font-size:;font-variant:;text-rendering:auto;text-transform:none;width:;text-indent:0;padding-left:2px;padding-right:2px;border-width:1px;box-sizing:border-box;word-break:;white-space:pre-wrap',
'letter-spacing:normal;word-spacing:normal;line-height:normal;padding-top:2px;padding-bottom:2px;font-family:-webkit-small-control;font-weight:;font-size:;font-variant:;text-rendering:auto;text-transform:none;width:;text-indent:0;padding-left:2px;padding-right:2px;border-width:1px;box-sizing:border-box;word-break:;white-space:pre-wrap',
});
});

it.each(['8px', '16px', '-2px', 'normal'])(
'copies word-spacing %s when measuring autoSize',
(wordSpacing) => {
render(
<TextArea
autoSize
defaultValue="one two three four five six seven eight nine ten"
style={{ wordSpacing }}
/>,
);
const measurement = document.querySelector<HTMLTextAreaElement>(
'textarea[aria-hidden="true"]',
);
expect(measurement).toHaveStyle({ wordSpacing });
},
);

it('boxSizing === "border-box"', () => {
const wrapper = document.createElement('textarea');
wrapper.style.boxSizing = 'border-box';
Expand Down