forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtJS-tests.ts
87 lines (76 loc) · 2.82 KB
/
ExtJS-tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/// <reference path="ExtJS.d.ts" />
module MyApp.view {
export interface CompanyGridPanel extends Ext.grid.IPanel {
}
}
Ext.define("MyApp.view.CompanyGridPanel", <Ext.grid.IPanel>{
extend: "Ext.grid.Panel",
alias: ["widget.myApp-view-companyGridPanel"],
config: {
companyStore: null
},
initComponent: function () {
Ext.applyIf(this, {
itemId: "companyGridPanel",
title: "Company Listing",
store: this.companyStore,
columnLines: true,
columns: [
<Ext.grid.column.IColumn>{
xtype: "gridcolumn",
dataIndex: "company",
text: "Company",
flex: 1
}, <Ext.grid.column.INumber>{
xtype: "numbercolumn",
dataIndex: "price",
text: "Price",
renderer: Ext.util.Format.usMoney
}, <Ext.grid.column.INumber>{
xtype: "numbercolumn",
dataIndex: "change",
text: "Change",
format: "0.00"
}, <Ext.grid.column.INumber>{
xtype: "numbercolumn",
dataIndex: "pctChange",
text: "% Change",
format: "0.00"
}, <Ext.grid.column.IDate>{
xtype: "datecolumn",
dataIndex: "lastChange",
text: "Last Change"
}, <Ext.grid.column.IColumn>{
xtype: "gridcolumn",
dataIndex: "industry",
text: "Industry"
}
],
tbar: [
<Ext.form.field.ICheckbox>{
xtype: "checkbox",
itemId: "manufacturingFilter",
boxLabel: "Show only Manufacturing companies"
}
]
});
return this.callParent(arguments);
}
});
function test_create() {
var gridPanel: MyApp.view.CompanyGridPanel = Ext.create("MyApp.view.CompanyGridPanel");
var isVisible: boolean = gridPanel.isVisible();
gridPanel.setWidth(500);
var items: Ext.IComponent[] = gridPanel.items;
var columns: Ext.grid.IColumn[] = gridPanel.columns;
var isArray: boolean = Ext.isArray(columns);
}
function test_events() {
var gridPanel: MyApp.view.CompanyGridPanel = Ext.create("MyApp.view.CompanyGridPanel");
gridPanel.on("select", testEventHandler, this);
gridPanel.fireEvent("select", null, this);
}
function testEventHandler( grid, record, index, eventOptions) {
return true;
}
// TODO: Add more tests, but the Grid class is one of the most complex components in Ext JS, so using it tests a huge swathe of the underlying definition because it and its parents extend/implement a large number of types.