File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,23 @@ export const Mito = (props: MitoProps): JSX.Element => {
335
335
loadPlotly ( )
336
336
} , [ ] )
337
337
338
+ /**
339
+ * This useEffect handles when the user creates a graph, then presses undo.
340
+ */
341
+ useEffect ( ( ) => {
342
+ if ( uiState . currOpenTaskpane . type === TaskpaneType . GRAPH &&
343
+ analysisData . graphDataArray . length === 0 ) {
344
+ setUIState ( prevUIState => {
345
+ return {
346
+ ...prevUIState ,
347
+ currOpenTaskpane : { type : TaskpaneType . NONE } ,
348
+ selectedTabType : 'data' ,
349
+ selectedSheetIndex : 0
350
+ }
351
+ } )
352
+ }
353
+ } , [ analysisData . graphDataArray . length ] )
354
+
338
355
/*
339
356
When the number of sheets increases, we make sure
340
357
that the last sheet is highlighted. If it decreases,
Original file line number Diff line number Diff line change @@ -193,6 +193,14 @@ test.describe('Graph Functionality', () => {
193
193
await expect ( mito . getByText ( 'Facet row' ) ) . toBeInViewport ( ) ;
194
194
} ) ;
195
195
196
+ test ( 'Pressing undo after opening graph editor closes the graph editor' , async ( { page } ) => {
197
+ const mito = await getMitoFrameWithTestCSV ( page ) ;
198
+ await openGraphEditor ( mito , page ) ;
199
+ await mito . getByTitle ( / U n d o t h e m o s t r e c e n t e d i t / ) . click ( ) ;
200
+ await expect ( mito . locator ( '.tab-selected' , { hasText : 'test' } ) ) . toBeVisible ( ) ;
201
+ await expect ( mito . locator ( '.endo-column-header-final-text' ) . first ( ) ) . toHaveText ( 'Column1' ) ;
202
+ } ) ;
203
+
196
204
test ( 'Make a histogram and change the histogram specific configurations' , async ( { page } ) => {
197
205
const mito = await getMitoFrameWithTestCSV ( page ) ;
198
206
You can’t perform that action at this time.
0 commit comments