From f6b3dd3b16f2c14f73ce00cb2ea31b953e613410 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 10 Aug 2015 20:14:15 -0400 Subject: [PATCH] update components --- .../iron-behaviors/.bower.json | 8 ++-- .../iron-behaviors/bower.json | 2 +- .../iron-behaviors/iron-button-state.html | 29 ++++++++++++--- .../iron-behaviors/test/active-state.html | 37 +++++++++++++++++++ .../iron-resizable-behavior/.bower.json | 6 +-- dashboard-ui/mysyncsettings.html | 7 +++- dashboard-ui/scripts/appsettings.js | 6 +-- dashboard-ui/scripts/mysyncsettings.js | 4 +- dashboard-ui/strings/html/server.json | 3 +- dashboard-ui/vulcanize-out.html | 29 ++++++++++++--- 10 files changed, 103 insertions(+), 28 deletions(-) diff --git a/dashboard-ui/bower_components/iron-behaviors/.bower.json b/dashboard-ui/bower_components/iron-behaviors/.bower.json index 8d2ddae93c..e794c358f5 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.6", + "version": "1.0.7", "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.6", + "_release": "1.0.7", "_resolution": { "type": "version", - "tag": "v1.0.6", - "commit": "9dad0f52150c887997045b8bbf2a82b2394b8a37" + "tag": "v1.0.7", + "commit": "033889b20c6b9ebb45a1ff153fbd667e153fe3f7" }, "_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 6b67af642f..0932f917f8 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.6", + "version": "1.0.7", "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 da2f0fee80..96a2bfa9f8 100644 --- a/dashboard-ui/bower_components/iron-behaviors/iron-button-state.html +++ b/dashboard-ui/bower_components/iron-behaviors/iron-button-state.html @@ -50,8 +50,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN type: Boolean, value: false, notify: true, - reflectToAttribute: true, - observer: '_activeChanged' + reflectToAttribute: true }, /** @@ -72,6 +71,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN receivedFocusFromKeyboard: { type: Boolean, readOnly: true + }, + + /** + * The aria attribute to be set if the button is a toggle and in the + * active state. + */ + ariaActiveAttribute: { + type: String, + value: 'aria-pressed', + observer: '_ariaActiveAttributeChanged' } }, @@ -82,7 +91,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN }, observers: [ - '_detectKeyboardFocus(focused)' + '_detectKeyboardFocus(focused)', + '_activeChanged(active, ariaActiveAttribute)' ], keyBindings: { @@ -180,11 +190,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN this._changedButtonState(); }, - _activeChanged: function(active) { + _ariaActiveAttributeChanged: function(value, oldValue) { + if (oldValue && oldValue != value && this.hasAttribute(oldValue)) { + this.removeAttribute(oldValue); + } + }, + + _activeChanged: function(active, ariaActiveAttribute) { if (this.toggles) { - this.setAttribute('aria-pressed', active ? 'true' : 'false'); + this.setAttribute(this.ariaActiveAttribute, + active ? 'true' : 'false'); } else { - this.removeAttribute('aria-pressed'); + this.removeAttribute(this.ariaActiveAttribute); } this._changedButtonState(); }, diff --git a/dashboard-ui/bower_components/iron-behaviors/test/active-state.html b/dashboard-ui/bower_components/iron-behaviors/test/active-state.html index 983df0e8a5..0fa6fdcf89 100644 --- a/dashboard-ui/bower_components/iron-behaviors/test/active-state.html +++ b/dashboard-ui/bower_components/iron-behaviors/test/active-state.html @@ -60,6 +60,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN MockInteractions.downAndUp(activeTarget, function() { try { expect(activeTarget.hasAttribute('active')).to.be.eql(true); + expect(activeTarget.hasAttribute('aria-pressed')).to.be.eql(true); + expect(activeTarget.getAttribute('aria-pressed')).to.be.eql('true'); done(); } catch (e) { done(e); @@ -72,6 +74,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN MockInteractions.downAndUp(activeTarget, function() { try { expect(activeTarget.hasAttribute('active')).to.be.eql(false); + expect(activeTarget.hasAttribute('aria-pressed')).to.be.eql(true); + expect(activeTarget.getAttribute('aria-pressed')).to.be.eql('false'); done(); } catch (e) { done(e); @@ -79,6 +83,39 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN }); }); }); + + test('the correct aria attribute is set', function(done) { + activeTarget.ariaActiveAttribute = 'aria-checked'; + MockInteractions.downAndUp(activeTarget, function() { + try { + expect(activeTarget.hasAttribute('active')).to.be.eql(true); + expect(activeTarget.hasAttribute('aria-checked')).to.be.eql(true); + expect(activeTarget.getAttribute('aria-checked')).to.be.eql('true'); + done(); + } catch (e) { + done(e); + } + }); + }); + + test('the aria attribute is updated correctly', function(done) { + activeTarget.ariaActiveAttribute = 'aria-checked'; + MockInteractions.downAndUp(activeTarget, function() { + try { + expect(activeTarget.hasAttribute('active')).to.be.eql(true); + expect(activeTarget.hasAttribute('aria-checked')).to.be.eql(true); + expect(activeTarget.getAttribute('aria-checked')).to.be.eql('true'); + + activeTarget.ariaActiveAttribute = 'aria-pressed'; + expect(activeTarget.hasAttribute('aria-checked')).to.be.eql(false); + expect(activeTarget.hasAttribute('aria-pressed')).to.be.eql(true); + expect(activeTarget.getAttribute('aria-pressed')).to.be.eql('true'); + done(); + } catch (e) { + done(e); + } + }); + }); }); }); diff --git a/dashboard-ui/bower_components/iron-resizable-behavior/.bower.json b/dashboard-ui/bower_components/iron-resizable-behavior/.bower.json index 1f0548f3d7..9ae5e84c7e 100644 --- a/dashboard-ui/bower_components/iron-resizable-behavior/.bower.json +++ b/dashboard-ui/bower_components/iron-resizable-behavior/.bower.json @@ -27,14 +27,14 @@ "web-component-tester": "*", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, - "homepage": "https://github.com/polymerelements/iron-resizable-behavior", + "homepage": "https://github.com/PolymerElements/iron-resizable-behavior", "_release": "1.0.2", "_resolution": { "type": "version", "tag": "v1.0.2", "commit": "85de8ba28be2bf17c81d6436ef1119022b003674" }, - "_source": "git://github.com/polymerelements/iron-resizable-behavior.git", + "_source": "git://github.com/PolymerElements/iron-resizable-behavior.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-resizable-behavior" + "_originalSource": "PolymerElements/iron-resizable-behavior" } \ No newline at end of file diff --git a/dashboard-ui/mysyncsettings.html b/dashboard-ui/mysyncsettings.html index 8671082d5c..48c2dae5e1 100644 --- a/dashboard-ui/mysyncsettings.html +++ b/dashboard-ui/mysyncsettings.html @@ -16,8 +16,11 @@

- ${OptionSyncToSDCard} - +
+ + +
${LabelSyncPathHelp}
+

diff --git a/dashboard-ui/scripts/appsettings.js b/dashboard-ui/scripts/appsettings.js index b47fff9f81..04269f6987 100644 --- a/dashboard-ui/scripts/appsettings.js +++ b/dashboard-ui/scripts/appsettings.js @@ -56,13 +56,13 @@ return appStorage.getItem('enableFullScreen') == 'true'; }, - enableSyncToExternalStorage: function (val) { + syncPath: function (val) { if (val != null) { - update('enableSyncToExternalStorage', val.toString()); + update('syncPath', val); } - return appStorage.getItem('enableSyncToExternalStorage') != 'false'; + return appStorage.getItem('syncPath'); }, displayLanguage: function (val) { diff --git a/dashboard-ui/scripts/mysyncsettings.js b/dashboard-ui/scripts/mysyncsettings.js index e79e71a875..a8e27fccb5 100644 --- a/dashboard-ui/scripts/mysyncsettings.js +++ b/dashboard-ui/scripts/mysyncsettings.js @@ -2,14 +2,14 @@ function loadForm(page, user) { - page.querySelector('.chkSyncToExternalCard').checked = AppSettings.enableSyncToExternalStorage(); + page.querySelector('#txtSyncPath').value = AppSettings.syncPath(); Dashboard.hideLoadingMsg(); } function saveUser(page, user) { - AppSettings.enableSyncToExternalStorage(page.querySelector('.chkSyncToExternalCard').checked); + AppSettings.syncPath(page.querySelector('#txtSyncPath').value); Dashboard.hideLoadingMsg(); Dashboard.alert(Globalize.translate('SettingsSaved')); } diff --git a/dashboard-ui/strings/html/server.json b/dashboard-ui/strings/html/server.json index cfdd286639..e04153e428 100644 --- a/dashboard-ui/strings/html/server.json +++ b/dashboard-ui/strings/html/server.json @@ -1517,5 +1517,6 @@ "LabelTranscodingThreadCount": "Transcoding thread count:", "LabelTranscodingThreadCountHelp": "Select the maximum number of threads to use when transcoding. Reducing the thread count will lower cpu usage but may not convert fast enough for a smooth playback experience.", "OptionMax": "Max", - "HeaderEmbyGuide": "Emby Guide" + "HeaderEmbyGuide": "Emby Guide", + "LabelSyncPath": "Sync path:" } diff --git a/dashboard-ui/vulcanize-out.html b/dashboard-ui/vulcanize-out.html index f9819d9e6d..69af14e389 100644 --- a/dashboard-ui/vulcanize-out.html +++ b/dashboard-ui/vulcanize-out.html @@ -6850,8 +6850,7 @@ this.fire('dom-change'); type: Boolean, value: false, notify: true, - reflectToAttribute: true, - observer: '_activeChanged' + reflectToAttribute: true }, /** @@ -6872,6 +6871,16 @@ this.fire('dom-change'); receivedFocusFromKeyboard: { type: Boolean, readOnly: true + }, + + /** + * The aria attribute to be set if the button is a toggle and in the + * active state. + */ + ariaActiveAttribute: { + type: String, + value: 'aria-pressed', + observer: '_ariaActiveAttributeChanged' } }, @@ -6882,7 +6891,8 @@ this.fire('dom-change'); }, observers: [ - '_detectKeyboardFocus(focused)' + '_detectKeyboardFocus(focused)', + '_activeChanged(active, ariaActiveAttribute)' ], keyBindings: { @@ -6980,11 +6990,18 @@ this.fire('dom-change'); this._changedButtonState(); }, - _activeChanged: function(active) { + _ariaActiveAttributeChanged: function(value, oldValue) { + if (oldValue && oldValue != value && this.hasAttribute(oldValue)) { + this.removeAttribute(oldValue); + } + }, + + _activeChanged: function(active, ariaActiveAttribute) { if (this.toggles) { - this.setAttribute('aria-pressed', active ? 'true' : 'false'); + this.setAttribute(this.ariaActiveAttribute, + active ? 'true' : 'false'); } else { - this.removeAttribute('aria-pressed'); + this.removeAttribute(this.ariaActiveAttribute); } this._changedButtonState(); },