@object-ui/plugin-calendar 0.3.1 → 2.0.0

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/test/setup.ts ADDED
@@ -0,0 +1,32 @@
1
+ import '@testing-library/jest-dom';
2
+ import * as React from 'react';
3
+
4
+ // Polyfill ResizeObserver
5
+ global.ResizeObserver = class ResizeObserver {
6
+ observe() {}
7
+ unobserve() {}
8
+ disconnect() {}
9
+ };
10
+
11
+ // Mock PointerEvent
12
+ class PointerEvent extends Event {
13
+ button: number;
14
+ ctrlKey: boolean;
15
+ metaKey: boolean;
16
+ shiftKey: boolean;
17
+ constructor(type: string, props: any = {}) {
18
+ super(type, props);
19
+ this.button = props.button || 0;
20
+ this.ctrlKey = props.ctrlKey || false;
21
+ this.metaKey = props.metaKey || false;
22
+ this.shiftKey = props.shiftKey || false;
23
+ }
24
+ }
25
+ global.PointerEvent = PointerEvent as any;
26
+
27
+ // Mock HTMLElement.offsetParent
28
+ Object.defineProperty(HTMLElement.prototype, 'offsetParent', {
29
+ get() {
30
+ return this.parentNode;
31
+ },
32
+ });
package/vite.config.ts CHANGED
@@ -12,6 +12,12 @@ import dts from 'vite-plugin-dts';
12
12
  import { resolve } from 'path';
13
13
 
14
14
  export default defineConfig({
15
+ test: {
16
+ globals: true,
17
+ environment: 'jsdom',
18
+ setupFiles: ['./test/setup.ts'],
19
+ css: true,
20
+ },
15
21
  plugins: [
16
22
  react(),
17
23
  dts({
@@ -0,0 +1,13 @@
1
+ /// <reference types="vitest" />
2
+ import { defineConfig } from 'vite';
3
+ import react from '@vitejs/plugin-react';
4
+ import path from 'path';
5
+
6
+ export default defineConfig({
7
+ plugins: [react()],
8
+ test: {
9
+ environment: 'happy-dom',
10
+ globals: true,
11
+ setupFiles: ['./vitest.setup.ts'],
12
+ },
13
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';