Update to Lit 2.0.0 (manually)
Will attempt to get this back to syncing with monorepo history per https://github.com/lit/lit#exporting-starter-templates in a follow-up.
This commit is contained in:
@@ -10,12 +10,13 @@ import {customElement, property} from 'lit/decorators.js';
|
||||
/**
|
||||
* An example element.
|
||||
*
|
||||
* @fires count-changed - Indicates when the count changes
|
||||
* @slot - This element has a slot
|
||||
* @csspart button - The button
|
||||
*/
|
||||
@customElement('my-element')
|
||||
export class MyElement extends LitElement {
|
||||
static styles = css`
|
||||
static override styles = css`
|
||||
:host {
|
||||
display: block;
|
||||
border: solid 1px gray;
|
||||
@@ -36,9 +37,9 @@ export class MyElement extends LitElement {
|
||||
@property({type: Number})
|
||||
count = 0;
|
||||
|
||||
render() {
|
||||
override render() {
|
||||
return html`
|
||||
<h1>Hello, ${this.name}!</h1>
|
||||
<h1>${this.sayHello(this.name)}!</h1>
|
||||
<button @click=${this._onClick} part="button">
|
||||
Click Count: ${this.count}
|
||||
</button>
|
||||
@@ -48,10 +49,15 @@ export class MyElement extends LitElement {
|
||||
|
||||
private _onClick() {
|
||||
this.count++;
|
||||
this.dispatchEvent(new CustomEvent('count-changed'));
|
||||
}
|
||||
|
||||
foo(): string {
|
||||
return 'foo';
|
||||
/**
|
||||
* Formats a greeting
|
||||
* @param name The name to say "Hello" to
|
||||
*/
|
||||
sayHello(name: string): string {
|
||||
return `Hello, ${name}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
|
||||
import {MyElement} from '../my-element.js';
|
||||
|
||||
import {fixture, html} from '@open-wc/testing';
|
||||
|
||||
const assert = chai.assert;
|
||||
import {fixture, assert} from '@open-wc/testing';
|
||||
import {html} from 'lit/static-html.js';
|
||||
|
||||
suite('my-element', () => {
|
||||
test('is defined', () => {
|
||||
|
||||
Reference in New Issue
Block a user