From 7fb95d0419edaa0a02bdc153e75db18bfce7509d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 5 Aug 2015 21:21:18 -0400 Subject: [PATCH] update globalize --- .../iron-autogrow-textarea/.bower.json | 8 ++-- .../iron-autogrow-textarea/bower.json | 2 +- .../iron-autogrow-textarea.html | 11 +++-- .../iron-behaviors/.bower.json | 8 ++-- .../iron-behaviors/bower.json | 2 +- .../iron-behaviors/iron-button-state.html | 6 ++- .../iron-behaviors/iron-control-state.html | 6 --- .../iron-behaviors/test/focused-state.html | 18 ++++---- .../iron-flex-layout/.bower.json | 6 +-- .../bower_components/iron-meta/.bower.json | 6 +-- .../iron-validatable-behavior/.bower.json | 8 ++-- .../iron-validatable-behavior/bower.json | 2 +- .../iron-validatable-behavior.html | 36 +++++++++++----- .../bower_components/paper-input/.bower.json | 8 ++-- .../bower_components/paper-input/bower.json | 2 +- .../paper-input/paper-input-behavior.html | 41 +++++++++++++++---- .../paper-input/paper-input.html | 5 ++- .../paper-input/test/paper-input.html | 19 ++++----- .../paper-input/test/paper-textarea.html | 9 ++-- dashboard-ui/scripts/globalize.js | 27 ++++++++++-- dashboard-ui/scripts/site.js | 2 +- 21 files changed, 142 insertions(+), 90 deletions(-) diff --git a/dashboard-ui/bower_components/iron-autogrow-textarea/.bower.json b/dashboard-ui/bower_components/iron-autogrow-textarea/.bower.json index c71d16770f..19809fcd64 100644 --- a/dashboard-ui/bower_components/iron-autogrow-textarea/.bower.json +++ b/dashboard-ui/bower_components/iron-autogrow-textarea/.bower.json @@ -1,6 +1,6 @@ { "name": "iron-autogrow-textarea", - "version": "1.0.3", + "version": "1.0.4", "description": "A textarea element that automatically grows with input", "authors": [ "The Polymer Authors" @@ -37,11 +37,11 @@ "paper-styles": "PolymerElements/paper-styles#^1.0.0", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, - "_release": "1.0.3", + "_release": "1.0.4", "_resolution": { "type": "version", - "tag": "v1.0.3", - "commit": "9eae088ce72a31b0baf44e6cdc183e5b73014af5" + "tag": "v1.0.4", + "commit": "0501594add2228c34b39b9fa898d177f7f8e1adb" }, "_source": "git://github.com/PolymerElements/iron-autogrow-textarea.git", "_target": "^1.0.0", diff --git a/dashboard-ui/bower_components/iron-autogrow-textarea/bower.json b/dashboard-ui/bower_components/iron-autogrow-textarea/bower.json index 810f88f880..745768d87f 100644 --- a/dashboard-ui/bower_components/iron-autogrow-textarea/bower.json +++ b/dashboard-ui/bower_components/iron-autogrow-textarea/bower.json @@ -1,6 +1,6 @@ { "name": "iron-autogrow-textarea", - "version": "1.0.3", + "version": "1.0.4", "description": "A textarea element that automatically grows with input", "authors": [ "The Polymer Authors" diff --git a/dashboard-ui/bower_components/iron-autogrow-textarea/iron-autogrow-textarea.html b/dashboard-ui/bower_components/iron-autogrow-textarea/iron-autogrow-textarea.html index cb1cd3391a..ea1f27c648 100644 --- a/dashboard-ui/bower_components/iron-autogrow-textarea/iron-autogrow-textarea.html +++ b/dashboard-ui/bower_components/iron-autogrow-textarea/iron-autogrow-textarea.html @@ -21,9 +21,7 @@ never scroll. Example: - - - + Because the `textarea`'s `value` property is not observable, you should use this element's `bind-value` instead for imperative updates. @@ -63,6 +61,7 @@ this element's `bind-value` instead for imperative updates. height: 100%; font-size: inherit; font-family: inherit; + line-height: inherit; } ::content textarea:invalid { @@ -150,8 +149,8 @@ this element's `bind-value` instead for imperative updates. * Bound to the textarea's `autofocus` attribute. */ autofocus: { - type: String, - value: 'off' + type: Boolean, + value: false }, /** @@ -302,5 +301,5 @@ this element's `bind-value` instead for imperative updates. _computeValue: function() { return this.bindValue; } - }) + }); diff --git a/dashboard-ui/bower_components/iron-behaviors/.bower.json b/dashboard-ui/bower_components/iron-behaviors/.bower.json index 96f7c46513..8d2ddae93c 100644 --- a/dashboard-ui/bower_components/iron-behaviors/.bower.json +++ b/dashboard-ui/bower_components/iron-behaviors/.bower.json @@ -1,6 +1,6 @@ { "name": "iron-behaviors", - "version": "1.0.5", + "version": "1.0.6", "description": "Provides a set of behaviors for the iron elements", "private": true, "authors": [ @@ -28,11 +28,11 @@ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, "homepage": "https://github.com/PolymerElements/iron-behaviors", - "_release": "1.0.5", + "_release": "1.0.6", "_resolution": { "type": "version", - "tag": "v1.0.5", - "commit": "bdae66f398838eda78c203b3ae979dcb5cd2a60e" + "tag": "v1.0.6", + "commit": "9dad0f52150c887997045b8bbf2a82b2394b8a37" }, "_source": "git://github.com/PolymerElements/iron-behaviors.git", "_target": "^1.0.0", diff --git a/dashboard-ui/bower_components/iron-behaviors/bower.json b/dashboard-ui/bower_components/iron-behaviors/bower.json index 5b658f2493..6b67af642f 100644 --- a/dashboard-ui/bower_components/iron-behaviors/bower.json +++ b/dashboard-ui/bower_components/iron-behaviors/bower.json @@ -1,6 +1,6 @@ { "name": "iron-behaviors", - "version": "1.0.5", + "version": "1.0.6", "description": "Provides a set of behaviors for the iron elements", "private": true, "authors": [ diff --git a/dashboard-ui/bower_components/iron-behaviors/iron-button-state.html b/dashboard-ui/bower_components/iron-behaviors/iron-button-state.html index 11c03d76b2..da2f0fee80 100644 --- a/dashboard-ui/bower_components/iron-behaviors/iron-button-state.html +++ b/dashboard-ui/bower_components/iron-behaviors/iron-button-state.html @@ -109,8 +109,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN // to emulate native checkbox, (de-)activations from a user interaction fire // 'change' events _userActivate: function(active) { - this.active = active; - this.fire('change'); + if (this.active !== active) { + this.active = active; + this.fire('change'); + } }, _eventSourceIsPrimaryInput: function(event) { diff --git a/dashboard-ui/bower_components/iron-behaviors/iron-control-state.html b/dashboard-ui/bower_components/iron-behaviors/iron-control-state.html index 33e42ea109..5da455b26d 100644 --- a/dashboard-ui/bower_components/iron-behaviors/iron-control-state.html +++ b/dashboard-ui/bower_components/iron-behaviors/iron-control-state.html @@ -60,11 +60,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN ], ready: function() { - // TODO(sjmiles): ensure read-only property is valued so the compound - // observer will fire - if (this.focused === undefined) { - this._setFocused(false); - } this.addEventListener('focus', this._boundFocusBlurHandler, true); this.addEventListener('blur', this._boundFocusBlurHandler, true); }, @@ -75,7 +70,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN var focused = event.type === 'focus'; this._setFocused(focused); } else if (!this.shadowRoot) { - event.stopPropagation(); this.fire(event.type, {sourceEvent: event}, { node: this, bubbles: event.bubbles, diff --git a/dashboard-ui/bower_components/iron-behaviors/test/focused-state.html b/dashboard-ui/bower_components/iron-behaviors/test/focused-state.html index 2d3af69b32..ace7a113c5 100644 --- a/dashboard-ui/bower_components/iron-behaviors/test/focused-state.html +++ b/dashboard-ui/bower_components/iron-behaviors/test/focused-state.html @@ -90,26 +90,22 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN focusable = fixture('NestedFocusedState'); }); - test('focus/blur events fired on host element', function(done) { + test('focus/blur events fired on host element', function() { var nFocusEvents = 0; var nBlurEvents = 0; + focusable.addEventListener('focus', function() { nFocusEvents += 1; - // setTimeout to wait for potentially more, erroneous events - setTimeout(function() { - assert.equal(nFocusEvents, 1, 'one focus event fired'); - MockInteractions.blur(focusable.$.input); - }); + MockInteractions.blur(focusable.$.input); }); focusable.addEventListener('blur', function() { nBlurEvents += 1; - // setTimeout to wait for potentially more, erroneous events - setTimeout(function() { - assert.equal(nBlurEvents, 1, 'one blur event fired'); - done(); - }); }); + MockInteractions.focus(focusable.$.input); + + expect(nBlurEvents).to.be.greaterThan(0); + expect(nFocusEvents).to.be.greaterThan(0); }); }); diff --git a/dashboard-ui/bower_components/iron-flex-layout/.bower.json b/dashboard-ui/bower_components/iron-flex-layout/.bower.json index 98650a2547..cfb5824840 100644 --- a/dashboard-ui/bower_components/iron-flex-layout/.bower.json +++ b/dashboard-ui/bower_components/iron-flex-layout/.bower.json @@ -23,14 +23,14 @@ "paper-styles": "polymerelements/paper-styles#^1.0.0", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, - "homepage": "https://github.com/PolymerElements/iron-flex-layout", + "homepage": "https://github.com/polymerelements/iron-flex-layout", "_release": "1.0.2", "_resolution": { "type": "version", "tag": "v1.0.2", "commit": "50bcecf40ab23caa7c2cd90030555e00c5ba7154" }, - "_source": "git://github.com/PolymerElements/iron-flex-layout.git", + "_source": "git://github.com/polymerelements/iron-flex-layout.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/iron-flex-layout" + "_originalSource": "polymerelements/iron-flex-layout" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-meta/.bower.json b/dashboard-ui/bower_components/iron-meta/.bower.json index 9e650790be..8119ebcf41 100644 --- a/dashboard-ui/bower_components/iron-meta/.bower.json +++ b/dashboard-ui/bower_components/iron-meta/.bower.json @@ -25,14 +25,14 @@ "web-component-tester": "*", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, - "homepage": "https://github.com/PolymerElements/iron-meta", + "homepage": "https://github.com/polymerelements/iron-meta", "_release": "1.0.3", "_resolution": { "type": "version", "tag": "v1.0.3", "commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04" }, - "_source": "git://github.com/PolymerElements/iron-meta.git", + "_source": "git://github.com/polymerelements/iron-meta.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/iron-meta" + "_originalSource": "polymerelements/iron-meta" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-validatable-behavior/.bower.json b/dashboard-ui/bower_components/iron-validatable-behavior/.bower.json index b8bd6b35c8..d5166173d4 100644 --- a/dashboard-ui/bower_components/iron-validatable-behavior/.bower.json +++ b/dashboard-ui/bower_components/iron-validatable-behavior/.bower.json @@ -1,6 +1,6 @@ { "name": "iron-validatable-behavior", - "version": "1.0.3", + "version": "1.0.4", "description": "Provides a behavior for an element that validates user input", "authors": "The Polymer Authors", "keywords": [ @@ -32,11 +32,11 @@ "web-component-tester": "*", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, - "_release": "1.0.3", + "_release": "1.0.4", "_resolution": { "type": "version", - "tag": "v1.0.3", - "commit": "714ac9f09f9d7d5f6f792a38bb15970adaacb264" + "tag": "v1.0.4", + "commit": "ff267b561b032608755d705c1a7e346454b0aee4" }, "_source": "git://github.com/PolymerElements/iron-validatable-behavior.git", "_target": "^1.0.0", diff --git a/dashboard-ui/bower_components/iron-validatable-behavior/bower.json b/dashboard-ui/bower_components/iron-validatable-behavior/bower.json index 8522d532aa..2dac6f9467 100644 --- a/dashboard-ui/bower_components/iron-validatable-behavior/bower.json +++ b/dashboard-ui/bower_components/iron-validatable-behavior/bower.json @@ -1,6 +1,6 @@ { "name": "iron-validatable-behavior", - "version": "1.0.3", + "version": "1.0.4", "description": "Provides a behavior for an element that validates user input", "authors": "The Polymer Authors", "keywords": [ diff --git a/dashboard-ui/bower_components/iron-validatable-behavior/iron-validatable-behavior.html b/dashboard-ui/bower_components/iron-validatable-behavior/iron-validatable-behavior.html index a264668ec9..e79047723c 100644 --- a/dashboard-ui/bower_components/iron-validatable-behavior/iron-validatable-behavior.html +++ b/dashboard-ui/bower_components/iron-validatable-behavior/iron-validatable-behavior.html @@ -16,7 +16,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN /** * Use `Polymer.IronValidatableBehavior` to implement an element that validates user input. * - * ### Accessiblity + * ### Accessibility * * Changing the `invalid` property, either manually or by calling `validate()` will update the * `aria-invalid` attribute. @@ -87,19 +87,35 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN }, /** - * @param {Object} values Passed to the validator's `validate()` function. - * @return {boolean} True if `values` is valid. + * Returns true if the `value` is valid, and updates `invalid`. If you want + * your element to have custom validation logic, do not override this method; + * override `_getValidity(value)` instead. + + * @param {Object} value The value to be validated. By default, it is passed + * to the validator's `validate()` function, if a validator is set. + * @return {boolean} True if `value` is valid. */ - validate: function(values) { - var valid = true; + validate: function(value) { + this.invalid = !this._getValidity(value); + return !this.invalid; + }, + + /** + * Returns true if `value` is valid. By default, it is passed + * to the validator's `validate()` function, if a validator is set. You + * should override this method if you want to implement custom validity + * logic for your element. + * + * @param {Object} value The value to be validated. + * @return {boolean} True if `value` is valid. + */ + + _getValidity: function(value) { if (this.hasValidator()) { - valid = this._validator.validate(values); + return this._validator.validate(value); } - - this.invalid = !valid; - return valid; + return true; } - }; diff --git a/dashboard-ui/bower_components/paper-input/.bower.json b/dashboard-ui/bower_components/paper-input/.bower.json index a9c80b86f2..99963c6684 100644 --- a/dashboard-ui/bower_components/paper-input/.bower.json +++ b/dashboard-ui/bower_components/paper-input/.bower.json @@ -1,6 +1,6 @@ { "name": "paper-input", - "version": "1.0.9", + "version": "1.0.10", "description": "Material design text fields", "authors": [ "The Polymer Authors" @@ -44,11 +44,11 @@ "iron-icon": "PolymerElements/iron-icon#^1.0.0", "paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0" }, - "_release": "1.0.9", + "_release": "1.0.10", "_resolution": { "type": "version", - "tag": "v1.0.9", - "commit": "39ab833e7597fabfac9ff98d4825a6ae7b3c89c4" + "tag": "v1.0.10", + "commit": "902279329e0259de5487d6f1fa1f438be0e0802e" }, "_source": "git://github.com/PolymerElements/paper-input.git", "_target": "^1.0.0", diff --git a/dashboard-ui/bower_components/paper-input/bower.json b/dashboard-ui/bower_components/paper-input/bower.json index 66084e20a6..71a0849d01 100644 --- a/dashboard-ui/bower_components/paper-input/bower.json +++ b/dashboard-ui/bower_components/paper-input/bower.json @@ -1,6 +1,6 @@ { "name": "paper-input", - "version": "1.0.9", + "version": "1.0.10", "description": "Material design text fields", "authors": [ "The Polymer Authors" diff --git a/dashboard-ui/bower_components/paper-input/paper-input-behavior.html b/dashboard-ui/bower_components/paper-input/paper-input-behavior.html index 685d10a43e..2c2b42bc59 100644 --- a/dashboard-ui/bower_components/paper-input/paper-input-behavior.html +++ b/dashboard-ui/bower_components/paper-input/paper-input-behavior.html @@ -109,14 +109,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN value: false }, - /** - * The maximum length of the input value. Bind this to the ``'s - * `maxlength` property. - */ - maxlength: { - type: Number - }, - /** * The error message to display when the input is invalid. Bind this to the * ``'s content, if using. @@ -199,6 +191,39 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN type: Number }, + /** + * The maximum length of the input value. Bind this to the ``'s + * `maxlength` property. + */ + maxlength: { + type: Number + }, + + /** + * The minimum (numeric or date-time) input value. + * Bind this to the ``'s `min` property. + */ + min: { + type: String + }, + + /** + * The maximum (numeric or date-time) input value. + * Can be a String (e.g. `"2000-1-1"`) or a Number (e.g. `2`). + * Bind this to the ``'s `max` property. + */ + max: { + type: String + }, + + /** + * Limits the numeric or date-time increments. + * Bind this to the ``'s `step` property. + */ + step: { + type: String + }, + /** * Bind this to the ``'s `name` property. */ diff --git a/dashboard-ui/bower_components/paper-input/paper-input.html b/dashboard-ui/bower_components/paper-input/paper-input.html index ea31fbf073..39a3aa571a 100644 --- a/dashboard-ui/bower_components/paper-input/paper-input.html +++ b/dashboard-ui/bower_components/paper-input/paper-input.html @@ -93,12 +93,15 @@ style this element. validator="[[validator]]" type$="[[type]]" pattern$="[[pattern]]" - maxlength$="[[maxlength]]" required$="[[required]]" autocomplete$="[[autocomplete]]" autofocus$="[[autofocus]]" inputmode$="[[inputmode]]" minlength$="[[minlength]]" + maxlength$="[[maxlength]]" + min$="[[min]]" + max$="[[max]]" + step$="[[step]]" name$="[[name]]" placeholder$="[[placeholder]]" readonly$="[[readonly]]" diff --git a/dashboard-ui/bower_components/paper-input/test/paper-input.html b/dashboard-ui/bower_components/paper-input/test/paper-input.html index 91390712f3..e0bb3a6cf8 100644 --- a/dashboard-ui/bower_components/paper-input/test/paper-input.html +++ b/dashboard-ui/bower_components/paper-input/test/paper-input.html @@ -176,26 +176,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN input = fixture('basic'); }); - test('focus/blur events fired on host element', function(done) { + test('focus/blur events fired on host element', function() { var nFocusEvents = 0; var nBlurEvents = 0; - input.addEventListener('focus', function() { + input.addEventListener('focus', function(event) { nFocusEvents += 1; - // setTimeout to wait for potentially more, erroneous events - setTimeout(function() { - assert.equal(nFocusEvents, 1, 'one focus event fired'); - MockInteractions.blur(input.inputElement); - }); + assert(input.focused, 'input is focused'); + MockInteractions.blur(input.inputElement); }); input.addEventListener('blur', function() { nBlurEvents += 1; - // setTimeout to wait for potentially more, erroneous events - setTimeout(function() { - assert.equal(nBlurEvents, 1, 'one blur event fired'); - done(); - }); + assert(!input.focused, 'input is blurred'); }); MockInteractions.focus(input.inputElement); + assert.isTrue(nFocusEvents >= 1, 'focus event fired'); + assert.isTrue(nBlurEvents >= 1, 'blur event fired'); }); }); diff --git a/dashboard-ui/bower_components/paper-input/test/paper-textarea.html b/dashboard-ui/bower_components/paper-input/test/paper-textarea.html index 1a4e223301..3a4ec33997 100644 --- a/dashboard-ui/bower_components/paper-input/test/paper-textarea.html +++ b/dashboard-ui/bower_components/paper-input/test/paper-textarea.html @@ -138,20 +138,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN input = fixture('basic'); }); - test('focus/blur events fired on host element', function(done) { + test('focus/blur events fired on host element', function() { var nFocusEvents = 0; var nBlurEvents = 0; input.addEventListener('focus', function(event) { nFocusEvents += 1; + assert(input.focused, 'input is focused'); MockInteractions.blur(input.inputElement.textarea); }); input.addEventListener('blur', function() { nBlurEvents += 1; - assert.isTrue(nFocusEvents >= 1, 'focus event fired'); - assert.isTrue(nBlurEvents >= 1, 'blur event fired'); - done(); + assert(!input.focused, 'input is blurred'); }); MockInteractions.focus(input.inputElement.textarea); + assert.isTrue(nFocusEvents >= 1, 'focus event fired'); + assert.isTrue(nBlurEvents >= 1, 'blur event fired') }); }); diff --git a/dashboard-ui/scripts/globalize.js b/dashboard-ui/scripts/globalize.js index 3347838d34..72109ab4f9 100644 --- a/dashboard-ui/scripts/globalize.js +++ b/dashboard-ui/scripts/globalize.js @@ -50,11 +50,28 @@ var currentCulture = 'en-US'; function setCulture(value) { + Logger.log('Setting culture to ' + value); + currentCulture = value; return $.when(loadDictionary('html', value), loadDictionary('javascript', value)); } + function normalizeLocaleName(culture) { + + culture = culture.replace('_', '-'); + + // If it's de-DE, convert to just de + var parts = culture.split('-'); + if (parts.length == 2) { + if (parts[0].toLowerCase() == parts[1].toLowerCase()) { + culture = parts[0].toLowerCase(); + } + } + + return culture; + } + function getDeviceCulture() { var deferred = DeferredBuilder.Deferred(); @@ -62,9 +79,11 @@ if (navigator.globalization && navigator.globalization.getLocaleName) { + Logger.log('Calling navigator.globalization.getLocaleName'); + navigator.globalization.getLocaleName(function (locale) { - culture = (locale.value || '').replace('_', '-'); + culture = normalizeLocaleName(locale.value || ''); Logger.log('Device culture is ' + culture); deferred.resolveWith(null, [culture]); @@ -79,12 +98,12 @@ Logger.log('AppInfo.supportsUserDisplayLanguageSetting is true'); - culture = document.documentElement.getAttribute('data-culture'); + culture = AppSettings.displayLanguage(); deferred.resolveWith(null, [culture]); } else { - Logger.log('navigator.globalization.getLocaleName is unavailable'); + Logger.log('Getting culture from document'); culture = document.documentElement.getAttribute('data-culture'); deferred.resolveWith(null, [culture]); @@ -96,6 +115,8 @@ function ensure() { + Logger.log('Entering Globalize.ensure'); + var deferred = DeferredBuilder.Deferred(); getDeviceCulture().done(function (culture) { diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 488163e702..556a29f4c0 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -2070,7 +2070,7 @@ var AppInfo = {}; deps.push('appstorage'); - require([deps], function () { + require(deps, function () { capabilities.DeviceProfile = MediaPlayer.getDeviceProfile(Math.max(screen.height, screen.width)); createConnectionManager(capabilities).done(function () { onConnectionManagerCreated(deferred); });