e619a3b0
Luigi Serra
Controllet cross ...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<!doctype html>
<!--
@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
-->
<html>
<head>
<meta charset="UTF-8">
<title>iron-list test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
|
e619a3b0
Luigi Serra
Controllet cross ...
|
19
|
|
e619a3b0
Luigi Serra
Controllet cross ...
|
20
21
22
23
24
25
26
27
|
<link rel="import" href="helpers.html">
<link rel="import" href="x-list.html">
</head>
<body>
<test-fixture id="trivialList">
<template>
|
a1a3bc73
Luigi Serra
graphs updates
|
28
|
<x-list list-height="100" item-height="2"></x-list>
|
e619a3b0
Luigi Serra
Controllet cross ...
|
29
30
31
|
</template>
</test-fixture>
|
a1a3bc73
Luigi Serra
graphs updates
|
32
33
34
35
36
37
38
|
<test-fixture id="trivialListSmall">
<template>
<x-list list-height="2" item-height="2"></x-list>
</template>
</test-fixture>
|
e619a3b0
Luigi Serra
Controllet cross ...
|
39
40
41
42
43
44
45
46
|
<script>
suite('dynamic physical count', function() {
var list, container;
setup(function() {
container = fixture('trivialList');
list = container.list;
|
a1a3bc73
Luigi Serra
graphs updates
|
47
|
list.items = buildDataSet(200);
|
e619a3b0
Luigi Serra
Controllet cross ...
|
48
49
50
|
});
test('increase pool size', function(done) {
|
a1a3bc73
Luigi Serra
graphs updates
|
51
|
setTimeout(function() {
|
e619a3b0
Luigi Serra
Controllet cross ...
|
52
53
|
var lastItem = getLastItemFromList(list);
var lastItemHeight = lastItem.offsetHeight;
|
a1a3bc73
Luigi Serra
graphs updates
|
54
|
var expectedFinalItem = container.listHeight/lastItemHeight;
|
e619a3b0
Luigi Serra
Controllet cross ...
|
55
|
|
a1a3bc73
Luigi Serra
graphs updates
|
56
|
assert.equal(list.offsetHeight, container.listHeight);
|
e619a3b0
Luigi Serra
Controllet cross ...
|
57
58
59
|
assert.equal(lastItemHeight, 2);
assert.equal(getLastItemFromList(list).textContent, expectedFinalItem);
done();
|
a1a3bc73
Luigi Serra
graphs updates
|
60
|
}, 100);
|
e619a3b0
Luigi Serra
Controllet cross ...
|
61
|
});
|
a1a3bc73
Luigi Serra
graphs updates
|
62
|
});
|
e619a3b0
Luigi Serra
Controllet cross ...
|
63
|
|
a1a3bc73
Luigi Serra
graphs updates
|
64
65
66
67
68
69
70
71
|
suite('iron-resize', function() {
var list, container;
setup(function() {
container = fixture('trivialListSmall');
list = container.list;
list.items = buildDataSet(200);
});
|
e619a3b0
Luigi Serra
Controllet cross ...
|
72
|
|
a1a3bc73
Luigi Serra
graphs updates
|
73
|
test('increase pool size after resizing the list', function(done) {
|
e619a3b0
Luigi Serra
Controllet cross ...
|
74
|
flush(function() {
|
f748e9cf
Luigi Serra
new controllet an...
|
75
|
list.fire('iron-resize');
|
a1a3bc73
Luigi Serra
graphs updates
|
76
|
setTimeout(function() {
|
e619a3b0
Luigi Serra
Controllet cross ...
|
77
78
|
var lastItem = getLastItemFromList(list);
var lastItemHeight = lastItem.offsetHeight;
|
a1a3bc73
Luigi Serra
graphs updates
|
79
|
var expectedFinalItem = container.listHeight/lastItemHeight;
|
e619a3b0
Luigi Serra
Controllet cross ...
|
80
|
|
a1a3bc73
Luigi Serra
graphs updates
|
81
|
assert.equal(list.offsetHeight, container.listHeight);
|
e619a3b0
Luigi Serra
Controllet cross ...
|
82
83
84
|
assert.equal(lastItemHeight, 2);
assert.equal(getLastItemFromList(list).textContent, expectedFinalItem);
done();
|
a1a3bc73
Luigi Serra
graphs updates
|
85
|
}, 100);
|
e619a3b0
Luigi Serra
Controllet cross ...
|
86
87
|
});
});
|
e619a3b0
Luigi Serra
Controllet cross ...
|
88
|
});
|
e619a3b0
Luigi Serra
Controllet cross ...
|
89
90
91
92
|
</script>
</body>
</html>
|