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-error 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-error.html"> |
| 28 |
| 29 </head> |
| 30 <body> |
| 31 |
| 32 <test-fixture id="auto-validate-numbers"> |
| 33 <template> |
| 34 <paper-input-container auto-validate> |
| 35 <label id="l">label</label> |
| 36 <input is="iron-input" id="i" pattern="[0-9]*"> |
| 37 <paper-input-error id="e">error</paper-input-error> |
| 38 </paper-input-container> |
| 39 </template> |
| 40 </test-fixture> |
| 41 |
| 42 <script> |
| 43 |
| 44 suite('basic', function() { |
| 45 |
| 46 test('error message only appears when input is invalid', function() { |
| 47 var container = fixture('auto-validate-numbers'); |
| 48 var input = Polymer.dom(container).querySelector('#i'); |
| 49 var error = Polymer.dom(container).querySelector('#e'); |
| 50 assert.equal(getComputedStyle(error).display, 'none', 'error is display:
none'); |
| 51 input.bindValue = 'foobar'; |
| 52 assert.notEqual(getComputedStyle(error).display, 'none', 'error is not d
isplay:none'); |
| 53 }); |
| 54 |
| 55 }); |
| 56 |
| 57 </script> |
| 58 |
| 59 </body> |
| 60 </html> |
OLD | NEW |