✨(react) add DataGrid, SimpleDataGrid components
The DataGrid component can be considered as the core one, which provides a full controlled component, but more complicated than SimpleDataGrid which is based on DataGrid. SimpleDataGrid is intended to give a simple ready-to-use data grid for client side data for example.
This commit is contained in:
7
packages/react/src/tests/Setup.ts
Normal file
7
packages/react/src/tests/Setup.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import createFetchMock from "vitest-fetch-mock";
|
||||
import { vi } from "vitest";
|
||||
|
||||
const fetchMocker = createFetchMock(vi);
|
||||
|
||||
// sets globalThis.fetch and globalThis.fetchMock to our mocked version
|
||||
fetchMocker.enableMocks();
|
||||
24
packages/react/src/tests/deferred.ts
Normal file
24
packages/react/src/tests/deferred.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Test helper: use a deferred object to control promise resolution without mocking
|
||||
* deep inside our code.
|
||||
*/
|
||||
export class Deferred<T> {
|
||||
promise: Promise<T>;
|
||||
reject!: (reason?: any) => void;
|
||||
resolve!: (value: T | PromiseLike<T>) => void;
|
||||
|
||||
constructor() {
|
||||
this.promise = this._init();
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.promise = this._init();
|
||||
}
|
||||
|
||||
private _init(): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.reject = reject;
|
||||
this.resolve = resolve;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user