I_changed_another_theme

This commit is contained in:
2016-08-16 20:03:40 -04:00
parent 23434adfb0
commit 3d1bca5d8b
345 changed files with 47813 additions and 2571 deletions
+138
View File
@@ -0,0 +1,138 @@
<!doctype html>
<!--
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-selector-activate-event</title>
<meta charset="UTF-8">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../iron-selector.html">
<style>
.iron-selected {
background: #ccc;
}
</style>
</head>
<body>
<test-fixture id="test">
<template>
<iron-selector id="selector" selected="0">
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
<div>Item 4</div>
</iron-selector>
</template>
</test-fixture>
<script>
suite('activate event', function() {
var s;
setup(function () {
s = fixture('test');
});
test('activates on tap', function() {
assert.equal(s.selected, '0');
// select Item 1
s.children[1].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
assert.equal(s.selected, '1');
});
test('activates on tap and fires iron-activate', function(done) {
assert.equal(s.selected, '0');
// attach iron-activate listener
s.addEventListener("iron-activate", function(event) {
assert.equal(event.detail.selected, '1');
assert.equal(event.detail.item, s.children[1]);
done();
});
// select Item 1
s.children[1].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
});
test('tap on already selected and fires iron-activate', function(done) {
assert.equal(s.selected, '0');
// attach iron-activate listener
s.addEventListener("iron-activate", function(event) {
assert.equal(event.detail.selected, '0');
assert.equal(event.detail.item, s.children[0]);
done();
});
// select Item 0
s.children[0].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
});
test('activates on mousedown', function() {
// set activateEvent to mousedown
s.activateEvent = 'mousedown';
// select Item 2
s.children[2].dispatchEvent(new CustomEvent('mousedown', {bubbles: true}));
assert.equal(s.selected, '2');
});
test('activates on mousedown and fires iron-activate', function(done) {
// attach iron-activate listener
s.addEventListener("iron-activate", function(event) {
assert.equal(event.detail.selected, '2');
assert.equal(event.detail.item, s.children[2]);
done();
});
// set activateEvent to mousedown
s.activateEvent = 'mousedown';
// select Item 2
s.children[2].dispatchEvent(new CustomEvent('mousedown', {bubbles: true}));
});
test('no activation', function() {
assert.equal(s.selected, '0');
// set activateEvent to null
s.activateEvent = null;
// select Item 2
s.children[2].dispatchEvent(new CustomEvent('mousedown', {bubbles: true}));
assert.equal(s.selected, '0');
});
test('activates on tap and preventDefault', function() {
// attach iron-activate listener
s.addEventListener("iron-activate", function(event) {
event.preventDefault();
});
// select Item 2
s.children[2].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
// shouldn't got selected since we preventDefault in iron-activate
assert.equal(s.selected, '0');
});
});
</script>
</body>
</html>
+150
View File
@@ -0,0 +1,150 @@
<!doctype html>
<!--
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-selector-basic</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../iron-selector.html">
<style>
.iron-selected {
background: #ccc;
}
.my-selected {
background: red;
}
</style>
</head>
<body>
<test-fixture id="defaults">
<template>
<iron-selector>
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
<div>Item 4</div>
</iron-selector>
</template>
</test-fixture>
<br><br>
<test-fixture id="basic">
<template>
<iron-selector selected="item2" attr-for-selected="id">
<div id="item0">Item 0</div>
<div id="item1">Item 1</div>
<div id="item2">Item 2</div>
<div id="item3">Item 3</div>
<div id="item4">Item 4</div>
</iron-selector>
</template>
</test-fixture>
<script>
suite('defaults', function() {
var s1;
setup(function () {
s1 = fixture('defaults');
});
test('to nothing selected', function() {
assert.equal(s1.selected, null);
});
test('to iron-selected as selectedClass', function() {
assert.equal(s1.selectedClass, 'iron-selected');
});
test('to false as multi', function() {
assert.isFalse(s1.multi);
});
test('to tap as activateEvent', function() {
assert.equal(s1.activateEvent, 'tap');
});
test('to nothing as attrForSelected', function() {
assert.equal(s1.attrForSelected, null);
});
test('as many items as children', function() {
assert.equal(s1.items.length, s1.querySelectorAll('div').length);
});
});
suite('basic', function() {
var s2;
setup(function () {
s2 = fixture('basic');
});
test('honors the attrForSelected attribute', function() {
assert.equal(s2.attrForSelected, 'id');
assert.equal(s2.selected, 'item2');
assert.equal(s2.selectedItem, document.querySelector('#item2'));
});
test('allows assignment to selected', function() {
// set selected
s2.selected = 'item4';
// check selected class
assert.isTrue(s2.children[4].classList.contains('iron-selected'));
// check item
assert.equal(s2.selectedItem, s2.children[4]);
});
test('fire iron-select when selected is set', function() {
// setup listener for iron-select event
var selectedEventCounter = 0;
s2.addEventListener('iron-select', function(e) {
selectedEventCounter++;
});
// set selected
s2.selected = 'item4';
// check iron-select event
assert.equal(selectedEventCounter, 1);
});
test('set selected to old value', function() {
// setup listener for iron-select event
var selectedEventCounter = 0;
s2.addEventListener('iron-select', function(e) {
selectedEventCounter++;
});
// selecting the same value shouldn't fire iron-select
s2.selected = 'item2';
assert.equal(selectedEventCounter, 0);
});
});
</script>
</body>
</html>
@@ -0,0 +1,43 @@
<!--
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../iron-selector.html">
<dom-module id="test-content-element">
<template>
<iron-selector id="selector" selected="{{selected}}" selectable="[[selectable]]" attr-for-selected="id">
<content></content>
</iron-selector>
</template>
</dom-module>
<script>
Polymer({
is: 'test-content-element',
properties: {
selectable: String,
selected: {
type: String,
notify: true
}
}
});
</script>
+168
View File
@@ -0,0 +1,168 @@
<!doctype html>
<!--
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-selector-content</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="content-element.html">
<style>
.iron-selected {
background: #ccc;
}
</style>
</head>
<body>
<test-content-element id="selector1" selected="item0">
<div id="item0">item0</div>
<div id="item1">item1</div>
<div id="item2">item2</div>
<div id="item3">item3</div>
</test-content-element>
<test-content-element id="selector2" selected="item0" selectable="item">
<item id="item0">item0</item>
<hr>
<item id="item1">item1</item>
<item id="item2">item2</item>
<hr>
<item id="item3">item3</item>
</test-content-element>
<test-content-element id="selector3" selected="item0">
<template is="dom-repeat" id="t">
<div id$="[[item.name]]">[[item.name]]</div>
</template>
</test-content-element>
<script>
var s1 = document.querySelector('#selector1');
var s2 = document.querySelector('#selector2');
var s3 = document.querySelector('#selector3');
var t = document.querySelector('#t');
suite('content', function() {
test('attribute selected', function() {
// check selected class
assert.isTrue(s1.querySelector('#item0').classList.contains('iron-selected'));
});
test('set selected', function() {
// set selected
s1.selected = 'item1';
// check selected class
assert.isTrue(s1.querySelector('#item1').classList.contains('iron-selected'));
});
test('get items', function() {
assert.equal(s1.$.selector.items.length, 4);
});
test('activate event', function() {
var item = s1.querySelector('#item2');
item.dispatchEvent(new CustomEvent('tap', {bubbles: true}));
// check selected class
assert.isTrue(item.classList.contains('iron-selected'));
});
test('add item dynamically', function() {
var item = document.createElement('div');
item.id = 'item4';
item.textContent = 'item4';
Polymer.dom(s1).appendChild(item);
Polymer.dom.flush();
// set selected
s1.selected = 'item4';
// check items length
assert.equal(s1.$.selector.items.length, 5);
// check selected class
assert.isTrue(s1.querySelector('#item4').classList.contains('iron-selected'));
});
});
suite('content with selectable', function() {
test('attribute selected', function() {
// check selected class
assert.isTrue(s2.querySelector('#item0').classList.contains('iron-selected'));
});
test('set selected', function() {
// set selected
s2.selected = 'item1';
// check selected class
assert.isTrue(s2.querySelector('#item1').classList.contains('iron-selected'));
});
test('get items', function() {
assert.equal(s2.$.selector.items.length, 4);
});
test('activate event', function() {
var item = s2.querySelector('#item2');
item.dispatchEvent(new CustomEvent('tap', {bubbles: true}));
// check selected class
assert.isTrue(item.classList.contains('iron-selected'));
});
test('add item dynamically', function() {
var item = document.createElement('item');
item.id = 'item4';
item.textContent = 'item4';
Polymer.dom(s2).appendChild(item);
Polymer.dom.flush();
// set selected
s2.selected = 'item4';
// check items length
assert.equal(s2.$.selector.items.length, 5);
// check selected class
assert.isTrue(s2.querySelector('#item4').classList.contains('iron-selected'));
});
});
suite('content with dom-repeat', function() {
test('supports repeated children', function(done) {
t.items = [{name:'item0'}, {name: 'item1'}, {name: 'item2'}, {name: 'item3'}];
setTimeout(function() {
// check selected
assert.equal(s3.selected, 'item0');
// check selected class
assert.isTrue(s3.querySelector('#item0').classList.contains('iron-selected'));
// set selected
s3.selected = 'item2';
// check selected class
assert.isTrue(s3.querySelector('#item2').classList.contains('iron-selected'));
done();
});
});
});
</script>
</body>
</html>
+36
View File
@@ -0,0 +1,36 @@
<!doctype html>
<!--
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<meta charset="utf-8">
<title>Tests</title>
<script src="../../web-component-tester/browser.js"></script>
</head>
<body>
<script>
WCT.loadSuites([
'activate-event.html',
'basic.html',
'multi.html',
'next-previous.html',
'selected-attribute.html',
'template-repeat.html',
'content.html'
]);
</script>
</body>
</html>
+135
View File
@@ -0,0 +1,135 @@
<!doctype html>
<!--
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-selector-multi</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../iron-selector.html">
<style>
.iron-selected {
background: #ccc;
}
</style>
</head>
<body>
<test-fixture id="test">
<template>
<iron-selector multi>
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
<div>Item 4</div>
</iron-selector>
</template>
</test-fixture>
<script>
suite('multi', function() {
var s;
setup(function () {
s = fixture('test');
});
test('honors the multi attribute', function() {
assert.isTrue(s.multi);
});
test('has sane defaults', function() {
assert.equal(s.selectedValues, undefined);
assert.equal(s.selectedClass, 'iron-selected');
assert.equal(s.items.length, 5);
});
test('set multi-selection via selected property', function() {
// set selectedValues
s.selectedValues = [0, 2];
// check selected class
assert.isTrue(s.children[0].classList.contains('iron-selected'));
assert.isTrue(s.children[2].classList.contains('iron-selected'));
// check selectedItems
assert.equal(s.selectedItems.length, 2);
assert.equal(s.selectedItems[0], s.children[0]);
assert.equal(s.selectedItems[1], s.children[2]);
});
test('set multi-selection via tap', function() {
// set selectedValues
s.children[0].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
s.children[2].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
// check selected class
assert.isTrue(s.children[0].classList.contains('iron-selected'));
assert.isTrue(s.children[2].classList.contains('iron-selected'));
// check selectedItems
assert.equal(s.selectedItems.length, 2);
assert.equal(s.selectedItems[0], s.children[0]);
assert.equal(s.selectedItems[1], s.children[2]);
});
test('fire iron-select/deselect events', function() {
// setup listener for iron-select event
var selectEventCounter = 0;
s.addEventListener('iron-select', function(e) {
selectEventCounter++;
});
// setup listener for core-deselect event
var deselectEventCounter = 0;
s.addEventListener('iron-deselect', function(e) {
deselectEventCounter++;
});
// tap to select an item
s.children[0].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
// check events
assert.equal(selectEventCounter, 1);
assert.equal(deselectEventCounter, 0);
// tap on already selected item should deselect it
s.children[0].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
// check selectedValues
assert.equal(s.selectedValues.length, 0);
// check class
assert.isFalse(s.children[0].classList.contains('iron-selected'));
// check events
assert.equal(selectEventCounter, 1);
assert.equal(deselectEventCounter, 1);
});
/* test('toggle multi from true to false', function() {
// set selected
s.selected = [0, 2];
var first = s.selected[0];
// set mutli to false, so to make it single-selection
s.multi = false;
// selected should not be an array
assert.isNotArray(s.selected);
// selected should be the first value from the old array
assert.equal(s.selected, first);
}); */
});
</script>
</body>
</html>
+134
View File
@@ -0,0 +1,134 @@
<!doctype html>
<!--
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-selector-next-previous</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../iron-selector.html">
<style>
.iron-selected {
background: #ccc;
}
</style>
</head>
<body>
<test-fixture id="test1">
<template>
<iron-selector selected="0">
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
</iron-selector>
</template>
</test-fixture>
<test-fixture id="test2">
<template>
<iron-selector selected="foo" attr-for-selected="name">
<div name="foo">Item Foo</div>
<div name="bar">Item Bar</div>
<div name="zot">Item Zot</div>
</iron-selector>
</template>
</test-fixture>
<script>
var s;
function assertAndSelect(method, expectedIndex) {
assert.equal(s.selected, expectedIndex);
s[method]();
}
suite('next/previous', function() {
setup(function () {
s = fixture('test1');
});
test('selectNext', function() {
assert.equal(s.selected, 0);
assertAndSelect('selectNext', 0);
assertAndSelect('selectNext', 1);
assertAndSelect('selectNext', 2);
assert.equal(s.selected, 0);
});
test('selectPrevious', function() {
assert.equal(s.selected, 0);
assertAndSelect('selectPrevious', 0);
assertAndSelect('selectPrevious', 2);
assertAndSelect('selectPrevious', 1);
assert.equal(s.selected, 0);
});
test('selectNext/Previous', function() {
assert.equal(s.selected, 0);
assertAndSelect('selectNext', 0);
assertAndSelect('selectNext', 1);
assertAndSelect('selectPrevious', 2);
assertAndSelect('selectNext', 1);
assertAndSelect('selectPrevious', 2);
assert.equal(s.selected, 1);
});
});
suite('next/previous attrForSelected', function() {
setup(function () {
s = fixture('test2');
});
test('selectNext', function() {
assert.equal(s.selected, 'foo');
assertAndSelect('selectNext', 'foo');
assertAndSelect('selectNext', 'bar');
assertAndSelect('selectNext', 'zot');
assert.equal(s.selected, 'foo');
});
test('selectPrevious', function() {
assert.equal(s.selected, 'foo');
assertAndSelect('selectPrevious', 'foo');
assertAndSelect('selectPrevious', 'zot');
assertAndSelect('selectPrevious', 'bar');
assert.equal(s.selected, 'foo');
});
test('selectNext/Previous', function() {
assert.equal(s.selected, 'foo');
assertAndSelect('selectNext', 'foo');
assertAndSelect('selectNext', 'bar');
assertAndSelect('selectPrevious', 'zot');
assertAndSelect('selectNext', 'bar');
assertAndSelect('selectPrevious', 'zot');
assert.equal(s.selected, 'bar');
});
});
</script>
</body>
</html>
@@ -0,0 +1,72 @@
<!doctype html>
<!--
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-selector-selected-attribute</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../iron-selector.html">
<style>
.iron-selected {
background: #ccc;
}
</style>
</head>
<body>
<test-fixture id="test">
<template>
<iron-selector id="selector">
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
<div>Item 4</div>
</iron-selector>
</template>
</test-fixture>
<script>
suite('selected attributes', function() {
var s;
setup(function () {
s = fixture('test');
});
test('custom selectedAttribute', function() {
// set selectedAttribute
s.selectedAttribute = 'myattr';
// check selected attribute (should not be there)
assert.isFalse(s.children[4].hasAttribute('myattr'));
// set selected
s.selected = 4;
// now selected attribute should be there
assert.isTrue(s.children[4].hasAttribute('myattr'));
});
});
</script>
</body>
</html>
+110
View File
@@ -0,0 +1,110 @@
<!doctype html>
<!--
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-selector-template-repeat</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../iron-selector.html">
<style>
.iron-selected {
background: #ccc;
}
</style>
</head>
<body>
<template is="dom-bind">
<iron-selector id="selector" selected="1">
<template id="t" is="dom-repeat">
<div id$="[[item.name]]">{{item.name}}</div>
</template>
</iron-selector>
</template>
<script>
suite('dom-repeat', function() {
var scope, s, t;
setup(function() {
scope = document.querySelector('template[is="dom-bind"]');
s = scope.$.selector;
t = scope.$.t;
t.items = [{name:'item0'}, {name: 'item1'}, {name: 'item2'}, {name: 'item3'}];
});
teardown(function() {
t.items = [];
});
test('supports repeated items', function(done) {
setTimeout(function() {
// check items
assert.equal(s.items.length, 4);
// check selected
assert.equal(s.selected, 1);
// check selected item
var item = s.selectedItem;
assert.equal(s.items[1], item);
// check selected class
assert.isTrue(item.classList.contains('iron-selected'));
done();
});
});
test('update items', function(done) {
setTimeout(function() {
// check items
assert.equal(s.items.length, 4);
// check selected
assert.equal(s.selected, 1);
// update items
t.items = [{name:'foo'}, {name: 'bar'}];
setTimeout(function() {
// check items
assert.equal(s.items.length, 2);
// check selected (should still honor the selected)
assert.equal(s.selected, 1);
// check selected class
assert.isTrue(s.querySelector('#bar').classList.contains('iron-selected'));
done();
});
});
});
test('set selected to something else', function(done) {
setTimeout(function() {
// set selected to something else
s.selected = 3;
// check selected item
var item = s.selectedItem;
assert.equal(s.items[3], item);
// check selected class
assert.isTrue(item.classList.contains('iron-selected'));
done();
});
});
});
</script>
</body>
</html>