mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-28 09:25:50 +08:00
Minor test improvements
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
/// <reference path="ui-grid.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
interface MyEntity {
|
||||
interface IMyEntity {
|
||||
name: string;
|
||||
age: number;
|
||||
}
|
||||
|
||||
var columnDef: uiGrid.IColumnDefOf<MyEntity>;
|
||||
var columnDef: uiGrid.IColumnDefOf<IMyEntity>;
|
||||
columnDef.aggregationHideLabel = true;
|
||||
columnDef.aggregationHideLabel = false;
|
||||
columnDef.aggregationType = 1;
|
||||
@@ -14,13 +14,13 @@ columnDef.aggregationType = function () { return 1; };
|
||||
columnDef.cellClass = 'test';
|
||||
columnDef.cellClass = (gridRow, gridCol, index) => {
|
||||
//types of gridRow, gridCol, and index are flowed in correctly
|
||||
return 'pizza';
|
||||
return `${gridRow.entity.name}-${gridCol.field}-${index + 1}`;
|
||||
};
|
||||
columnDef.cellFilter = 'date';
|
||||
columnDef.cellTemplate = '<div blah="something">hello</div>';
|
||||
columnDef.cellTooltip = 'blah';
|
||||
columnDef.cellTooltip = function (gridRow: uiGrid.IGridRow, gridCol: uiGrid.IGridColumn) {
|
||||
return 'blah';
|
||||
return `${gridRow.entity.unknownProperty}-${gridCol.displayName}`;
|
||||
};
|
||||
columnDef.displayName = 'Jumper';
|
||||
columnDef.enableColumnMenu = false;
|
||||
@@ -46,7 +46,7 @@ columnDef.filterHeaderTemplate = '<div blah="test"></div>';
|
||||
columnDef.filters = [columnDef.filter];
|
||||
columnDef.footerCellClass = (gridRow, rowRenderIndex, gridCol, colRenderIndex) => {
|
||||
//types for gridRow, rowRenderIndex, gridCol, and colRenderIndex flow in properly
|
||||
return 'blah';
|
||||
return `${gridRow.entity.age}-${rowRenderIndex + 1}-${gridCol.field}-${colRenderIndex - 1}`;
|
||||
};
|
||||
columnDef.footerCellClass = 'theClass';
|
||||
columnDef.footerCellFilter = 'currency:$';
|
||||
@@ -54,7 +54,7 @@ columnDef.footerCellTemplate = '<div class="yoshi"></div>';
|
||||
columnDef.headerCellClass =
|
||||
(gridRow, rowRenderIndex, gridCol, colRenderIndex) => {
|
||||
//types for gridRow, rowRenderIndex, gridCol, and colRenderIndex flow in properly
|
||||
return 'blah';
|
||||
return `${gridRow.entity.age}-${rowRenderIndex + 1}-${gridCol.field}-${colRenderIndex - 1}`;
|
||||
};
|
||||
columnDef.headerCellClass = 'classy';
|
||||
columnDef.headerCellFilter = 'currency:$';
|
||||
@@ -63,7 +63,7 @@ columnDef.headerTooltip = false;
|
||||
columnDef.headerTooltip = 'The Tooltip';
|
||||
columnDef.headerTooltip = (col) => {
|
||||
//type of col flows in properly
|
||||
return 'tooly';
|
||||
return col.displayName;
|
||||
};
|
||||
columnDef.maxWidth = 200;
|
||||
columnDef.menuItems = [{
|
||||
@@ -95,10 +95,10 @@ columnDef.width = 100;
|
||||
columnDef.width = '*';
|
||||
|
||||
|
||||
var gridApi: uiGrid.IGridApi<MyEntity>;
|
||||
var gridInstance: uiGrid.IGridInstanceOf<MyEntity>;
|
||||
var gridApi: uiGrid.IGridApi<IMyEntity>;
|
||||
var gridInstance: uiGrid.IGridInstanceOf<IMyEntity>;
|
||||
var menuItem: uiGrid.IMenuItem;
|
||||
var colProcessor: uiGrid.IColumnProcessor<MyEntity>;
|
||||
var colProcessor: uiGrid.IColumnProcessor<IMyEntity>;
|
||||
|
||||
gridApi.core.clearAllFilters(true);
|
||||
gridApi.core.addToGridMenu(gridInstance, [menuItem]);
|
||||
@@ -108,7 +108,7 @@ gridApi.core.queueGridRefresh()
|
||||
gridApi.core.queueRefresh();
|
||||
gridApi.core.registerColumnsProcessor(colProcessor, 100);
|
||||
|
||||
var gridOptions: uiGrid.IGridOptionsOf<MyEntity> = {
|
||||
var gridOptions: uiGrid.IGridOptionsOf<IMyEntity> = {
|
||||
data: [{name: 'Bob', age: 100}],
|
||||
onRegisterApi: (api) => {
|
||||
api.selection.on.rowSelectionChanged(null, (row) => {
|
||||
@@ -116,7 +116,7 @@ var gridOptions: uiGrid.IGridOptionsOf<MyEntity> = {
|
||||
})
|
||||
}
|
||||
}
|
||||
interface AnotherEntity {
|
||||
interface IAnotherEntity {
|
||||
anObject: string
|
||||
}
|
||||
var anotherGridInstance: uiGrid.IGridInstance;
|
||||
|
||||
Reference in New Issue
Block a user