| Index: polymer_1.0.4/bower_components/iron-autogrow-textarea/test/basic.html
|
| diff --git a/polymer_1.0.4/bower_components/iron-autogrow-textarea/test/basic.html b/polymer_1.0.4/bower_components/iron-autogrow-textarea/test/basic.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..af736a0a1fac3bcd74183f4d6bd52d646f4481c0
|
| --- /dev/null
|
| +++ b/polymer_1.0.4/bower_components/iron-autogrow-textarea/test/basic.html
|
| @@ -0,0 +1,126 @@
|
| +<!doctype html>
|
| +<!--
|
| +@license
|
| +Copyright (c) 2015 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>
|
| +
|
| + <title>iron-autogrow-textarea tests</title>
|
| +
|
| + <meta charset="utf-8">
|
| + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
| + <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
|
| +
|
| + <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
| +
|
| + <script src="../../web-component-tester/browser.js"></script>
|
| + <script src="../../test-fixture/test-fixture-mocha.js"></script>
|
| + <script src="../../iron-test-helpers/mock-interactions.js"></script>
|
| +
|
| + <link rel="import" href="../../test-fixture/test-fixture.html">
|
| + <link rel="import" href="../iron-autogrow-textarea.html">
|
| +
|
| + </head>
|
| + <body>
|
| +
|
| + <test-fixture id="basic">
|
| + <template>
|
| + <iron-autogrow-textarea></iron-autogrow-textarea>
|
| + </template>
|
| + </test-fixture>
|
| +
|
| + <test-fixture id="has-bindValue">
|
| + <template>
|
| + <iron-autogrow-textarea bind-value="foobar"></iron-autogrow-textarea>
|
| + </template>
|
| + </test-fixture>
|
| +
|
| + <test-fixture id="rows">
|
| + <template>
|
| + <iron-autogrow-textarea rows="3"></iron-autogrow-textarea>
|
| + </template>
|
| + </test-fixture>
|
| +
|
| + <script>
|
| +
|
| + suite('basic', function() {
|
| +
|
| + test('setting bindValue sets textarea value', function() {
|
| + var autogrow = fixture('basic');
|
| + var textarea = autogrow.textarea;
|
| +
|
| + autogrow.bindValue = 'batman';
|
| + assert.equal(textarea.value, autogrow.bindValue, 'textarea value equals to bindValue');
|
| + });
|
| +
|
| + test('can set an initial bindValue', function() {
|
| + var autogrow = fixture('has-bindValue');
|
| + assert.equal(autogrow.textarea.value, 'foobar', 'textarea value equals to initial bindValue');
|
| + });
|
| +
|
| + test('can set an initial number of rows', function() {
|
| + var autogrow = fixture("rows");
|
| + assert.equal(autogrow.textarea.rows, 3, 'textarea has rows=3');
|
| + });
|
| +
|
| + test('adding rows grows the textarea', function() {
|
| + var autogrow = fixture('basic');
|
| + var initialHeight = autogrow.offsetHeight;
|
| +
|
| + autogrow.bindValue = 'batman\nand\nrobin';
|
| + var finalHeight = autogrow.offsetHeight
|
| + assert.isTrue(finalHeight > initialHeight);
|
| + });
|
| +
|
| + test('removing rows shrinks the textarea', function() {
|
| + var autogrow = fixture('basic');
|
| + autogrow.bindValue = 'batman\nand\nrobin';
|
| + var initialHeight = autogrow.offsetHeight;
|
| +
|
| + autogrow.bindValue = 'batman';
|
| + var finalHeight = autogrow.offsetHeight
|
| + assert.isTrue(finalHeight < initialHeight);
|
| + });
|
| + });
|
| +
|
| + suite('focus/blur events', function() {
|
| + var input;
|
| +
|
| + setup(function() {
|
| + input = fixture('basic');
|
| + });
|
| +
|
| + test('focus/blur events fired on host element', function(done) {
|
| + var nFocusEvents = 0;
|
| + var nBlurEvents = 0;
|
| + input.addEventListener('focus', function() {
|
| + nFocusEvents += 1;
|
| + // setTimeout to wait for potentially more, erroneous events
|
| + setTimeout(function() {
|
| + assert.equal(nFocusEvents, 1, 'one focus event fired');
|
| + MockInteractions.blur(input.textarea);
|
| + });
|
| + });
|
| + input.addEventListener('blur', function() {
|
| + nBlurEvents += 1;
|
| + // setTimeout to wait for potentially more, erroneous events
|
| + setTimeout(function() {
|
| + assert.equal(nBlurEvents, 1, 'one blur event fired');
|
| + done();
|
| + });
|
| + });
|
| + MockInteractions.focus(input.textarea);
|
| + });
|
| +
|
| + });
|
| +
|
| + </script>
|
| +
|
| + </body>
|
| +</html>
|
|
|