Skip to content

Commit

Permalink
test: 单测修复
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Nov 17, 2023
1 parent 356bfe8 commit 0aec291
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions packages/s2-shared/__tests__/utils/options-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { DEFAULT_MOBILE_OPTIONS, DeviceType, LayoutWidthTypes } from '@antv/s2';
import {
DEFAULT_MOBILE_OPTIONS,
DeviceType,
LayoutWidthTypes,
type S2Options,
} from '@antv/s2';
import { omit, pick } from 'lodash';
import {
getBaseSheetComponentOptions,
Expand Down Expand Up @@ -87,7 +92,9 @@ describe('Options Tests', () => {
"enable": true,
"operation": Object {
"hiddenColumns": true,
"menus": Array [],
"menu": Object {
"items": Array [],
},
"sort": true,
},
},
Expand All @@ -98,33 +105,38 @@ describe('Options Tests', () => {
});

test('should get custom options', () => {
const options = getBaseSheetComponentOptions({
const tooltipOptions: S2Options = {
tooltip: {
enable: false,
operation: {
sort: false,
menus: [
{
key: 'custom',
text: 'custom',
},
],
menu: {
items: [
{
key: 'custom',
label: 'custom',
},
],
},
},
},
});
};
const options = getBaseSheetComponentOptions(tooltipOptions);

expect(options.tooltip).toMatchInlineSnapshot(`
Object {
"autoAdjustBoundary": "body",
"enable": false,
"operation": Object {
"hiddenColumns": true,
"menus": Array [
Object {
"key": "custom",
"text": "custom",
},
],
"menu": Object {
"items": Array [
Object {
"key": "custom",
"label": "custom",
},
],
},
"sort": false,
},
}
Expand Down

0 comments on commit 0aec291

Please sign in to comment.