generate ui files

This commit is contained in:
Mads Rasmussen
2023-01-03 12:50:22 +01:00
parent 3d85c6b191
commit e35e436389
3 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import { html, LitElement } from 'lit';
import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
import { customElement, property } from 'lit/decorators.js';
/**
* @element umb-property-editor-ui-color-picker
*/
@customElement('umb-property-editor-ui-color-picker')
export class UmbPropertyEditorUIColorPickerElement extends LitElement {
static styles = [UUITextStyles];
@property()
value = '';
@property({ type: Array, attribute: false })
public config = [];
render() {
return html`<div>umb-property-editor-ui-color-picker</div>`;
}
}
export default UmbPropertyEditorUIColorPickerElement;
declare global {
interface HTMLElementTagNameMap {
'umb-property-editor-ui-color-picker': UmbPropertyEditorUIColorPickerElement;
}
}

View File

@@ -0,0 +1,15 @@
import { Meta, Story } from '@storybook/web-components';
import { html } from 'lit-html';
import type { UmbPropertyEditorUIColorPickerElement } from './property-editor-ui-color-picker.element';
import './property-editor-ui-color-picker.element';
export default {
title: 'Property Editor UIs/Color Picker',
component: 'umb-property-editor-ui-color-picker',
id: 'umb-property-editor-ui-color-picker',
} as Meta;
export const AAAOverview: Story<UmbPropertyEditorUIColorPickerElement> = () =>
html`<umb-property-editor-ui-color-picker></umb-property-editor-ui-color-picker>`;
AAAOverview.storyName = 'Overview';

View File

@@ -0,0 +1,19 @@
import { expect, fixture, html } from '@open-wc/testing';
import { UmbPropertyEditorUIColorPickerElement } from './property-editor-ui-color-picker.element';
import { defaultA11yConfig } from '@umbraco-cms/test-utils';
describe('UmbPropertyEditorUIColorPickerElement', () => {
let element: UmbPropertyEditorUIColorPickerElement;
beforeEach(async () => {
element = await fixture(html` <umb-property-editor-ui-color-picker></umb-property-editor-ui-color-picker> `);
});
it('is defined with its own instance', () => {
expect(element).to.be.instanceOf(UmbPropertyEditorUIColorPickerElement);
});
it('passes the a11y audit', async () => {
await expect(element).shadowDom.to.be.accessible(defaultA11yConfig);
});
});