From 5ec201ab611b6f47f9514669d13335ba7b3a3ec3 Mon Sep 17 00:00:00 2001 From: DamianGarro Date: Tue, 18 Nov 2014 23:12:16 -0300 Subject: [PATCH] Break words in mirror --- paper-autogrow-textarea.html | 1 + test/autogrow.html | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/paper-autogrow-textarea.html b/paper-autogrow-textarea.html index 8a8a145..ad31c23 100644 --- a/paper-autogrow-textarea.html +++ b/paper-autogrow-textarea.html @@ -46,6 +46,7 @@ .mirror-text { visibility: hidden; + word-wrap: break-word; } ::content textarea { diff --git a/test/autogrow.html b/test/autogrow.html index 2bc20b4..e144f69 100644 --- a/test/autogrow.html +++ b/test/autogrow.html @@ -124,6 +124,20 @@ assert.equal(getComputedStyle(a1.$.mirror).visibility, 'hidden'); }); + test('grows with a long word', function(done) { + var h1 = a1.offsetHeight; + + t1.value = Array(1000).join("P"); + dispatchInputEvent(t1); + + flush(function() { + var h2 = a1.offsetHeight; + assert.ok(h2 > h1); + assert.deepEqual(a1.getBoundingClientRect(), t1.getBoundingClientRect()); + done(); + }); + }); + });