DefinitelyTyped/gridstack/gridstack-tests.ts
Ricky Blankenaufulland d4864b74ed fixed how the GridStack object is obtained
jQuery plugins return the jQuery object, to get the plugin, also in the case of GridStack 0.2.6 (latest) you use the data() method with the correct name
2017-03-09 14:58:30 +01:00

25 lines
758 B
TypeScript

/// <reference types="jquery"/>
// Type definitions for Gridstack
// Project: http://troolee.github.io/gridstack.js/
// Definitions by: Pascal Senn <https://github.com/PascalSenn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
var options = <IGridstackOptions> {
float: true
};
var element: JQuery = $(document).gridstack(options);
var gridstack: GridStack = $(document).data("gridstack");
var gsFromElement: GridStack = element.data("gridstack");
if (gridstack !== gsFromElement) throw Error('These should match!');
gridstack.addWidget("test", 1, 2, 3, 4, true);
gridstack.batchUpdate();
gridstack.cellHeight();;
gridstack.cellHeight(2);
gridstack.cellWidth();
gridstack.getCellFromPixel(<MousePosition>{ left:20, top: 20 });