@@ -155,6 +155,31 @@ describe('text-area', () => {
155155 expect ( inputField . scrollTop ) . to . equal ( 200 ) ;
156156 } ) ;
157157
158+ it ( 'should maintain scroll top on value shrink' , async ( ) => {
159+ textArea . style . maxHeight = '100px' ;
160+ const value = Array ( 400 ) . join ( '400' ) ;
161+ setInputValue ( textArea , value ) ;
162+ await nextUpdate ( textArea ) ;
163+
164+ inputField . scrollTop = 50 ;
165+ setInputValue ( textArea , value . slice ( 0 , - 1 ) ) ;
166+ await nextUpdate ( textArea ) ;
167+
168+ expect ( inputField . scrollTop ) . to . equal ( 50 ) ;
169+ } ) ;
170+
171+ it ( 'should match input height to its scroll height when input-field scrolls' , async ( ) => {
172+ textArea . style . width = '120px' ;
173+ textArea . style . maxHeight = '60px' ;
174+ textArea . value = Array ( 400 ) . join ( '400' ) ;
175+ await nextUpdate ( textArea ) ;
176+
177+ setInputValue ( textArea , textArea . value . slice ( 0 , - 1 ) ) ;
178+ await nextUpdate ( textArea ) ;
179+
180+ expect ( parseFloat ( native . style . height ) ) . to . equal ( native . scrollHeight ) ;
181+ } ) ;
182+
158183 it ( 'should decrease height automatically' , async ( ) => {
159184 textArea . value = Array ( 400 ) . join ( '400' ) ;
160185 await nextUpdate ( textArea ) ;
0 commit comments