Skip to content

Instantly share code, notes, and snippets.

@MarkoZabcic
Last active May 12, 2023 08:41
Show Gist options
  • Save MarkoZabcic/10a1c92904fbaa02fe59185903e74f26 to your computer and use it in GitHub Desktop.
Save MarkoZabcic/10a1c92904fbaa02fe59185903e74f26 to your computer and use it in GitHub Desktop.
Web component generator template files
import { ApplicationElement, html } from '@effectivastudio/lit-components';
import translations from './translations.js';
import style from './style.lit.css';
/**
* TODO: Description
*
* @prop exampleProp - TODO: description
*
* @slot default - TODO: description
* @slot namedSlot - TODO: description
*/
export default class GalleryItem extends ApplicationElement {
static styles = [ApplicationElement.styles, style];
static properties = {
exampleProp: { type: String },
};
constructor() {
super();
// this.exampleProp = 0;
}
/** @internal */
static translations = translations;
render() {
return html`Hello from xs-gallery-item component!`;
}
}
GalleryItem.registerTagName('xs-gallery-item');
customElements.get('xs-gallery-item') ||
customElements.define('xs-gallery-item', GalleryItem);
import { fixture, assert, html } from "@open-wc/testing";
import GalleryItem from "./element.js";
describe("xs-gallery-item", () => {
it("initialize", async () => {
const element = await fixture(html`<xs-gallery-item></xs-gallery-item>`);
assert.instanceOf(element, GalleryItem);
});
it("default render", async () => {
const element = await fixture(html`<xs-gallery-item></xs-gallery-item>`);
assert.shadowDom.equal(
element,
`
Hello from xs-gallery-item component!
`
);
});
});
:host {
display: block;
}
export default {
en: {
exampleProp: 'Example prop'
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment