Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
test: add a failing test, update
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvonne Yip committed Nov 11, 2014
1 parent 5a798ef commit e617452
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/autogrow.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
<textarea id="textarea1"></textarea>
</paper-autogrow-textarea>

<paper-autogrow-textarea id="autogrow2" rows="2" maxRows="4">
<textarea id="textarea2"></textarea>
</paper-autogrow-textarea>

<script>

var a1 = document.getElementById('autogrow1');
Expand All @@ -47,6 +51,10 @@
target.dispatchEvent(e);
};

function between(val, val1, val2) {
return assert.ok(val > val1 && val < val2);
}

suite('basic', function() {

teardown(function(done) {
Expand All @@ -55,7 +63,7 @@
a1.rows = 1;
a1.maxRows = 0;

asyncPlatformFlush(function() {
flush(function() {
done();
});
});
Expand All @@ -79,7 +87,7 @@
t1.value = 'foo\nbar\nbaz';
dispatchInputEvent(t1);

asyncPlatformFlush(function() {
flush(function() {
var h2 = a1.offsetHeight;
assert.ok(h2 > h1);
assert.deepEqual(a1.getBoundingClientRect(), t1.getBoundingClientRect());
Expand All @@ -91,9 +99,9 @@
var h1 = a1.offsetHeight;
a1.rows = 2;

asyncPlatformFlush(function() {
flush(function() {
var h2 = a1.offsetHeight;
assert.equal(h2, 2 * h1);
between(h2, h1, 3 * h1);
done();
});
});
Expand All @@ -105,9 +113,9 @@
t1.value = 'foo\nbar\nbaz\nzot';
dispatchInputEvent(t1);

asyncPlatformFlush(function() {
flush(function() {
var h2 = a1.offsetHeight;
assert.equal(h2, 2 * h1);
assert.ok(h2 < 3 * h1);
done();
});
});
Expand Down

0 comments on commit e617452

Please sign in to comment.