mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-19 06:36:46 +08:00
Merge pull request #5257 from Asana/reactdnd-backend
Add the TestBackend module to React DnD
This commit is contained in:
@@ -13,6 +13,7 @@ import DragSource = ReactDnd.DragSource;
|
||||
import DropTarget = ReactDnd.DropTarget;
|
||||
import DragDropContext = ReactDnd.DragDropContext;
|
||||
import HTML5Backend = require('react-dnd/modules/backends/HTML5');
|
||||
import TestBackend = require('react-dnd/modules/backends/Test');
|
||||
|
||||
// Game Component
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -247,14 +248,18 @@ module Board {
|
||||
}
|
||||
}
|
||||
|
||||
var DndBoard = DragDropContext(HTML5Backend)(Board);
|
||||
export var create = React.createFactory(DndBoard);
|
||||
export var createWithHTMLBackend = React.createFactory(DragDropContext(HTML5Backend)(Board));
|
||||
export var createWithTestBackend = React.createFactory(DragDropContext(TestBackend)(Board));
|
||||
}
|
||||
|
||||
|
||||
// Render the Board Component
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Board.create({
|
||||
Board.createWithHTMLBackend({
|
||||
knightPosition: [0, 0]
|
||||
});
|
||||
|
||||
|
||||
Board.createWithTestBackend({
|
||||
knightPosition: [0, 0]
|
||||
});
|
||||
|
||||
16
react-dnd/react-dnd.d.ts
vendored
16
react-dnd/react-dnd.d.ts
vendored
@@ -170,3 +170,19 @@ declare module "react-dnd/modules/backends/HTML5" {
|
||||
|
||||
export = HTML5Backend;
|
||||
}
|
||||
|
||||
declare module "react-dnd/modules/backends/Test" {
|
||||
class TestBackend {
|
||||
setup(): void;
|
||||
teardown(): void;
|
||||
connectDragSource(): void;
|
||||
connectDropTarget(): void;
|
||||
simulateBeginDrag(sourceIds: __ReactDnd.Identifier[], options?: {}): void;
|
||||
simulatePublishDragSource(): void;
|
||||
simulateHover(targetIds: __ReactDnd.Identifier[], options?: {}): void;
|
||||
simulateDrop(): void;
|
||||
simulateEndDrag(): void;
|
||||
}
|
||||
|
||||
export = TestBackend;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user