mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Add a test for the drag and drop addon
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
import BigCalendar, { BigCalendarProps, Navigate, View, DateRange, DateLocalizer, ToolbarProps, EventWrapperProps } from "react-big-calendar";
|
||||
import withDragAndDrop from "react-big-calendar/lib/addons/dragAndDrop";
|
||||
|
||||
// Don't want to add this as a dependency, because it is only used for tests.
|
||||
declare const globalize: any;
|
||||
@@ -59,6 +60,30 @@ class CalendarResource {
|
||||
|
||||
ReactDOM.render(<Basic localizer={localizer} />, document.body);
|
||||
}
|
||||
|
||||
// Drag and Drop Example Test
|
||||
{
|
||||
interface Props {
|
||||
localizer: DateLocalizer;
|
||||
}
|
||||
const DragAndDropCalendar = withDragAndDrop(BigCalendar);
|
||||
const DnD = ({ localizer }: Props) => (
|
||||
<DragAndDropCalendar
|
||||
events={getEvents()}
|
||||
views={allViews}
|
||||
step={60}
|
||||
showMultiDayTimes
|
||||
defaultDate={new Date(2015, 3, 1)}
|
||||
localizer={localizer}
|
||||
onEventDrop={console.log}
|
||||
onEventResize={console.log}
|
||||
/>
|
||||
);
|
||||
|
||||
const localizer = BigCalendar.momentLocalizer(moment);
|
||||
|
||||
ReactDOM.render(<DnD localizer={localizer} />, document.body);
|
||||
}
|
||||
|
||||
{
|
||||
class MyCalendar extends BigCalendar<CalendarEvent, CalendarResource> {}
|
||||
|
||||
Reference in New Issue
Block a user