Skip to content

Commit 1cad879

Browse files
committed
tests
1 parent 801f4a5 commit 1cad879

File tree

5 files changed

+186
-232
lines changed

5 files changed

+186
-232
lines changed

VirtualList.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
});
3131

3232
// whenever `items` changes, invalidate the current heightmap
33-
$: if (mounted) refresh(items, viewport_height);
33+
$: if (mounted) refresh(items, viewport_height, itemHeight);
3434

35-
async function refresh(items, viewport_height) {
35+
async function refresh(items, viewport_height, itemHeight) {
3636
const { scrollTop } = viewport;
3737

3838
await tick(); // wait until the DOM is up to date
@@ -61,6 +61,7 @@
6161

6262
bottom = remaining * average_height;
6363
height_map.length = items.length;
64+
6465
}
6566

6667
async function handle_scroll() {

test/src/App.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script>
2+
import VirtualList from '../../VirtualList.html';
3+
import Row from './Row.html';
4+
5+
export let items = [];
6+
export let height = '100px';
7+
export let itemHeight;
8+
</script>
9+
10+
<VirtualList {height} {items} {itemHeight} let:item>
11+
<Row text={item.text} height={item.height}/>
12+
</VirtualList>

test/src/Row.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<script>
2+
export let text;
3+
export let height = 80;
4+
</script>
5+
6+
<div style="height: {height}px;">{text}</div>

0 commit comments

Comments
 (0)