diff --git a/src/calculateNodeHeight.tsx b/src/calculateNodeHeight.tsx index e16c9fd..e60d115 100644 --- a/src/calculateNodeHeight.tsx +++ b/src/calculateNodeHeight.tsx @@ -20,6 +20,7 @@ const HIDDEN_TEXTAREA_STYLE = ` const SIZING_STYLE = [ 'letter-spacing', + 'word-spacing', 'line-height', 'padding-top', 'padding-bottom', diff --git a/tests/TextArea.test.tsx b/tests/TextArea.test.tsx index 390f1cd..aa64162 100644 --- a/tests/TextArea.test.tsx +++ b/tests/TextArea.test.tsx @@ -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( +