forked from gridstack/gridstack.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgridstack-tests.ts
More file actions
24 lines (19 loc) · 831 Bytes
/
Copy pathgridstack-tests.ts
File metadata and controls
24 lines (19 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { GridStack, GridstackOptions, MousePosition } from '../src/gridstack';
var options: GridstackOptions = {
float: true
};
var grid: GridStack = GridStack.init(options);
var gsFromElement: GridStack = GridStack.get();
var gsFromElement2: GridStack = ($('.grid-stack').get(0) as any).gridstack;
if (gsFromElement !== grid) throw Error('These should match!');
if (gsFromElement2 !== grid) throw Error('These should match!');
var gridItem = '<div><div class="grid-stack-item-content"> Hello </div></div>'
grid.addWidget(gridItem, {width: 2});
grid.addWidget(gridItem, 1, 2, 3, 4, true);
grid.makeWidget(document.createElement('div'));
grid.batchUpdate();
grid.cellHeight();;
grid.cellHeight(2);
grid.cellWidth();
grid.getCellFromPixel(<MousePosition>{ left:20, top: 20 });
grid.removeAll(false);