mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update collection menus
This commit is contained in:
parent
65442321a0
commit
8119b930e4
17 changed files with 183 additions and 52 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-media-query",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "Lets you bind to a CSS media query",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
@ -28,11 +28,11 @@
|
|||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "1.0.2",
|
||||
"_release": "1.0.3",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.2",
|
||||
"commit": "34abf0a3b8bf9e9e478352dbb3d9e6a76bf3669a"
|
||||
"tag": "v1.0.3",
|
||||
"commit": "80e921f58e7688a840a0cf29e9e2aaaee72a66b2"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-media-query.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-media-query",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "Lets you bind to a CSS media query",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
|
|
@ -48,23 +48,47 @@ Example:
|
|||
query: {
|
||||
type: String,
|
||||
observer: 'queryChanged'
|
||||
},
|
||||
|
||||
_boundMQHandler: {
|
||||
value: function() {
|
||||
return this.queryHandler.bind(this);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
created: function() {
|
||||
this._mqHandler = this.queryHandler.bind(this);
|
||||
attached: function() {
|
||||
this.queryChanged();
|
||||
},
|
||||
|
||||
queryChanged: function(query) {
|
||||
detached: function() {
|
||||
this._remove();
|
||||
},
|
||||
|
||||
_add: function() {
|
||||
if (this._mq) {
|
||||
this._mq.removeListener(this._mqHandler);
|
||||
this._mq.addListener(this._boundMQHandler);
|
||||
}
|
||||
},
|
||||
|
||||
_remove: function() {
|
||||
if (this._mq) {
|
||||
this._mq.removeListener(this._boundMQHandler);
|
||||
}
|
||||
this._mq = null;
|
||||
},
|
||||
|
||||
queryChanged: function() {
|
||||
this._remove();
|
||||
var query = this.query;
|
||||
if (!query) {
|
||||
return;
|
||||
}
|
||||
if (query[0] !== '(') {
|
||||
query = '(' + query + ')';
|
||||
}
|
||||
this._mq = window.matchMedia(query);
|
||||
this._mq.addListener(this._mqHandler);
|
||||
this._add();
|
||||
this.queryHandler(this._mq);
|
||||
},
|
||||
|
||||
|
|
|
@ -61,6 +61,42 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
assert.equal(mq.queryMatches, true);
|
||||
});
|
||||
|
||||
test('automatically wrap with parens', function() {
|
||||
mq.query = 'min-width: 1px';
|
||||
assert.equal(mq.queryMatches, true);
|
||||
});
|
||||
|
||||
suite('query does not activate on empty string or null', function() {
|
||||
|
||||
test('empty string', function() {
|
||||
mq.query = '';
|
||||
assert.notOk(mq._mq);
|
||||
});
|
||||
|
||||
test('null', function() {
|
||||
mq.query = null;
|
||||
assert.notOk(mq._mq);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
test('media query destroys on detach', function() {
|
||||
mq.query = '(max-width: 800px)';
|
||||
mq.parentNode.removeChild(mq);
|
||||
Polymer.dom.flush();
|
||||
assert.notOk(mq._mq);
|
||||
});
|
||||
|
||||
test('media query re-enables on attach', function() {
|
||||
mq.query = '(max-width: 800px)';
|
||||
var parent = mq.parentNode;
|
||||
parent.removeChild(mq);
|
||||
Polymer.dom.flush();
|
||||
parent.appendChild(mq);
|
||||
Polymer.dom.flush();
|
||||
assert.ok(mq._mq);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-selector",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"description": "Manages a set of elements that can be selected",
|
||||
"private": true,
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
|
@ -32,11 +32,11 @@
|
|||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "1.0.6",
|
||||
"_release": "1.0.7",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.6",
|
||||
"commit": "08fa18c70b79abdee8a02486223ab9a4f0acc72c"
|
||||
"tag": "v1.0.7",
|
||||
"commit": "0b2f484ac3b1b03400da2d38b0f543f3688150a4"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-selector.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-selector",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"description": "Manages a set of elements that can be selected",
|
||||
"private": true,
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
|
|
|
@ -128,6 +128,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
created: function() {
|
||||
this._bindFilterItem = this._filterItem.bind(this);
|
||||
this._selection = new Polymer.IronSelection(this._applySelection.bind(this));
|
||||
// TODO(cdata): When polymer/polymer#2535 lands, we do not need to do this
|
||||
// book keeping anymore:
|
||||
this.__listeningForActivate = false;
|
||||
},
|
||||
|
||||
attached: function() {
|
||||
|
@ -136,6 +139,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
if (!this.selectedItem && this.selected) {
|
||||
this._updateSelected(this.attrForSelected,this.selected)
|
||||
}
|
||||
this._addListener(this.activateEvent);
|
||||
},
|
||||
|
||||
detached: function() {
|
||||
|
@ -202,11 +206,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
},
|
||||
|
||||
_addListener: function(eventName) {
|
||||
if (!this.isAttached || this.__listeningForActivate) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.__listeningForActivate = true;
|
||||
this.listen(this, eventName, '_activateHandler');
|
||||
},
|
||||
|
||||
_removeListener: function(eventName) {
|
||||
this.unlisten(this, eventName, '_activateHandler');
|
||||
this.__listeningForActivate = false;
|
||||
},
|
||||
|
||||
_activateEventChanged: function(eventName, old) {
|
||||
|
|
|
@ -130,6 +130,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
assert.equal(s.selected, '0');
|
||||
});
|
||||
|
||||
test('activates after detach and re-attach', function() {
|
||||
// Detach and re-attach
|
||||
var parent = s.parentNode;
|
||||
parent.removeChild(s);
|
||||
parent.appendChild(s);
|
||||
|
||||
// select Item 2
|
||||
s.children[2].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
|
||||
assert.equal(s.selected, '2');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue