Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Side by Side Diff: third_party/polymer/components/paper-input/test/paper-input-container.html

Issue 3010683002: Update Polymer components. (Closed)
Patch Set: Rebase Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 <test-fixture id="manual-validate-numbers"> 97 <test-fixture id="manual-validate-numbers">
98 <template> 98 <template>
99 <paper-input-container> 99 <paper-input-container>
100 <label id="l">label</label> 100 <label id="l">label</label>
101 <input is="iron-input" id="i" pattern="[0-9]*"> 101 <input is="iron-input" id="i" pattern="[0-9]*">
102 </paper-input-container> 102 </paper-input-container>
103 </template> 103 </template>
104 </test-fixture> 104 </test-fixture>
105 105
106 <test-fixture id="required-validate">
107 <template>
108 <paper-input-container>
109 <label id="l">label</label>
110 <input is="iron-input" id="i" required>
111 </paper-input-container>
112 </template>
113 </test-fixture>
114
106 <letters-only></letters-only> 115 <letters-only></letters-only>
107 116
108 <test-fixture id="auto-validate-validator"> 117 <test-fixture id="auto-validate-validator">
109 <template> 118 <template>
110 <paper-input-container auto-validate> 119 <paper-input-container auto-validate>
111 <label id="l">label</label> 120 <label id="l">label</label>
112 <input is="iron-input" id="i" pattern="[0-9]*" validator="letters-only"> 121 <input is="iron-input" id="i" pattern="[0-9]*" validator="letters-only">
113 </paper-input-container> 122 </paper-input-container>
114 </template> 123 </template>
115 </test-fixture> 124 </test-fixture>
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 var input = Polymer.dom(container).querySelector('#i'); 246 var input = Polymer.dom(container).querySelector('#i');
238 var line = Polymer.dom(container.root).querySelector('.underline'); 247 var line = Polymer.dom(container.root).querySelector('.underline');
239 assert.isFalse(line.classList.contains('is-highlighted'), 'line is not h ighlighted when input is not focused'); 248 assert.isFalse(line.classList.contains('is-highlighted'), 'line is not h ighlighted when input is not focused');
240 MockInteractions.focus(input); 249 MockInteractions.focus(input);
241 requestAnimationFrame(function() { 250 requestAnimationFrame(function() {
242 assert.isTrue(line.classList.contains('is-highlighted'), 'line is high lighted when input is focused'); 251 assert.isTrue(line.classList.contains('is-highlighted'), 'line is high lighted when input is focused');
243 done(); 252 done();
244 }); 253 });
245 }); 254 });
246 255
256 test('focused class added to input content', function(done) {
257 var container = fixture('basic');
258 var input = Polymer.dom(container).querySelector('#i');
259 var inputContent = Polymer.dom(container.root).querySelector('.input-con tent');
260 assert.isFalse(inputContent.classList.contains('focused'), 'input conten t does not have class "focused" when input is not focused');
261 MockInteractions.focus(input);
262 requestAnimationFrame(function() {
263 assert.isTrue(inputContent.classList.contains('focused'), 'input conte nt has class "focused" when input is focused');
264 done();
265 });
266 });
267
247 }); 268 });
248 269
249 suite('validation', function() { 270 suite('validation', function() {
250 271
251 test('styled when the input is set to an invalid value with auto-validate' , function() { 272 test('styled when the input is set to an invalid value with auto-validate' , function() {
252 var container = fixture('auto-validate-numbers'); 273 var container = fixture('auto-validate-numbers');
253 var input = Polymer.dom(container).querySelector('#i'); 274 var input = Polymer.dom(container).querySelector('#i');
254 var inputContent = Polymer.dom(container.root).querySelector('.input-con tent'); 275 var inputContent = Polymer.dom(container.root).querySelector('.input-con tent');
255 var line = Polymer.dom(container.root).querySelector('.underline'); 276 var line = Polymer.dom(container.root).querySelector('.underline');
256 277
(...skipping 30 matching lines...) Expand all
287 var line = Polymer.dom(container.root).querySelector('.underline'); 308 var line = Polymer.dom(container.root).querySelector('.underline');
288 309
289 input.bindValue = 'foobar'; 310 input.bindValue = 'foobar';
290 input.validate(); 311 input.validate();
291 312
292 assert.isTrue(container.invalid, 'invalid is true'); 313 assert.isTrue(container.invalid, 'invalid is true');
293 assert.isTrue(inputContent.classList.contains('is-invalid'), 'label has invalid styling when input is invalid'); 314 assert.isTrue(inputContent.classList.contains('is-invalid'), 'label has invalid styling when input is invalid');
294 assert.isTrue(line.classList.contains('is-invalid'), 'underline has inva lid styling when input is invalid'); 315 assert.isTrue(line.classList.contains('is-invalid'), 'underline has inva lid styling when input is invalid');
295 }); 316 });
296 317
318 test('styled when the input is manually validated and required', function( ) {
319 var container = fixture('required-validate');
320 var input = Polymer.dom(container).querySelector('#i');
321 var inputContent = Polymer.dom(container.root).querySelector('.input-con tent');
322 assert.isFalse(container.invalid, 'invalid is false');
323 input.validate();
324 assert.isTrue(container.invalid, 'invalid is true');
325 assert.isTrue(inputContent.classList.contains('is-invalid'), 'input cont ent has is-invalid class');
326 });
327
297 }); 328 });
298 329
299 </script> 330 </script>
300 331
301 </body> 332 </body>
302 </html> 333 </html>
OLDNEW
« no previous file with comments | « third_party/polymer/components/paper-input/paper-textarea.html ('k') | third_party/polymer/components/paper-item/.bower.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698