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
{{ message }}
This repository was archived by the owner on Sep 20, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+90-15Lines changed: 90 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,36 +19,43 @@ cd chakra-ui
19
19
```
20
20
21
21
3. Install dependencies and bootstrap the project
22
+
22
23
```sh
23
24
pnpm install
24
25
```
25
26
26
27
4. Start development server for packages
28
+
27
29
```sh
28
30
pnpm dev
29
31
```
30
32
31
33
5. Open component playground
34
+
32
35
```sh
33
36
pnpm playground:dev
34
37
```
35
38
36
-
> If you run into any issues during these steps, kindly reach out to the Chakra UI
37
-
> Vue team here:[https://discord.gg/cMpMfvxa](https://discord.gg/cMpMfvxa)
39
+
> If you run into any issues during these steps, kindly reach out to the Chakra
40
+
> UI Vue team here:[https://discord.gg/cMpMfvxa](https://discord.gg/cMpMfvxa)
38
41
39
42
## For Windows OS Users
40
-
There may be some trouble specific to the local setup in Windows. The following are suggestions in ensuring the local environment boots up successfully:
41
43
42
-
- The package dependencies and scripts should work with Node `v16.16.0 and higher`
44
+
There may be some trouble specific to the local setup in Windows. The following
45
+
are suggestions in ensuring the local environment boots up successfully:
43
46
47
+
- The package dependencies and scripts should work with Node
48
+
`v16.16.0 and higher`
44
49
45
50
## Development
46
51
47
52
To improve our development process, we've set up tooling and systems. Chakra UI
48
53
uses a monorepo structure and we treat each component as an independent package
49
54
that can be consumed in isolation.
50
55
51
-
If you are looking to build a new component, and it has been approved by the team, head over to the [components-guide.md](./docs/guides/component-guide.md) to help you get started!
56
+
If you are looking to build a new component, and it has been approved by the
57
+
team, head over to the [components-guide.md](./docs/guides/component-guide.md)
58
+
to help you get started!
52
59
53
60
### Tooling
54
61
@@ -66,7 +73,8 @@ If you are looking to build a new component, and it has been approved by the tea
66
73
**`pnpm install`**: bootstraps the entire project, symlinks all dependencies for
67
74
cross-component development and builds all components.
68
75
69
-
**`pnpm playground:dev`**: starts components playground server and loads stories in SFCs in the `packages/**/examples/*.vue` file.
76
+
**`pnpm playground:dev`**: starts components playground server and loads stories
77
+
in SFCs in the `packages/**/examples/*.vue` file.
70
78
71
79
**`pnpm docs:dev`**: run the documentation site locally.
72
80
@@ -87,8 +95,9 @@ to run commands within component packages directly from the root.
87
95
Each component is named this way: `@chakra-ui/[component]`. Let's say we want to
88
96
build the button component. Here's how to do it:
89
97
90
-
> *Take note that in order to prevent template tags name clashing with HTML elements or other Vue library components,*
91
-
> *we prefix all component names with a `c-` in kebab-case or a capital `C` in PascalCase.*
98
+
> _Take note that in order to prevent template tags name clashing with HTML
99
+
> elements or other Vue library components,_ > _we prefix all component names
100
+
> with a `c-` in kebab-case or a capital `C` in PascalCase._
92
101
93
102
```bash
94
103
pnpm workspace @chakra-ui/c-button build
@@ -99,6 +108,7 @@ lerna run build --scope @chakra-ui/c-button
99
108
```
100
109
101
110
**Shortcut:**
111
+
102
112
```bash
103
113
# to build
104
114
pnpm pkg @chakra-ui/c-tabs build
@@ -114,14 +124,15 @@ and want to avoid running the command for all components.
114
124
115
125
### Documentation
116
126
117
-
The documentation site is built with Vite.js on SSR. If you'd like to contribute to the
118
-
docs, simply run `pnpm build`, and `pnpm docs:dev`
127
+
The documentation site is built with Vite.js on SSR. If you'd like to contribute
128
+
to the docs, simply run `pnpm build`, and `pnpm docs:dev`
119
129
120
130
### Components Development Playground
121
131
122
132
Build components in isolation with Vite using `pnpm playground:dev`
123
133
124
-
Run `pnpm start` in a separate terminal first so the packages are built and a watcher set up for changes.
134
+
Run `pnpm start` in a separate terminal first so the packages are built and a
135
+
watcher set up for changes.
125
136
126
137
## Think you found a bug?
127
138
@@ -131,8 +142,8 @@ link.
131
142
132
143
You may wish to use our starters to help you get going:
133
144
134
-
TODO: Add Typescript starter for `@chakra-ui/vue` v1
135
-
TODO: Add Javascript starter for `@chakra-ui/vue` v1
145
+
TODO: Add Typescript starter for `@chakra-ui/vue` v1 TODO: Add Javascript
146
+
starter for `@chakra-ui/vue` v1
136
147
137
148
## Proposing new or changed API?
138
149
@@ -200,9 +211,73 @@ https://www.conventionalcommits.org/ or check out the
200
211
> `pnpm changeset add --empty` to generate an empty changeset file to document
201
212
> your changes.
202
213
203
-
### Tests
214
+
## Writing Tests
215
+
216
+
We recommend all new code that is added to the codebase or any refactors that
217
+
may modify the behaviour of a given component or module are accompanied with
218
+
some simple tests. This ensures that the behaviour of the component is protected
219
+
against any accidental regressions in the future, or ensures that the new
220
+
refactor does not change the behaviour of a given component.
221
+
222
+
At the time of writing this this document, unit tests authored in the Chakra UI
223
+
Vue codebase are categorized into two types:
224
+
225
+
1. Component Tests (Behavioural Focused)
226
+
2. Black Box Tests (Input-Output Focused)
227
+
228
+
### Component Tests
204
229
205
-
All commits that fix bugs or add features need a test.
230
+
Authoring component tests typically is aimed at ensuring the behaviour of a
231
+
given component based on its public API. Depending on the nature of the
232
+
component you are testing, you may want to use either
233
+
[Cypress component testing]() which excels this kind of behavioural testing of
234
+
with [Jest](), which is mostly used for black-box testing.
235
+
236
+
#### Testing with Cypress
237
+
238
+
1. Create your `<COMPONENT>.cy.tsx` file in the `packages/<COMPONENT>/tests/`
239
+
directory; where `<COMPONENT>` is the name of the component you are testing.
240
+
2. Add the Cypress type references at the top of the file as shown in the
241
+
example below. This will allow typescript to correctly reference the Cypress
0 commit comments