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
@@ -885,6 +892,117 @@ The mock connector supports test endpoints for state manipulation:
885
892
-`/__test__/user-packages` - Set user's packages
886
893
-`/__test__/package` - Set package collaborators
887
894
895
+
## Storybook
896
+
897
+
Storybook is a development environment for UI components that helps catch UI changes and provides integrations for various testing types. For testing, Storybook offers:
898
+
899
+
-**Accessibility tests** - Built-in a11y checks
900
+
-**Visual tests** - Compare JPG screenshots
901
+
-**Vitest tests** - Use stories directly in the unit tests
902
+
903
+
### Component categories
904
+
905
+
The plan is to organize components into 3 categories.
906
+
907
+
#### UI Library Components
908
+
909
+
Generic and reusable components used throughout the application.
The component should include descriptive comments.
970
+
971
+
```ts
972
+
// Button.vue
973
+
<scriptsetuplang="ts">
974
+
const props =withDefaults(
975
+
defineProps<{
976
+
/** Whether the button is disabled */
977
+
disabled?:boolean
978
+
/**
979
+
* HTML button type attribute
980
+
* @default"button"
981
+
type?: 'button' | 'submit'
982
+
// ...
983
+
}>)
984
+
</script>
985
+
```
986
+
987
+
### Configuration
988
+
989
+
Stories can be configured at three levels:
990
+
991
+
- **Global scope** (`.storybook/preview.ts`) - Applies to all stories
992
+
- **Component scope** - Applies to all stories for a specific component
993
+
- **Story scope** - Applies to individual stories only
994
+
995
+
### Global app settings
996
+
997
+
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.
998
+
999
+
### Known limitations
1000
+
1001
+
- Changing `i18n` in the toolbar doesn't update the language. A manual story reload is required.
1002
+
- `autodocs` currently is non-functional due bugs, its usage is discouraged at this time.
1003
+
- `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.
1004
+
- 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