Skip to content

Commit

Permalink
[test] add lit case
Browse files Browse the repository at this point in the history
  • Loading branch information
enzoaicardi committed Mar 30, 2024
1 parent 099aa84 commit df0ee7b
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 34 deletions.
33 changes: 0 additions & 33 deletions src/directives/reconcile.md

This file was deleted.

3 changes: 2 additions & 1 deletion tests/garbage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>Garbage testing</title>
<!-- <script src="../../../dist/vif.js"></script> -->
<!-- <script src="../../dist/iife/vif.js" defer></script> -->
<script type="module" src="./components.js" defer></script>
<script type="module" src="./lit.js" defer></script>
</head>
<body>
<h1>Primary tests here</h1>
Expand All @@ -22,6 +22,7 @@ <h1>Primary tests here</h1>
<p x-text="item().label">number</p>
</template>
</x-app>
<lit-app></lit-app>
</main>
</body>
</html>
104 changes: 104 additions & 0 deletions tests/garbage/lit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import {
LitElement,
html,
} from "https://cdn.jsdelivr.net/gh/lit/dist@3/core/lit-core.min.js";

let id = 0;

function _random(max) {
return Math.round(Math.random() * 1000) % max;
}

function buildData(count = 1000) {
var adjectives = [
"pretty",
"large",
"big",
"small",
"tall",
"short",
"long",
"handsome",
"plain",
"quaint",
"clean",
"elegant",
"easy",
"angry",
"crazy",
"helpful",
"mushy",
"odd",
"unsightly",
"adorable",
"important",
"inexpensive",
"cheap",
"expensive",
"fancy",
];
var colours = [
"red",
"yellow",
"blue",
"green",
"pink",
"brown",
"purple",
"brown",
"white",
"black",
"orange",
];
var nouns = [
"table",
"chair",
"house",
"bbq",
"desk",
"car",
"pony",
"cookie",
"sandwich",
"burger",
"pizza",
"mouse",
"keyboard",
];
var data = [];
for (var i = 0; i < count; i++)
data.push({
id: id++,
label:
adjectives[_random(adjectives.length)] +
" " +
colours[_random(colours.length)] +
" " +
nouns[_random(nouns.length)],
});
return data;
}

class LitApp extends LitElement {
static properties = {
array: {},
};
constructor() {
super();
this.array = [];
setTimeout(() => {
this.array = this.array.length ? [] : buildData(10000);
}, 1000);
setTimeout(() => {
this.array = this.array.length ? [] : buildData(10000);
}, 2000);
setTimeout(() => {
this.array = this.array.length ? [] : buildData(10000);
}, 3000);
}
render() {
return html`${this.array.map((item) => html`<p>${item.label}</p>`)}`;
}
}

customElements.define("lit-app", LitApp);
File renamed without changes.

0 comments on commit df0ee7b

Please sign in to comment.