-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Showcase/demo: Ideal code structure for atomic-component with Lit #4877
base: master
Are you sure you want to change the base?
Conversation
storybook: add mdx support storybook-dev: sync up lang & assets after a watch cycle dev: ignore e2e from watch cycle lit: add base page object
Pull Request ReportPR Title❌ Title should follow the conventional commit spec: Example: Live demo linksBundle Size
SSR Progress
Detailed logssearch : buildInteractiveResultsearch : buildInteractiveInstantResult search : buildInteractiveRecentResult search : buildInteractiveCitation search : buildGeneratedAnswer recommendation : missing SSR support case-assist : missing SSR support insight : missing SSR support commerce : missing SSR support |
3ee954a
to
72470d4
Compare
render() { | ||
return html` | ||
<div> | ||
<p>Hello, ${this.name}!</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should showcase localization (of aria-label, too!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.w3.org/WAI/ARIA/apg/practices/names-and-descriptions/#naming_techniques when relevant, yes, using a aria-label could make sense.
import {LitElement, html, css} from 'lit'; | ||
import {customElement, property} from 'lit/decorators.js'; | ||
|
||
@customElement('atomic-result-example-component') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sample component should also have a slot and a couple of parts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
|
||
render() { | ||
return html` | ||
<div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally our sample components should showcase a few ARIA attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mhh... I disagree, ARIA Attributes are a bit of a crutch for the web IMO (see the warning in https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still many cases where using ARIA attributes is legit, though, and the current sample might be a little too simple.
@@ -0,0 +1,32 @@ | |||
import {LitElement, html, css} from 'lit'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have samples for a result template component and for a non-result template component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
interface TestFixture { | ||
resultExample: AtomicResultExample; | ||
} | ||
export const test = base.extend<TestFixture & AxeFixture>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes me wonder: should we test accessibility in UTs or in e2e?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UT minimally, TBD for e2e
import {describe, it, expect} from 'vitest'; | ||
import './atomic-result-example-component.js'; | ||
|
||
describe('atomic-result-example-component', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should UTs also cover localization (at least broadly)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably yes, tbd
I was wondering, is there a specific reason we have "new" in the stories file? |
42337a0
to
a2bf081
Compare
We could/should probably remove it now 😂 It was when we did a Storybook revamp/transition |
A showcase of the "all-included" component in a directory approach:
component-name/component-name.ts
: the component itselfcomponent-name/component-name.mdx
: the 'usage & more' documentation of the componentcomponent-name/component-name.new.stories.tsx
: the technical/storybook reference pagecomponent-name/component-name.spec.tsx
: the unit-tests of the componentcomponent-name/e2e/page-object.ts
: the playwright/e2e selector associated to this specific componentcomponent-name/e2e/fixture.ts
: all the selectors & utils required for the end-to-end testing of this component. May use selector of other components.component-name/e2e/componen-name.e2e.ts
: the end-to-end tests of the component