Skip to content

Commit

Permalink
Merge branch 'master' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
wjgogogo committed Dec 7, 2023
2 parents a6fcba6 + 741e27a commit b5c7965
Show file tree
Hide file tree
Showing 15 changed files with 1,303 additions and 115 deletions.

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions packages/s2-core/__tests__/spreadsheet/theme-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable jest/expect-expect */
import { createPivotSheet } from 'tests/util/helpers';
import { createPivotSheet, createTableSheet } from 'tests/util/helpers';
import type { Group, IGroup, ShapeAttrs } from '@antv/g-canvas';
import { get } from 'lodash';
import type {
Expand Down Expand Up @@ -52,10 +52,16 @@ describe('SpreadSheet Theme Tests', () => {
CellTypes.MERGED_CELL,
];

test('should get default theme', () => {
test('should get pivot sheet default theme', () => {
expect(s2.theme).toMatchSnapshot();
});

test('should get table sheet theme', () => {
const tableSheet = createTableSheet(null);

expect(tableSheet.theme).toMatchSnapshot();
});

test.each(CELL_TYPES)(
"should assign the same color for %s's text and icon",
(cellType: CellTypes) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
*/
import { assembleDataCfg } from 'tests/util';
import type { S2DataConfig } from '@/common/interface';
import { TableSheet } from '@/sheet-type';
import { SpreadSheet, TableSheet } from '@/sheet-type';
import { TableDataSet } from '@/data-set/table-data-set';

jest.mock('@/sheet-type');
jest.mock('@/facet/layout/node');
const MockTableSheet = TableSheet as any as jest.Mock<TableSheet>;

describe('Table Mode Dataset Test', () => {
let s2: SpreadSheet;
let dataSet: TableDataSet;

const mockNumberFormatter = jest.fn().mockReturnValue('number');
const mockSubTypeFormatter = jest.fn().mockReturnValue('sub_type');
const mockTypeFormatter = jest.fn().mockReturnValue('type');
Expand Down Expand Up @@ -56,9 +58,12 @@ describe('Table Mode Dataset Test', () => {
},
],
};

beforeEach(() => {
MockTableSheet.mockClear();
dataSet = new TableDataSet(new MockTableSheet());

s2 = new MockTableSheet();
dataSet = new TableDataSet(s2);

dataSet.setDataCfg(dataCfg);
});
Expand Down
Loading

0 comments on commit b5c7965

Please sign in to comment.