table column with iconcss (#13056)

This commit is contained in:
Vladimir Chernov
2020-10-31 02:23:38 +03:00
committed by GitHub
parent 2f571d868b
commit da6f800f11
11 changed files with 168 additions and 41 deletions

View File

@@ -5,10 +5,12 @@
import * as assert from 'assert';
import TableComponent from 'sql/workbench/browser/modelComponents/table.component';
import { CssIconCellValue } from 'sql/base/browser/ui/table/formatters';
suite('TableComponent Tests', () => {
setup(() => {
});
test('Table transformData should convert data and columns successfully given valid inputs', () => {
@@ -17,7 +19,9 @@ suite('TableComponent Tests', () => {
['4', '5', '6']
];
let columns = ['c1', 'c2', 'c3'];
let actual: { [key: string]: string }[] = TableComponent.transformData(data, columns);
const tableComponent = new TableComponent(undefined, undefined, undefined);
let actual: { [key: string]: string | CssIconCellValue }[] = tableComponent.transformData(data, columns);
let expected: { [key: string]: string }[] = [
{
'c1': '1',
@@ -35,8 +39,9 @@ suite('TableComponent Tests', () => {
test('Table transformData should return empty array given undefined rows', () => {
let data = undefined;
const tableComponent = new TableComponent(undefined, undefined, undefined);
let columns = ['c1', 'c2', 'c3'];
let actual: { [key: string]: string }[] = TableComponent.transformData(data, columns);
let actual: { [key: string]: string | CssIconCellValue }[] = tableComponent.transformData(data, columns);
let expected: { [key: string]: string }[] = [];
assert.deepEqual(actual, expected);
});
@@ -47,7 +52,8 @@ suite('TableComponent Tests', () => {
['4', '5', '6']
];
let columns;
let actual: { [key: string]: string }[] = TableComponent.transformData(data, columns);
const tableComponent = new TableComponent(undefined, undefined, undefined);
let actual: { [key: string]: string | CssIconCellValue }[] = tableComponent.transformData(data, columns);
let expected: { [key: string]: string }[] = [];
assert.deepEqual(actual, expected);
});
@@ -57,8 +63,9 @@ suite('TableComponent Tests', () => {
['1', '2'],
['4', '5']
];
const tableComponent = new TableComponent(undefined, undefined, undefined);
let columns = ['c1', 'c2', 'c3'];
let actual: { [key: string]: string }[] = TableComponent.transformData(data, columns);
let actual: { [key: string]: string | CssIconCellValue }[] = tableComponent.transformData(data, columns);
let expected: { [key: string]: string }[] = [
{
'c1': '1',