buildgrid-ui 1.17.1 โ 1.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +172 -5
- package/dist/buildgrid-ui.css +1 -1
- package/dist/buildgrid-ui.es.js +8767 -8870
- package/dist/buildgrid-ui.umd.js +85 -85
- package/dist/components/accordion/accordion.d.ts +5 -5
- package/dist/components/card/card.d.ts +3 -1
- package/dist/components/skeleton/skeleton.d.ts +1 -1
- package/package.json +163 -149
package/README.md
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
<p>
|
|
8
8
|
<a href="https://www.npmjs.com/package/buildgrid-ui"><img src="https://img.shields.io/npm/v/buildgrid-ui.svg" alt="npm version"></a>
|
|
9
9
|
<a href="https://www.npmjs.com/package/buildgrid-ui"><img src="https://img.shields.io/npm/dm/buildgrid-ui.svg" alt="npm downloads"></a>
|
|
10
|
+
<a href="https://github.com/adrianomaringolo/buildgrid-ui/actions/workflows/test.yml"><img src="https://github.com/adrianomaringolo/buildgrid-ui/actions/workflows/test.yml/badge.svg" alt="Tests"></a>
|
|
11
|
+
<a href="https://codecov.io/gh/adrianomaringolo/buildgrid-ui"><img src="https://codecov.io/gh/adrianomaringolo/buildgrid-ui/branch/main/graph/badge.svg" alt="Coverage"></a>
|
|
10
12
|
<a href="https://github.com/adrianomaringolo/buildgrid-ui/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/buildgrid-ui.svg" alt="license"></a>
|
|
11
13
|
<a href="https://github.com/adrianomaringolo/buildgrid-ui"><img src="https://img.shields.io/github/stars/adrianomaringolo/buildgrid-ui.svg" alt="github stars"></a>
|
|
12
14
|
</p>
|
|
@@ -185,8 +187,151 @@ npm run build
|
|
|
185
187
|
|
|
186
188
|
# Run tests
|
|
187
189
|
npm test
|
|
190
|
+
|
|
191
|
+
# Run tests with coverage
|
|
192
|
+
npm run test:coverage
|
|
193
|
+
|
|
194
|
+
# Run tests in watch mode
|
|
195
|
+
npm run test:watch
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Testing
|
|
199
|
+
|
|
200
|
+
BuildGrid UI uses **Vitest** for comprehensive testing with exceptional coverage and quality standards:
|
|
201
|
+
|
|
202
|
+
#### Testing Framework & Architecture
|
|
203
|
+
- **Framework**: [Vitest](https://vitest.dev/) - Fast, modern testing framework built on Vite
|
|
204
|
+
- **Environment**: jsdom - Browser-like environment for realistic component testing
|
|
205
|
+
- **Utilities**: @testing-library/react + @testing-library/user-event for user-centric testing
|
|
206
|
+
- **Coverage**: v8 provider with detailed HTML, JSON, and LCOV reporting
|
|
207
|
+
- **CI/CD**: Automated testing pipeline with multi-version Node.js support
|
|
208
|
+
|
|
209
|
+
#### Test Categories & Coverage
|
|
210
|
+
|
|
211
|
+
**๐ง Unit Tests**
|
|
212
|
+
- Component rendering and props validation
|
|
213
|
+
- State management and lifecycle testing
|
|
214
|
+
- Event handling and user interactions
|
|
215
|
+
- Custom hooks and utility functions
|
|
216
|
+
|
|
217
|
+
**โฟ Accessibility Tests**
|
|
218
|
+
- WCAG 2.1 compliance verification
|
|
219
|
+
- Keyboard navigation testing (Tab, Enter, Space, Arrow keys)
|
|
220
|
+
- Screen reader compatibility and ARIA attributes
|
|
221
|
+
- Focus management and visual indicators
|
|
222
|
+
|
|
223
|
+
**๐ Integration Tests**
|
|
224
|
+
- Component composition and interaction patterns
|
|
225
|
+
- Form validation and submission workflows
|
|
226
|
+
- Complex user scenarios and edge cases
|
|
227
|
+
- Cross-component communication
|
|
228
|
+
|
|
229
|
+
**๐ Coverage Metrics**
|
|
230
|
+
```
|
|
231
|
+
Target Coverage: 80%+
|
|
232
|
+
โโโ Statements: 80%
|
|
233
|
+
โโโ Branches: 80%
|
|
234
|
+
โโโ Functions: 80%
|
|
235
|
+
โโโ Lines: 80%
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### Available Test Commands
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
# Development - Watch mode with instant feedback
|
|
242
|
+
npm test
|
|
243
|
+
|
|
244
|
+
# CI/Production - Single run with exit codes
|
|
245
|
+
npm run test:run
|
|
246
|
+
|
|
247
|
+
# Coverage Analysis - Generate detailed coverage reports
|
|
248
|
+
npm run test:coverage
|
|
249
|
+
|
|
250
|
+
# Visual Interface - Interactive test runner with GUI
|
|
251
|
+
npm run test:ui
|
|
252
|
+
|
|
253
|
+
# Coverage + Browser - Generate and automatically open coverage report
|
|
254
|
+
npm run test:coverage:open
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
#### Test Examples
|
|
258
|
+
|
|
259
|
+
**Component Behavior Testing**
|
|
260
|
+
```typescript
|
|
261
|
+
describe('Accordion', () => {
|
|
262
|
+
it('opens and closes items correctly', async () => {
|
|
263
|
+
const user = userEvent.setup()
|
|
264
|
+
render(<Accordion type="single" collapsible>
|
|
265
|
+
<AccordionItem value="item-1">
|
|
266
|
+
<AccordionTrigger>Item 1</AccordionTrigger>
|
|
267
|
+
<AccordionContent>Content 1</AccordionContent>
|
|
268
|
+
</AccordionItem>
|
|
269
|
+
</Accordion>)
|
|
270
|
+
|
|
271
|
+
const trigger = screen.getByText('Item 1')
|
|
272
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'false')
|
|
273
|
+
|
|
274
|
+
await user.click(trigger)
|
|
275
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'true')
|
|
276
|
+
expect(screen.getByText('Content 1')).toBeInTheDocument()
|
|
277
|
+
})
|
|
278
|
+
})
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**Accessibility Testing**
|
|
282
|
+
```typescript
|
|
283
|
+
describe('Keyboard Navigation', () => {
|
|
284
|
+
it('supports full keyboard interaction', async () => {
|
|
285
|
+
const user = userEvent.setup()
|
|
286
|
+
render(<AccordionExample />)
|
|
287
|
+
|
|
288
|
+
// Tab navigation
|
|
289
|
+
await user.tab()
|
|
290
|
+
expect(screen.getAllByRole('button')[0]).toHaveFocus()
|
|
291
|
+
|
|
292
|
+
// Enter/Space activation
|
|
293
|
+
await user.keyboard('{Enter}')
|
|
294
|
+
expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'true')
|
|
295
|
+
})
|
|
296
|
+
})
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
#### Quality Assurance Pipeline
|
|
300
|
+
|
|
301
|
+
**GitHub Actions Workflow**
|
|
302
|
+
- โ
Multi-version Node.js testing (18.x, 20.x)
|
|
303
|
+
- โ
Automated linting with ESLint + Prettier
|
|
304
|
+
- โ
TypeScript strict mode compilation
|
|
305
|
+
- โ
Coverage reporting to Codecov with badges
|
|
306
|
+
- โ
Build verification for library and Storybook
|
|
307
|
+
- โ
Parallel execution for optimal performance
|
|
308
|
+
|
|
309
|
+
**Quality Gates**
|
|
310
|
+
- All tests must pass before merge approval
|
|
311
|
+
- Coverage thresholds enforced automatically
|
|
312
|
+
- Zero TypeScript compilation errors
|
|
313
|
+
- ESLint rules compliance required
|
|
314
|
+
- Accessibility standards validation
|
|
315
|
+
|
|
316
|
+
For comprehensive testing guidelines, patterns, and best practices, see **[TESTING.md](TESTING.md)**.
|
|
317
|
+
|
|
318
|
+
#### Current Test Statistics
|
|
319
|
+
|
|
320
|
+
```
|
|
321
|
+
๐ Test Coverage Status
|
|
322
|
+
โโโ Total Tests: 30+ (and growing)
|
|
323
|
+
โโโ Components Tested: Accordion, Number Stepper, Input, Button
|
|
324
|
+
โโโ Test Categories: Unit, Integration, Accessibility, Edge Cases
|
|
325
|
+
โโโ Coverage Target: 80%+ across all metrics
|
|
326
|
+
โโโ CI Status: โ
All tests passing
|
|
188
327
|
```
|
|
189
328
|
|
|
329
|
+
**Test Distribution:**
|
|
330
|
+
- ๐งช **Unit Tests**: Component behavior, props, state management
|
|
331
|
+
- โฟ **Accessibility**: WCAG compliance, keyboard navigation, ARIA
|
|
332
|
+
- ๐ **Integration**: Component interactions, user workflows
|
|
333
|
+
- ๐ฏ **Edge Cases**: Error handling, boundary conditions
|
|
334
|
+
|
|
190
335
|
### Project Structure
|
|
191
336
|
|
|
192
337
|
```
|
|
@@ -213,18 +358,40 @@ We welcome contributions from the community! This is my first open-source projec
|
|
|
213
358
|
- โจ **Request features** - [Create a feature request](https://github.com/adrianomaringolo/buildgrid-ui/issues/new?template=feature_request.yml)
|
|
214
359
|
- ๐ **Improve docs** - [Create a documentation issue](https://github.com/adrianomaringolo/buildgrid-ui/issues/new?template=documentation.yml)
|
|
215
360
|
- ๐ง **Submit PRs** - Fix bugs or add features
|
|
361
|
+
- ๐งช **Write tests** - Help us reach 100% coverage by adding tests for components
|
|
216
362
|
- ๐ฌ **Join discussions** - [GitHub Discussions](https://github.com/adrianomaringolo/buildgrid-ui/discussions)
|
|
217
363
|
|
|
218
364
|
### Quick Start for Contributors
|
|
219
365
|
|
|
220
366
|
1. Fork the repository
|
|
221
367
|
2. Create a feature branch: `git checkout -b feature/amazing-feature`
|
|
222
|
-
3. Make your changes and test them
|
|
223
|
-
4.
|
|
224
|
-
5.
|
|
225
|
-
6.
|
|
368
|
+
3. Make your changes and test them: `npm test`
|
|
369
|
+
4. Ensure tests pass and coverage is maintained: `npm run test:coverage`
|
|
370
|
+
5. Commit using conventional commits: `git commit -m 'feat: add amazing feature'`
|
|
371
|
+
6. Push to your fork: `git push origin feature/amazing-feature`
|
|
372
|
+
7. Open a Pull Request
|
|
373
|
+
|
|
374
|
+
#### Contributing Tests
|
|
375
|
+
|
|
376
|
+
When adding new components or features, please include comprehensive tests:
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
# Create test file alongside your component
|
|
380
|
+
src/components/my-component/
|
|
381
|
+
โโโ my-component.tsx
|
|
382
|
+
โโโ my-component.test.tsx # โ Add this
|
|
383
|
+
โโโ my-component.stories.tsx
|
|
384
|
+
โโโ index.ts
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
**Test Requirements:**
|
|
388
|
+
- โ
Component rendering and props
|
|
389
|
+
- โ
User interactions (click, keyboard, etc.)
|
|
390
|
+
- โ
Accessibility (ARIA, keyboard navigation)
|
|
391
|
+
- โ
Edge cases and error handling
|
|
392
|
+
- โ
Maintain 80%+ coverage
|
|
226
393
|
|
|
227
|
-
Please read our [Contributing Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md) before contributing.
|
|
394
|
+
Please read our [Contributing Guide](CONTRIBUTING.md), [Testing Guide](TESTING.md), and [Code of Conduct](CODE_OF_CONDUCT.md) before contributing.
|
|
228
395
|
|
|
229
396
|
## ๐ Roadmap
|
|
230
397
|
|