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

Side by Side Diff: chrome/browser/resources/chromeos/login/gaia_input.js

Issue 1179323005: Polymer upgraded to 1.0 in login flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@polymer_pre_migration
Patch Set: Comments addressed. Created 5 years, 6 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 /* Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 // found in the LICENSE file.
4 */
5 4
6 Polymer('gaia-input', (function() { 5 Polymer((function() {
7 var INPUT_EMAIL_PATTERN = "^[a-zA-Z0-9.!#$%&'*+=?^_`{|}~-]+(@[^\\s@]+)?$"; 6 var INPUT_EMAIL_PATTERN = "^[a-zA-Z0-9.!#$%&'*+=?^_`{|}~-]+(@[^\\s@]+)?$";
8 7
9 return { 8 return {
10 required: false, 9 is: 'gaia-input',
11 10
12 ready: function() { 11 properties: {
13 this.typeChanged(); 12 label: String,
13 value: {
14 notify: true,
15 observer: 'updateDomainVisibility_',
16 type: String
17 },
18
19 type: {
20 observer: 'typeChanged_',
21 type: String
22 },
23
24 domain: {
25 observer: 'updateDomainVisibility_',
26 type: String
27 },
28
29 disabled: Boolean,
30
31 required: Boolean,
32
33 error: String,
34
35 isInvalid: Boolean
36 },
37
38 attached: function() {
39 this.typeChanged_();
14 }, 40 },
15 41
16 onKeyDown: function(e) { 42 onKeyDown: function(e) {
17 this.isInvalid = false; 43 this.isInvalid = false;
18 }, 44 },
19 45
20 setDomainVisibility: function() { 46 updateDomainVisibility_: function() {
21 this.$.domainLabel.hidden = (this.type !== 'email') || !this.domain || 47 this.$.domainLabel.hidden = (this.type !== 'email') || !this.domain ||
22 (this.value && this.value.indexOf('@') !== -1); 48 (this.value && this.value.indexOf('@') !== -1);
23 }, 49 },
24 50
25 onTap: function() { 51 onTap: function() {
26 this.isInvalid = false; 52 this.isInvalid = false;
27 }, 53 },
28 54
29 focus: function() { 55 focus: function() {
30 this.$.input.focus(); 56 this.$.input.focus();
31 }, 57 },
32 58
33 checkValidity: function() { 59 checkValidity: function() {
34 var isValid = this.$.input.validity.valid; 60 var valid = this.$.input.validate();
35 this.isInvalid = !isValid; 61 this.isInvalid = !valid;
36 return isValid; 62 return valid;
37 }, 63 },
38 64
39 typeChanged: function() { 65 typeChanged_: function() {
40 if (this.type == 'email') { 66 if (this.type == 'email') {
41 this.$.input.pattern = INPUT_EMAIL_PATTERN; 67 this.$.input.pattern = INPUT_EMAIL_PATTERN;
42 this.$.input.type = 'text'; 68 this.$.input.type = 'text';
43 } else { 69 } else {
44 this.$.input.removeAttribute('pattern'); 70 this.$.input.removeAttribute('pattern');
45 this.$.input.type = this.type; 71 this.$.input.type = this.type;
46 } 72 }
47 this.setDomainVisibility(); 73 this.updateDomainVisibility_();
48 }, 74 }
49
50 valueChanged: function() {
51 this.setDomainVisibility();
52 },
53
54 domainChanged: function() {
55 this.setDomainVisibility();
56 },
57 }; 75 };
58 })()); 76 })());
59 77
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698