ruvector/studio/tests/setup/radix.js
rUv 814f595995 feat(studio): Add complete RuVector Studio application
Major additions:
- Complete Next.js studio application with 1600+ components
- Docker support (Dockerfile.combined, docker-compose.yml)
- GCP deployment documentation and benchmarks
- SQL benchmark scripts for performance testing
- Sentry integration for monitoring
- Comprehensive test suite and mocks

Studio features:
- Dashboard and admin interfaces
- Data visualization components
- Authentication and user management
- API integration with RuVector backend
- Static data and public assets

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 23:04:48 +00:00

51 lines
1.4 KiB
JavaScript

/**
* Required setup adapted from https://github.com/radix-ui/primitives/issues/856#issuecomment-928704064
*
* Implements a custom PointerEvent that can then be used to trigger the radix dropdown.
* This is required as JSdom has not implemented the PointerEvent (see https://github.com/testing-library/react-testing-library/issues/838#issuecomment-735259406)
*
* Furthermore, ResizeObserver and DomRect are both not available in JSdom (see https://github.com/radix-ui/primitives/issues/856)
*
* Effects of this setup file:
* - sets PointerEvent to window
* - sets ResizeObserver to window
* - sets DOMRect to window
*
* Needed to interact with dropdown components, with the `clickDropdown` helper.
*/
class PointerEvent extends Event {
constructor(type, props) {
super(type, props)
if (props.button != null) {
this.button = props.button
}
if (props.ctrlKey != null) {
this.ctrlKey = props.ctrlKey
}
}
}
window.PointerEvent = PointerEvent
window.HTMLElement.prototype.scrollIntoView = function () {}
// // https://github.com/radix-ui/primitives/issues/420#issuecomment-771615182
window.ResizeObserver = class ResizeObserver {
constructor(cb) {
this.cb = cb
}
observe() {}
unobserve() {}
disconnect() {}
}
window.DOMRect = {
fromRect: () => ({
top: 0,
left: 0,
bottom: 0,
right: 0,
width: 0,
height: 0,
}),
}