mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-01 19:45:48 +08:00
Add react-dnd-test-backend
This commit is contained in:
15
types/react-dnd-test-backend/index.d.ts
vendored
Normal file
15
types/react-dnd-test-backend/index.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// Type definitions for react-dnd-test-backend 2.5
|
||||
// Project: https://github.com/react-dnd/react-dnd#readme
|
||||
// Definitions by: Gustavo Henke <https://github.com/gustavohenke>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import * as ReactDnd from "react-dnd";
|
||||
|
||||
export default class TestBackend implements ReactDnd.Backend {
|
||||
simulateBeginDrag(sourceIds: ReactDnd.Identifier[], options?: {}): void;
|
||||
simulatePublishDragSource(): void;
|
||||
simulateHover(targetIds: ReactDnd.Identifier[], options?: {}): void;
|
||||
simulateDrop(): void;
|
||||
simulateEndDrag(): void;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import * as React from "react";
|
||||
import { ContextComponent, ContextComponentClass, DragDropContext } from "react-dnd";
|
||||
import TestBackend from "react-dnd-test-backend";
|
||||
|
||||
const Component = DragDropContext(TestBackend)(() => <div/>);
|
||||
<Component ref={(instance: ContextComponent<{}, {}>) => {
|
||||
const backend = instance.getManager().getBackend() as TestBackend;
|
||||
backend.simulateBeginDrag(["1"]);
|
||||
backend.simulateBeginDrag(["1"], { foo: "bar" });
|
||||
|
||||
backend.simulateHover(["2"]);
|
||||
backend.simulateHover(["2"], { foo: "bar" });
|
||||
|
||||
backend.simulateDrop();
|
||||
backend.simulateEndDrag();
|
||||
backend.simulatePublishDragSource();
|
||||
}}/>;
|
||||
25
types/react-dnd-test-backend/tsconfig.json
Normal file
25
types/react-dnd-test-backend/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-dnd-test-backend-tests.tsx"
|
||||
]
|
||||
}
|
||||
6
types/react-dnd-test-backend/tslint.json
Normal file
6
types/react-dnd-test-backend/tslint.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"quotemark": [true, "double"]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user