From 46866612666c24444c5f7a8a88bd9f2993121de1 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 3 Jan 2023 15:10:32 +0100 Subject: [PATCH] add tree picker scaffold --- .../property-editor-ui-tree-picker.element.ts | 29 +++++++++++++++++++ .../property-editor-ui-tree-picker.stories.ts | 15 ++++++++++ .../property-editor-ui-tree-picker.test.ts | 21 ++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.element.ts create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.stories.ts create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.test.ts diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.element.ts new file mode 100644 index 0000000000..6a53de7fef --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.element.ts @@ -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-tree-picker + */ +@customElement('umb-property-editor-ui-tree-picker') +export class UmbPropertyEditorUITreePickerElement extends LitElement { + static styles = [UUITextStyles]; + + @property() + value = ''; + + @property({ type: Array, attribute: false }) + public config = []; + + render() { + return html`
umb-property-editor-ui-tree-picker
`; + } +} + +export default UmbPropertyEditorUITreePickerElement; + +declare global { + interface HTMLElementTagNameMap { + 'umb-property-editor-ui-tree-picker': UmbPropertyEditorUITreePickerElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.stories.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.stories.ts new file mode 100644 index 0000000000..ef4f2ef961 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.stories.ts @@ -0,0 +1,15 @@ +import { Meta, Story } from '@storybook/web-components'; +import { html } from 'lit-html'; + +import type { UmbPropertyEditorUITreePickerElement } from './property-editor-ui-tree-picker.element'; +import './property-editor-ui-tree-picker.element'; + +export default { + title: 'Property Editor UIs/Tree Picker', + component: 'umb-property-editor-ui-tree-picker', + id: 'umb-property-editor-ui-tree-picker', +} as Meta; + +export const AAAOverview: Story = () => + html``; +AAAOverview.storyName = 'Overview'; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.test.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.test.ts new file mode 100644 index 0000000000..7864ef66ff --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/tree-picker/property-editor-ui-tree-picker.test.ts @@ -0,0 +1,21 @@ +import { expect, fixture, html } from '@open-wc/testing'; +import { UmbPropertyEditorUITreePickerElement } from './property-editor-ui-tree-picker.element'; +import { defaultA11yConfig } from '@umbraco-cms/test-utils'; + +describe('UmbPropertyEditorUITreePickerElement', () => { + let element: UmbPropertyEditorUITreePickerElement; + + beforeEach(async () => { + element = await fixture( + html` ` + ); + }); + + it('is defined with its own instance', () => { + expect(element).to.be.instanceOf(UmbPropertyEditorUITreePickerElement); + }); + + it('passes the a11y audit', async () => { + await expect(element).shadowDom.to.be.accessible(defaultA11yConfig); + }); +});