| Index: polymer_0.5.0/bower_components/paper-input/test/autogrow.html
|
| diff --git a/polymer_0.5.0/bower_components/paper-input/test/autogrow.html b/polymer_0.5.0/bower_components/paper-input/test/autogrow.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2bc20b48a850635ecb2a22ee56ca4df73e677b5e
|
| --- /dev/null
|
| +++ b/polymer_0.5.0/bower_components/paper-input/test/autogrow.html
|
| @@ -0,0 +1,132 @@
|
| +<!doctype html>
|
| +<!--
|
| +Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
| +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
| +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
| +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
| +Code distributed by Google as part of the polymer project is also
|
| +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
| +-->
|
| +<html>
|
| +<head>
|
| + <meta charset="UTF-8">
|
| + <title>paper-autogrow-textarea</title>
|
| + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
| +
|
| + <script src="../../webcomponentsjs/webcomponents.js"></script>
|
| + <script src="../../web-component-tester/browser.js"></script>
|
| +
|
| + <link href="../paper-autogrow-textarea.html" rel="import">
|
| +
|
| + <style>
|
| + paper-autogrow-textarea {
|
| + background-color: black;
|
| + }
|
| +
|
| + textarea {
|
| + background-color: yellow;
|
| + }
|
| + </style>
|
| +
|
| +</head>
|
| +<body>
|
| +
|
| + <paper-autogrow-textarea id="autogrow1">
|
| + <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');
|
| + var t1 = document.getElementById('textarea1');
|
| +
|
| + function dispatchInputEvent(target) {
|
| + var e = new Event('input', {
|
| + bubbles: true
|
| + });
|
| + target.dispatchEvent(e);
|
| + };
|
| +
|
| + function between(val, val1, val2) {
|
| + return assert.ok(val > val1 && val < val2);
|
| + }
|
| +
|
| + suite('basic', function() {
|
| +
|
| + teardown(function(done) {
|
| + t1.value = '';
|
| + dispatchInputEvent(t1);
|
| + a1.rows = 1;
|
| + a1.maxRows = 0;
|
| +
|
| + flush(function() {
|
| + done();
|
| + });
|
| + });
|
| +
|
| + test('empty input has height', function() {
|
| + assert.ok(a1.offsetHeight > 0);
|
| + });
|
| +
|
| + test('accepts number input', function() {
|
| + t1.value = 1;
|
| + dispatchInputEvent(t1);
|
| + // make sure we didn't crash
|
| + });
|
| +
|
| + test('grows with more rows of input', function(done) {
|
| + t1.value = 'foo\nbar';
|
| + dispatchInputEvent(t1);
|
| +
|
| + var h1 = a1.offsetHeight;
|
| +
|
| + t1.value = 'foo\nbar\nbaz';
|
| + dispatchInputEvent(t1);
|
| +
|
| + flush(function() {
|
| + var h2 = a1.offsetHeight;
|
| + assert.ok(h2 > h1);
|
| + assert.deepEqual(a1.getBoundingClientRect(), t1.getBoundingClientRect());
|
| + done();
|
| + });
|
| + });
|
| +
|
| + test('honors the rows attribute', function(done) {
|
| + var h1 = a1.offsetHeight;
|
| + a1.rows = 2;
|
| +
|
| + flush(function() {
|
| + var h2 = a1.offsetHeight;
|
| + between(h2, h1, 3 * h1);
|
| + done();
|
| + });
|
| + });
|
| +
|
| + test('honors the maxRows attribute', function(done) {
|
| + var h1 = a1.offsetHeight;
|
| + a1.maxRows = 2;
|
| +
|
| + t1.value = 'foo\nbar\nbaz\nzot';
|
| + dispatchInputEvent(t1);
|
| +
|
| + flush(function() {
|
| + var h2 = a1.offsetHeight;
|
| + assert.ok(h2 < 3 * h1);
|
| + done();
|
| + });
|
| + });
|
| +
|
| + test('mirror text is visibility:hidden', function() {
|
| + assert.equal(getComputedStyle(a1.$.mirror).visibility, 'hidden');
|
| + });
|
| +
|
| + });
|
| +
|
| + </script>
|
| +
|
| +</body>
|
| +</html>
|
|
|