mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
* Add a zig fmt action * add failing file * Setup prettier better * Update prettier-fmt.yml * Fail on error * Update prettier-fmt.yml * boop * boop2 * tar.gz * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * boop * Update prettier-fmt.yml * tag * newlines * multiline * fixup * Update zig-fmt.yml * update it * fixup * both * w * Update prettier-fmt.yml * prettier all the things * Update package.json * zig fmt * ❌ ✅ * bump * . * quotes * fix prettier ignore * once more * Update prettier-fmt.yml * Update fallback.ts * consistentcy --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
74 lines
1.7 KiB
TypeScript
74 lines
1.7 KiB
TypeScript
// @ts-nocheck
|
|
import { LitElement, html, css } from "lit";
|
|
import { customElement, property, eventOptions } from "lit/decorators.js";
|
|
|
|
var loadedResolve;
|
|
var loadedPromise = new Promise(resolve => {
|
|
loadedResolve = resolve;
|
|
});
|
|
|
|
if (document?.readyState === "loading") {
|
|
document.addEventListener(
|
|
"DOMContentLoaded",
|
|
() => {
|
|
loadedResolve();
|
|
},
|
|
{ once: true },
|
|
);
|
|
} else {
|
|
loadedResolve();
|
|
}
|
|
|
|
@customElement("my-element")
|
|
export class MyElement extends LitElement {
|
|
static styles = css`
|
|
:host {
|
|
display: inline-block;
|
|
padding: 10px;
|
|
background: lightgray;
|
|
}
|
|
.planet {
|
|
color: var(--planet-color, blue);
|
|
}
|
|
`;
|
|
|
|
@property() planet = "Earth";
|
|
|
|
render() {
|
|
return html` <span @click=${this.togglePlanet} class="planet" id="planet-id">${this.planet}</span> `;
|
|
}
|
|
|
|
@eventOptions({ once: true })
|
|
togglePlanet() {
|
|
this.planet = this.planet === "Earth" ? "Mars" : "Earth";
|
|
}
|
|
}
|
|
|
|
function setup() {
|
|
let element = document.createElement("my-element");
|
|
element.id = "my-element-id";
|
|
document.body.appendChild(element);
|
|
}
|
|
|
|
export async function test() {
|
|
setup();
|
|
await loadedPromise;
|
|
|
|
let element = document.getElementById("my-element-id");
|
|
let shadowRoot = element.shadowRoot;
|
|
let planet = shadowRoot.getElementById("planet-id");
|
|
if (element.__planet !== "Earth") {
|
|
throw new Error("Unexpected planet name: " + element.__planet);
|
|
}
|
|
planet.click();
|
|
if (element.__planet !== "Mars") {
|
|
throw new Error("Unexpected planet name: " + element.__planet);
|
|
}
|
|
planet.click();
|
|
if (element.__planet !== "Mars") {
|
|
throw new Error("Unexpected planet name: " + element.__planet);
|
|
}
|
|
|
|
return testDone(import.meta.url);
|
|
}
|