lion/packages/ui/components/dialog/test-helpers/test-router.js
Thijs Louisse 8377e8d17d fix(overlays): rework setup and teardown logic of OverlayMixin
Add a failing test

chore: broken test fix

chore: harden overlay teardown tests and cleanup select-rich
2025-01-13 15:33:28 +01:00

43 lines
883 B
JavaScript

import { html, LitElement } from 'lit';
class TestRouter extends LitElement {
static properties = {
routingMap: {
type: Object,
attribute: false,
},
path: { type: String },
};
constructor() {
super();
/** @type {{ [path: string]: HTMLElement }} */
this.routingMap = {};
/** @type {string} */
this.path = '';
}
render() {
return html`
<div>
<div id="selector">
${Object.keys(this.routingMap).map(
path =>
html`<button
id="path-${path}"
@click="${() => {
this.path = path;
}}"
>
${path}
</button>`,
)}
</div>
<div id="view">${this.routingMap[this.path]}</div>
</div>
`;
}
}
customElements.define('test-router', TestRouter);