OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> |
| 10 <html> |
| 11 <head> |
| 12 |
| 13 <title>paper-input-counter tests</title> |
| 14 |
| 15 <meta charset="utf-8"> |
| 16 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 17 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initia
l-scale=1, user-scalable=yes"> |
| 18 |
| 19 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 20 |
| 21 <script src="../../web-component-tester/browser.js"></script> |
| 22 <script src="../../test-fixture/test-fixture-mocha.js"></script> |
| 23 |
| 24 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 25 <link rel="import" href="../../iron-input/iron-input.html"> |
| 26 <link rel="import" href="../paper-input-container.html"> |
| 27 <link rel="import" href="../paper-input-char-counter.html"> |
| 28 |
| 29 </head> |
| 30 <body> |
| 31 |
| 32 <test-fixture id="counter"> |
| 33 <template> |
| 34 <paper-input-container> |
| 35 <label id="l">label</label> |
| 36 <input id="i" value="foobar"> |
| 37 <paper-input-char-counter id="c"></paper-input-char-counter> |
| 38 </paper-input-container> |
| 39 </template> |
| 40 </test-fixture> |
| 41 |
| 42 <test-fixture id="counter-with-max"> |
| 43 <template> |
| 44 <paper-input-container> |
| 45 <label id="l">label</label> |
| 46 <input id="i" value="foobar" maxlength="10"> |
| 47 <paper-input-char-counter id="c"></paper-input-char-counter> |
| 48 </paper-input-container> |
| 49 </template> |
| 50 </test-fixture> |
| 51 |
| 52 <script> |
| 53 |
| 54 suite('basic', function() { |
| 55 |
| 56 test('character counter shows the value length', function() { |
| 57 var container = fixture('counter'); |
| 58 var input = Polymer.dom(container).querySelector('#i'); |
| 59 var counter = Polymer.dom(container).querySelector('#c'); |
| 60 assert.equal(counter.charCounter, input.value.length, 'character counter
shows input value length'); |
| 61 }); |
| 62 |
| 63 test('character counter shows the value length with maxlength', function()
{ |
| 64 var container = fixture('counter-with-max'); |
| 65 var input = Polymer.dom(container).querySelector('#i'); |
| 66 var counter = Polymer.dom(container).querySelector('#c'); |
| 67 assert.equal(counter.charCounter, input.value.length + '/' + input.maxLe
ngth, 'character counter shows input value length and maxLength'); |
| 68 }); |
| 69 |
| 70 }); |
| 71 |
| 72 </script> |
| 73 |
| 74 </body> |
| 75 </html> |
OLD | NEW |