Skip to content

Commit ef2d66a

Browse files
committed
test: add the renderPane method use case
1 parent 3317dba commit ef2d66a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/workbench/editor/__tests__/group.test.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import 'reflect-metadata';
12
import React from 'react';
23
import { render, cleanup, fireEvent, waitFor } from '@testing-library/react';
34
import { tabItemActiveClassName } from 'mo/components/tabs/tab';
45

56
import EditorGroup from '../group';
7+
import { IEditorTab } from 'mo/model';
68

79
const TEST_ID = 'test-id';
810
const TEST_MENU = 'test-menu';
@@ -130,4 +132,24 @@ describe('The Editor Component', () => {
130132
expect(fn).toBeCalled();
131133
});
132134
});
135+
136+
test('use renderPane method', async () => {
137+
const renderPane = jest.fn((tabData, tab, group) => {
138+
return <div className={tab.id}>{tab.id}</div>;
139+
});
140+
141+
const testTab: IEditorTab = {
142+
id: TEST_ID,
143+
name: TEST_ID,
144+
data: {},
145+
renderPane,
146+
};
147+
148+
const { container } = render(
149+
<EditorGroup id="test" onClickActions={jest.fn()} tab={testTab} />
150+
);
151+
const renderDiv = container.querySelector(`.${TEST_ID}`);
152+
153+
expect(renderDiv?.innerHTML).toEqual(TEST_ID);
154+
});
133155
});

0 commit comments

Comments
 (0)