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
|
@ -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