DefinitelyTyped/types/gridstack/gridstack-tests.ts
Alain Dumesny 87d5672ede Updated definition to match gridstack v0.5 (#40208)
* Updated definition to match gridstack v0.5.0

* added more code samples in doc
* added missing methods based on all methods in the code
* fixed unesseray white space, and lint issues if set to strict

this will become the base if/when I switch gridstack code base to TS

* Updated definition to match gridstack v0.5.0

* added more code samples in doc
* added missing methods based on all methods in the code
* fixed extra white space, and stricter lint issues (like in my projects)

this will become the base if/when I switch gridstack code base to TS now that I'm co-owner

* identation fix

* added GridStackWidgetType and changed all el: to that type

* fixed more indentation issues

* renamed to GridStackElement, added @example

* fixed cellHeight(val: number | string

* more @example

* renamed to GridstackOptions without I

* IGridstackOptions -> GridstackOptions rename as that was the only interface with cap I.
* angular and typescript style guide recomends not using I in front (just like classes) unlike C#
2019-11-13 14:48:51 -08:00

22 lines
764 B
TypeScript

/// <reference types="jquery"/>
var options: GridstackOptions = {
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.addWidget(document.createElement('div'), 1, 2, 3, 4, true);
gridstack.addWidget($(document.createElement('div')), 1, 2, 3, 4, true);
gridstack.makeWidget($(document.createElement('div')));
gridstack.batchUpdate();
gridstack.cellHeight();;
gridstack.cellHeight(2);
gridstack.cellWidth();
gridstack.getCellFromPixel(<MousePosition>{ left:20, top: 20 });
gridstack.removeAll(false);