| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <!-- | 2 <!-- |
| 3 @license | 3 @license |
| 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 8 Code distributed by Google as part of the polymer project is also | 8 Code distributed by Google as part of the polymer project is also |
| 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 10 --> | 10 --> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 <paper-input auto-validate char-counter required error-message="error"></p
aper-input> | 76 <paper-input auto-validate char-counter required error-message="error"></p
aper-input> |
| 77 </template> | 77 </template> |
| 78 </test-fixture> | 78 </test-fixture> |
| 79 | 79 |
| 80 <test-fixture id="char-counter"> | 80 <test-fixture id="char-counter"> |
| 81 <template> | 81 <template> |
| 82 <paper-input char-counter value="foobar"></paper-input> | 82 <paper-input char-counter value="foobar"></paper-input> |
| 83 </template> | 83 </template> |
| 84 </test-fixture> | 84 </test-fixture> |
| 85 | 85 |
| 86 <test-fixture id="type-number-char-counter"> |
| 87 <template> |
| 88 <paper-input type="number" char-counter value="1138"></paper-input> |
| 89 </template> |
| 90 </test-fixture> |
| 91 |
| 86 <test-fixture id="always-float-label"> | 92 <test-fixture id="always-float-label"> |
| 87 <template> | 93 <template> |
| 88 <paper-input always-float-label label="foo"></paper-input> | 94 <paper-input always-float-label label="foo"></paper-input> |
| 89 </template> | 95 </template> |
| 90 </test-fixture> | 96 </test-fixture> |
| 91 | 97 |
| 92 <test-fixture id="placeholder"> | 98 <test-fixture id="placeholder"> |
| 93 <template> | 99 <template> |
| 94 <paper-input label="foo" placeholder="bar"></paper-input> | 100 <paper-input label="foo" placeholder="bar"></paper-input> |
| 95 </template> | 101 </template> |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 }); | 178 }); |
| 173 | 179 |
| 174 test('character counter is displayed', function() { | 180 test('character counter is displayed', function() { |
| 175 var input = fixture('char-counter'); | 181 var input = fixture('char-counter'); |
| 176 forceXIfStamp(input); | 182 forceXIfStamp(input); |
| 177 var counter = Polymer.dom(input.root).querySelector('paper-input-char-co
unter') | 183 var counter = Polymer.dom(input.root).querySelector('paper-input-char-co
unter') |
| 178 assert.ok(counter, 'paper-input-char-counter exists'); | 184 assert.ok(counter, 'paper-input-char-counter exists'); |
| 179 assert.equal(counter._charCounterStr, input.value.length, 'character cou
nter shows the value length'); | 185 assert.equal(counter._charCounterStr, input.value.length, 'character cou
nter shows the value length'); |
| 180 }); | 186 }); |
| 181 | 187 |
| 188 test('character counter is correct for type=number', function() { |
| 189 var input = fixture('type-number-char-counter'); |
| 190 forceXIfStamp(input); |
| 191 var counter = Polymer.dom(input.root).querySelector('paper-input-char-co
unter') |
| 192 assert.ok(counter, 'paper-input-char-counter exists'); |
| 193 assert.equal(counter._charCounterStr, input.value.toString().length, 'ch
aracter counter shows the value length'); |
| 194 }); |
| 195 |
| 182 test('validator is used', function() { | 196 test('validator is used', function() { |
| 183 var input = fixture('validator'); | 197 var input = fixture('validator'); |
| 184 assert.ok(input.inputElement.invalid, 'input is invalid'); | 198 assert.ok(input.inputElement.invalid, 'input is invalid'); |
| 185 }); | 199 }); |
| 186 | 200 |
| 187 test('caret position is preserved', function() { | 201 test('caret position is preserved', function() { |
| 188 var input = fixture('basic'); | 202 var input = fixture('basic'); |
| 189 var ironInput = Polymer.dom(input.root).querySelector('input[is="iron-in
put"]'); | 203 var ironInput = Polymer.dom(input.root).querySelector('input[is="iron-in
put"]'); |
| 190 input.value = 'nananana'; | 204 input.value = 'nananana'; |
| 191 ironInput.selectionStart = 2; | 205 ironInput.selectionStart = 2; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 test('focusing then bluring sets the focused attribute correctly', functio
n() { | 258 test('focusing then bluring sets the focused attribute correctly', functio
n() { |
| 245 MockInteractions.focus(input); | 259 MockInteractions.focus(input); |
| 246 assert(input.focused, 'input is focused'); | 260 assert(input.focused, 'input is focused'); |
| 247 MockInteractions.blur(input); | 261 MockInteractions.blur(input); |
| 248 assert(!input.focused, 'input is blurred'); | 262 assert(!input.focused, 'input is blurred'); |
| 249 MockInteractions.focus(input.inputElement); | 263 MockInteractions.focus(input.inputElement); |
| 250 assert(input.focused, 'input is focused'); | 264 assert(input.focused, 'input is focused'); |
| 251 MockInteractions.blur(input.inputElement); | 265 MockInteractions.blur(input.inputElement); |
| 252 assert(!input.focused, 'input is blurred'); | 266 assert(!input.focused, 'input is blurred'); |
| 253 }); | 267 }); |
| 268 |
| 269 test('focusing then bluring with shift-tab removes the focused attribute c
orrectly', function() { |
| 270 MockInteractions.focus(input); |
| 271 assert(input.focused, 'input is focused'); |
| 272 |
| 273 // Fake a shift-tab induced blur by forcing the flag. |
| 274 input._shiftTabPressed = true; |
| 275 MockInteractions.blur(input.inputElement); |
| 276 assert(!input.focused, 'input is blurred'); |
| 277 }); |
| 254 }); | 278 }); |
| 255 | 279 |
| 256 suite('focused styling (integration test)', function() { | 280 suite('focused styling (integration test)', function() { |
| 257 | 281 |
| 258 test('underline is colored when input is focused', function(done) { | 282 test('underline is colored when input is focused', function(done) { |
| 259 var input = fixture('basic'); | 283 var input = fixture('basic'); |
| 260 var container = Polymer.dom(input.root).querySelector('paper-input-conta
iner'); | 284 var container = Polymer.dom(input.root).querySelector('paper-input-conta
iner'); |
| 261 var line = Polymer.dom(container.root).querySelector('.underline'); | 285 var line = Polymer.dom(container.root).querySelector('.underline'); |
| 262 assert.isFalse(line.classList.contains('is-highlighted'), 'line is not h
ighlighted when input is not focused'); | 286 assert.isFalse(line.classList.contains('is-highlighted'), 'line is not h
ighlighted when input is not focused'); |
| 263 MockInteractions.focus(input.inputElement); | 287 MockInteractions.focus(input.inputElement); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 done(); | 359 done(); |
| 336 }); | 360 }); |
| 337 }); | 361 }); |
| 338 }); | 362 }); |
| 339 }); | 363 }); |
| 340 | 364 |
| 341 </script> | 365 </script> |
| 342 | 366 |
| 343 </body> | 367 </body> |
| 344 </html> | 368 </html> |
| OLD | NEW |