OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 @license |
| 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE |
| 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS |
| 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS |
| 8 Code distributed by Google as part of the polymer project is also |
| 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS |
| 10 --> |
| 11 <html> |
| 12 <head> |
| 13 <meta charset="UTF-8"> |
| 14 <title>iron-list test</title> |
| 15 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-
scale=1.0"> |
| 16 |
| 17 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 18 <script src="../../web-component-tester/browser.js"></script> |
| 19 <script src="../../test-fixture/test-fixture-mocha.js"></script> |
| 20 |
| 21 <link rel="import" href="helpers.html"> |
| 22 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 23 <link rel="import" href="../iron-list.html"> |
| 24 </head> |
| 25 <body> |
| 26 |
| 27 <test-fixture id="trivialList"> |
| 28 <template> |
| 29 <template is="dom-bind"> |
| 30 <style> |
| 31 :host { |
| 32 @apply(--layout-fit); |
| 33 @apply(--layout-vertical); |
| 34 |
| 35 display: block; |
| 36 } |
| 37 |
| 38 iron-list { |
| 39 height: 300px; |
| 40 } |
| 41 |
| 42 .item { |
| 43 color: white; |
| 44 height: 1px; |
| 45 overflow: hidden; |
| 46 } |
| 47 |
| 48 .item:nth-child(odd) { |
| 49 background-color: green; |
| 50 } |
| 51 |
| 52 .item:nth-child(even) { |
| 53 background-color: red; |
| 54 } |
| 55 </style> |
| 56 <iron-list items="[[data]]" as="item"> |
| 57 <template> |
| 58 <div class="item">[[item.index]]</div> |
| 59 </template> |
| 60 </iron-list> |
| 61 </template> |
| 62 </template> |
| 63 </test-fixture> |
| 64 |
| 65 <script> |
| 66 |
| 67 suite('dynamic physical count', function() { |
| 68 var list, container; |
| 69 |
| 70 setup(function() { |
| 71 container = fixture('trivialList'); |
| 72 list = findElementInList(container, 'iron-list'); |
| 73 }); |
| 74 |
| 75 test('increase pool size', function(done) { |
| 76 list.items = buildDataSet(1000); |
| 77 flush(function() { |
| 78 var lastItem = getLastItemFromList(list); |
| 79 var lastItemHeight = lastItem.offsetHeight; |
| 80 var expectedFinalItem = list.offsetHeight/lastItemHeight - 1; |
| 81 assert.equal(getLastItemFromList(list).textContent, expectedFinalItem)
; |
| 82 done(); |
| 83 }); |
| 84 }); |
| 85 }); |
| 86 |
| 87 </script> |
| 88 |
| 89 </body> |
| 90 </html> |
OLD | NEW |