| Index: polymer_1.0.4/bower_components/iron-list/test/helpers.html
|
| diff --git a/polymer_1.0.4/bower_components/iron-list/test/helpers.html b/polymer_1.0.4/bower_components/iron-list/test/helpers.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e2844f5291712c9eff1b26d84265c3a08bd63644
|
| --- /dev/null
|
| +++ b/polymer_1.0.4/bower_components/iron-list/test/helpers.html
|
| @@ -0,0 +1,69 @@
|
| +<!--
|
| +@license
|
| +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
|
| +The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
| +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
| +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
|
| +-->
|
| +
|
| +<script>
|
| + function findElementInList(container, selector) {
|
| + var i = 0;
|
| + var children = container._children;
|
| + var ms = Polymer.DomApi.matchesSelector;
|
| + for (; i < children.length; i++) {
|
| + if (children[i].nodeType === Node.ELEMENT_NODE && ms.call(children[i], selector)) {
|
| + return children[i];
|
| + }
|
| + }
|
| + return null;
|
| + }
|
| +
|
| + function buildItem(index) {
|
| + return {
|
| + index: index
|
| + };
|
| + }
|
| +
|
| + function buildDataSet(size) {
|
| + var data = [];
|
| + while (data.length < size) {
|
| + data.push(buildItem(data.length));
|
| + }
|
| + return data;
|
| + }
|
| +
|
| + function simulateScroll(config, fn) {
|
| + var list = config.list;
|
| + var target = config.target;
|
| + var delay = config.delay || 1;
|
| + var contribution = config.contribution || 10;
|
| +
|
| + function scroll(dir, prevVal) {
|
| + list.scrollTop = list.scrollTop + dir;
|
| + if (list.scrollTop !== target && prevVal !== list.scrollTop) {
|
| + setTimeout(scroll.bind(null, dir, list.scrollTop), delay);
|
| + } else {
|
| + setTimeout(fn.bind(null, list.scrollTop), 100);
|
| + }
|
| + }
|
| +
|
| + if (list.scrollTop < target) {
|
| + scroll(Math.abs(contribution), -1);
|
| + } else if (list.scrollTop > target) {
|
| + scroll(-Math.abs(contribution), -1);
|
| + }
|
| + }
|
| +
|
| + function getFirstItemFromList(list) {
|
| + var listRect = list.getBoundingClientRect();
|
| + return document.elementFromPoint(listRect.left + 1, listRect.top + 1);
|
| + }
|
| +
|
| + function getLastItemFromList(list) {
|
| + var listRect = list.getBoundingClientRect();
|
| + return document.elementFromPoint(listRect.left + 1, listRect.top + listRect.height - 1);
|
| + }
|
| +</script>
|
|
|