Blame view

bower_components/iron-list/test/smoke/avg-worst-case.html 2.88 KB
f748e9cf   Luigi Serra   new controllet an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  <!--

  @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.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

  -->

  

  <!doctype html>

  <html>

  <head>

  

    <title>avg worst case</title>

  

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">

    <meta name="mobile-web-app-capable" content="yes">

    <meta name="apple-mobile-web-app-capable" content="yes">

  

    <script src="../../../webcomponentsjs/webcomponents-lite.js"></script>

  

    <link rel="import" href="../../../polymer/polymer.html">

c5169e0e   Renato De Donato   a new hope
25
    <link rel="import" href="../../../paper-styles/paper-styles.html">

f748e9cf   Luigi Serra   new controllet an...
26
27
28
    <link rel="import" href="../../iron-list.html">

  

    <style is="custom-style">

c5169e0e   Renato De Donato   a new hope
29
  

f748e9cf   Luigi Serra   new controllet an...
30
31
32
33
34
35
36
37
38
      iron-list {

        width: 500px;

        height: 400px;

        float: left;

        margin: 10px;

      }

  

      .item {

        background-color: green;

c5169e0e   Renato De Donato   a new hope
39
        border-bottom: 1px solid white; 

f748e9cf   Luigi Serra   new controllet an...
40
41
42
43
44
      }

  

    </style>

  

  </head>

c5169e0e   Renato De Donato   a new hope
45
  <body  class="fullbleed" unresolved>

f748e9cf   Luigi Serra   new controllet an...
46
47
  

    <template is="dom-bind">

c5169e0e   Renato De Donato   a new hope
48
49
      

      <h1>The physical avarage is not useful in this situations</h1>

f748e9cf   Luigi Serra   new controllet an...
50
51
52
      <p>The list is correct if it can render all the items without empty spaces.</p>

      <iron-list id="list" items="[791, 671]" as="item" style="width: 300px; height: 300px;">

        <template>

c5169e0e   Renato De Donato   a new hope
53
          <div class="item" style$="[[_getStyle(item)]]"><span>[[index]]</span> height: <span>[[item]]</span> 

f748e9cf   Luigi Serra   new controllet an...
54
55
56
57
58
59
          </div>

        </template>

      </iron-list>

  

      <iron-list id="list2" items="[791, 671]" as="item" style="width: 710px; height: 453px;">

        <template>

c5169e0e   Renato De Donato   a new hope
60
          <div class="item" style$="[[_getStyle(item)]]"><span>[[index]]</span> height: <span>[[item]]</span> 

f748e9cf   Luigi Serra   new controllet an...
61
62
63
64
65
66
          </div>

        </template>

      </iron-list>

  

      <iron-list items="[512, 256, 128, 64, 16, 16, 16, 16, 16, 16, 8, 4]" as="item" style="height: 256px;">

        <template>

c5169e0e   Renato De Donato   a new hope
67
          <div class="item" style$="[[_getStyle(item)]]"><span>[[index]]</span> height: <span>[[item]]</span> 

f748e9cf   Luigi Serra   new controllet an...
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
          </div>

        </template>

      </iron-list>

    </template>

  

    <script>

      HTMLImports.whenReady(function() {

        document.querySelector('template[is=dom-bind]')._getStyle = function(item) {

          return 'height:' + item + 'px; ';

        };

  

        setTimeout(function() {

          document.querySelector('#list').push('items', 251, 191, 151, 191, 51, 51, 51);

        }, 100);

  

         setTimeout(function() {

          document.querySelector('#list2').push('items', 251, 191, 151, 191, 51, 51, 51);

        }, 300);

      });

    </script>

  </body>

  </html>