Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: polymer_1.0.4/bower_components/iron-list/test/helpers.html

Issue 1264073002: Update polymer 1.0 install to pick up newly added elements. (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Update bower file to match actual versions. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>
« no previous file with comments | « polymer_1.0.4/bower_components/iron-list/test/basic.html ('k') | polymer_1.0.4/bower_components/iron-list/test/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698