mirror of
https://github.com/apache/superset.git
synced 2026-04-22 17:45:21 +00:00
fix(sqllab): invalid dump sql shown after closing tab (#27295)
This commit is contained in:
@@ -75,6 +75,25 @@ describe('sqlLabReducer', () => {
|
||||
initialState.queryEditors.length,
|
||||
);
|
||||
});
|
||||
it('should select the latest query editor when tabHistory is empty', () => {
|
||||
const currentQE = newState.queryEditors[0];
|
||||
newState = {
|
||||
...initialState,
|
||||
tabHistory: [initialState.queryEditors[0]],
|
||||
};
|
||||
const action = {
|
||||
type: actions.REMOVE_QUERY_EDITOR,
|
||||
queryEditor: currentQE,
|
||||
};
|
||||
newState = sqlLabReducer(newState, action);
|
||||
expect(newState.queryEditors).toHaveLength(
|
||||
initialState.queryEditors.length - 1,
|
||||
);
|
||||
expect(newState.queryEditors.map(qe => qe.id)).not.toContainEqual(
|
||||
currentQE.id,
|
||||
);
|
||||
expect(newState.tabHistory).toEqual([initialState.queryEditors[2].id]);
|
||||
});
|
||||
it('should remove a query editor including unsaved changes', () => {
|
||||
expect(newState.queryEditors).toHaveLength(
|
||||
initialState.queryEditors.length + 1,
|
||||
|
||||
Reference in New Issue
Block a user