mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update polymer
This commit is contained in:
parent
22a5e48860
commit
61d616c330
44 changed files with 447 additions and 156 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-selector",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"description": "Manages a set of elements that can be selected",
|
||||
"private": true,
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
|
@ -25,17 +25,18 @@
|
|||
"polymer": "Polymer/polymer#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.4",
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.4",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "1.0.4",
|
||||
"_release": "1.0.5",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.4",
|
||||
"commit": "2af8ee5b7cd489bca7d4689c563b82fd356a9534"
|
||||
"tag": "v1.0.5",
|
||||
"commit": "396ef93a5d3467810cec0328c53f09037d6ee8e1"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-selector.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-selector",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"description": "Manages a set of elements that can be selected",
|
||||
"private": true,
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
|
@ -25,8 +25,9 @@
|
|||
"polymer": "Polymer/polymer#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.4",
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.4",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
|
|
|
@ -103,9 +103,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
var i = this.selectedValues.indexOf(value);
|
||||
var unselected = i < 0;
|
||||
if (unselected) {
|
||||
this.selectedValues.push(value);
|
||||
this.push('selectedValues',value);
|
||||
} else {
|
||||
this.selectedValues.splice(i, 1);
|
||||
this.splice('selectedValues',i,1);
|
||||
}
|
||||
this._selection.setItemSelected(this._valueToItem(value), unselected);
|
||||
}
|
||||
|
|
|
@ -105,9 +105,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
},
|
||||
|
||||
/**
|
||||
* The set of excluded elements where the key is the `localName`
|
||||
* The set of excluded elements where the key is the `localName`
|
||||
* of the element that will be ignored from the item list.
|
||||
*
|
||||
* @type {object}
|
||||
* @default {template: 1}
|
||||
*/
|
||||
excludedLocalNames: {
|
||||
|
@ -132,6 +133,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
attached: function() {
|
||||
this._observer = this._observeItems(this);
|
||||
this._contentObserver = this._observeContent(this);
|
||||
if (!this.selectedItem && this.selected) {
|
||||
this._updateSelected(this.attrForSelected,this.selected)
|
||||
}
|
||||
},
|
||||
|
||||
detached: function() {
|
||||
|
|
|
@ -32,7 +32,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
* the selected item or undefined if there is no selection.
|
||||
*/
|
||||
get: function() {
|
||||
return this.multi ? this.selection : this.selection[0];
|
||||
return this.multi ? this.selection.slice() : this.selection[0];
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -165,6 +165,25 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
}, 1);
|
||||
});
|
||||
});
|
||||
|
||||
suite('dynamic selector', function() {
|
||||
test('selects dynamically added child automatically', function(done) {
|
||||
var selector = document.createElement('iron-selector');
|
||||
var child = document.createElement('div');
|
||||
|
||||
selector.selected = '0';
|
||||
child.textContent = 'Item 0';
|
||||
|
||||
Polymer.dom(selector).appendChild(child);
|
||||
document.body.appendChild(selector);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
assert.equal(child.className, 'iron-selected');
|
||||
document.body.removeChild(selector);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -20,6 +20,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
||||
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
|
||||
<link rel="import" href="../iron-selector.html">
|
||||
|
||||
<style>
|
||||
|
@ -43,6 +44,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<!--
|
||||
NOTE(cdata): Enable test-fixture when polymer/polymer#2495 is resolved
|
||||
-->
|
||||
<!--<test-fixture id="repeatedItems">
|
||||
<template>-->
|
||||
<iron-selector multi id="repeatedItems">
|
||||
<template is="dom-repeat" items='["foo", "bar", "baz"]'>
|
||||
<div>[[item]]</div>
|
||||
</template>
|
||||
<div>vim</div>
|
||||
</iron-selector>
|
||||
<!--</template>
|
||||
</test-fixture>-->
|
||||
|
||||
<script>
|
||||
|
||||
suite('multi', function() {
|
||||
|
@ -115,6 +130,39 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
assert.equal(deselectEventCounter, 1);
|
||||
});
|
||||
|
||||
test('fires selected-values-changed when selection changes', function() {
|
||||
var selectedValuesChangedEventCounter = 0;
|
||||
|
||||
s.addEventListener('selected-values-changed', function(e) {
|
||||
selectedValuesChangedEventCounter++;
|
||||
});
|
||||
|
||||
MockInteractions.tap(Polymer.dom(s).children[0]);
|
||||
MockInteractions.tap(Polymer.dom(s).children[0]);
|
||||
MockInteractions.tap(Polymer.dom(s).children[0]);
|
||||
|
||||
expect(selectedValuesChangedEventCounter);
|
||||
});
|
||||
|
||||
test('selects from items created by dom-repeat', function(done) {
|
||||
var selectEventCounter = 0;
|
||||
var firstChild;
|
||||
|
||||
s = document.querySelector('#repeatedItems');
|
||||
s.addEventListener('iron-select', function(e) {
|
||||
selectEventCounter++;
|
||||
});
|
||||
|
||||
// NOTE(cdata): I guess `dom-repeat` doesn't stamp synchronously..
|
||||
Polymer.Base.async(function() {
|
||||
firstChild = Polymer.dom(s).querySelector('div');
|
||||
MockInteractions.tap(firstChild);
|
||||
|
||||
assert.equal(s.selectedItems[0].textContent, 'foo');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
/* test('toggle multi from true to false', function() {
|
||||
// set selected
|
||||
s.selected = [0, 2];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue