Skip to content

Commit 32f0e1a

Browse files
committed
test(infinite-scroll): revert back to prepend
1 parent ba6ca9b commit 32f0e1a

File tree

1 file changed

+8
-18
lines changed
  • core/src/components/infinite-scroll/test/top

1 file changed

+8
-18
lines changed

core/src/components/infinite-scroll/test/top/index.html

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,36 +46,26 @@
4646
console.log('Loading data...');
4747
await wait(500);
4848
infiniteScroll.complete();
49-
appendNewItems();
49+
appendItems(true);
5050
// Custom event consumed in the e2e tests
5151
window.dispatchEvent(new CustomEvent('ionInfiniteComplete'));
5252

5353
console.log('Done');
5454
});
5555

56-
// Add initial items
57-
function appendInitialItems() {
58-
for (var i = 0; i < 30; i++) {
59-
const el = document.createElement('ion-item');
60-
el.textContent = `Item ${1 + i}`;
61-
list.appendChild(el);
62-
}
63-
}
64-
65-
// Add newly loaded items with special styling
66-
function appendNewItems() {
56+
function appendItems(newItems = false) {
6757
const randomColor =
6858
'#' +
6959
Math.floor(Math.random() * 16777215)
7060
.toString(16)
7161
.padStart(6, '0');
7262

73-
// Reverse the order of the items to match
74-
// the order of the initial items
75-
for (var i = 29; i >= 0; i--) {
63+
for (var i = 0; i < 30; i++) {
7664
const el = document.createElement('ion-item');
77-
el.textContent = `Item ${i + 1}`;
78-
el.style.borderLeft = `4px solid ${randomColor}`;
65+
el.textContent = `Item ${1 + i}`;
66+
if (newItems) {
67+
el.style.borderLeft = `4px solid ${randomColor}`;
68+
}
7969
list.prepend(el);
8070
}
8171
}
@@ -88,7 +78,7 @@
8878
});
8979
}
9080

91-
appendInitialItems();
81+
appendItems();
9282
</script>
9383
</body>
9484
</html>

0 commit comments

Comments
 (0)