File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
src/workbench/editor/__tests__ Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ import 'reflect-metadata' ;
12import React from 'react' ;
23import { render , cleanup , fireEvent , waitFor } from '@testing-library/react' ;
34import { tabItemActiveClassName } from 'mo/components/tabs/tab' ;
45
56import EditorGroup from '../group' ;
7+ import { IEditorTab } from 'mo/model' ;
68
79const TEST_ID = 'test-id' ;
810const 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} ) ;
You can’t perform that action at this time.
0 commit comments