You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -886,6 +893,117 @@ The mock connector supports test endpoints for state manipulation:
886
893
-`/__test__/user-packages` - Set user's packages
887
894
-`/__test__/package` - Set package collaborators
888
895
896
+
## Storybook
897
+
898
+
Storybook is a development environment for UI components that helps catch UI changes and provides integrations for various testing types. For testing, Storybook offers:
899
+
900
+
-**Accessibility tests** - Built-in a11y checks
901
+
-**Visual tests** - Compare JPG screenshots
902
+
-**Vitest tests** - Use stories directly in the unit tests
903
+
904
+
### Component categories
905
+
906
+
The plan is to organize components into 3 categories.
907
+
908
+
#### UI Library Components
909
+
910
+
Generic and reusable components used throughout the application.
The component should include descriptive comments.
971
+
972
+
```ts
973
+
// Button.vue
974
+
<scriptsetuplang="ts">
975
+
const props =withDefaults(
976
+
defineProps<{
977
+
/** Whether the button is disabled */
978
+
disabled?:boolean
979
+
/**
980
+
* HTML button type attribute
981
+
* @default"button"
982
+
type?: 'button' | 'submit'
983
+
// ...
984
+
}>)
985
+
</script>
986
+
```
987
+
988
+
### Configuration
989
+
990
+
Stories can be configured at three levels:
991
+
992
+
- **Global scope** (`.storybook/preview.ts`) - Applies to all stories
993
+
- **Component scope** - Applies to all stories for a specific component
994
+
- **Story scope** - Applies to individual stories only
995
+
996
+
### Global app settings
997
+
998
+
Global application settings are added to the Storybook toolbar for easy testing and viewing. Configure these in `.storybook/preview.ts` under the `globalTypes` and `decorators` properties.
999
+
1000
+
### Known limitations
1001
+
1002
+
- Changing `i18n` in the toolbar doesn't update the language. A manual story reload is required.
1003
+
- `autodocs` currently is non-functional due bugs, its usage is discouraged at this time.
1004
+
- `pnpm storybook` may log warnings or non-breaking errors for Nuxt modules due to the lack of mocks. If the UI renders correctly, these can be safely ignored.
1005
+
- Do not `import type` from `.vue` files. The `vue-docgen-api` parser used by `@storybook/addon-docs` cannot follow type imports across SFCs and will crash. Extract shared types into a separate `.ts` file instead.
0 commit comments