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

Side by Side Diff: lib/src/iron-list/test/physical-count.html

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « lib/src/iron-list/test/mutations.html ('k') | lib/src/iron-list/test/smoke/avg-worst-case.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <!-- 2 <!--
3 @license 3 @license
4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 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 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 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 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 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 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS
10 --> 10 -->
(...skipping 10 matching lines...) Expand all
21 <link rel="import" href="../../test-fixture/test-fixture.html"> 21 <link rel="import" href="../../test-fixture/test-fixture.html">
22 <link rel="import" href="../../paper-styles/paper-styles.html"> 22 <link rel="import" href="../../paper-styles/paper-styles.html">
23 <link rel="import" href="helpers.html"> 23 <link rel="import" href="helpers.html">
24 <link rel="import" href="x-list.html"> 24 <link rel="import" href="x-list.html">
25 25
26 </head> 26 </head>
27 <body> 27 <body>
28 28
29 <test-fixture id="trivialList"> 29 <test-fixture id="trivialList">
30 <template> 30 <template>
31 <x-list item-height="1" list-height="40"></x-list> 31 <x-list item-height="2" list-height="300"></x-list>
32 </template> 32 </template>
33 </test-fixture> 33 </test-fixture>
34 34
35 <script> 35 <script>
36 36
37 suite('dynamic physical count', function() { 37 suite('dynamic physical count', function() {
38 var list, container; 38 var list, container;
39 39
40 setup(function() { 40 setup(function() {
41 container = fixture('trivialList'); 41 container = fixture('trivialList');
42 list = container.list; 42 list = container.list;
43 }); 43 });
44 44
45 test('increase pool size', function(done) { 45 test('increase pool size', function(done) {
46 list.items = buildDataSet(1000); 46 list.items = buildDataSet(1000);
47
47 flush(function() { 48 flush(function() {
48 var lastItem = getLastItemFromList(list); 49 var lastItem = getLastItemFromList(list);
49 var lastItemHeight = lastItem.offsetHeight; 50 var lastItemHeight = lastItem.offsetHeight;
50 var expectedFinalItem = list.offsetHeight/lastItemHeight; 51 var expectedFinalItem = list.offsetHeight/lastItemHeight;
51 52
52 assert.equal(lastItemHeight, 1); 53 assert.equal(lastItemHeight, 2);
53 assert.equal(getLastItemFromList(list).textContent, expectedFinalItem) ; 54 assert.equal(getLastItemFromList(list).textContent, expectedFinalItem) ;
54 done(); 55 done();
55 }); 56 });
56 }); 57 });
57 58
58 test('increase pool size on resize', function(done) { 59 test('increase pool size on resize', function(done) {
59 list.items = buildDataSet(1000); 60 list.items = buildDataSet(1000);
60 61
61 flush(function() { 62 flush(function() {
62 // change the height of the list 63 // change the height of the list
63 container.listHeight = 500; 64 container.listHeight = 500;
64 // resize 65 // resize
65 list.fire('resize'); 66 list.fire('iron-resize');
66 67
67 flush(function() { 68 flush(function() {
68 var lastItem = getLastItemFromList(list); 69 var lastItem = getLastItemFromList(list);
69 var lastItemHeight = lastItem.offsetHeight; 70 var lastItemHeight = lastItem.offsetHeight;
70 var expectedFinalItem = list.offsetHeight/lastItemHeight - 1; 71 var expectedFinalItem = list.offsetHeight/lastItemHeight;
71 72
72 assert.equal(lastItemHeight, 1); 73 assert.equal(lastItemHeight, 2);
73 assert.equal(getLastItemFromList(list).textContent, expectedFinalIte m); 74 assert.equal(getLastItemFromList(list).textContent, expectedFinalIte m);
74 done(); 75 done();
75 }); 76 });
76 }); 77 });
77 }); 78 });
78 79
79 }); 80 });
80 81
81 </script> 82 </script>
82 83
83 </body> 84 </body>
84 </html> 85 </html>
OLDNEW
« no previous file with comments | « lib/src/iron-list/test/mutations.html ('k') | lib/src/iron-list/test/smoke/avg-worst-case.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698