Explore: Unsync time ranges when a pane is closed (#61369) (#61435)

* Explore: Unsync time ranges when a pane is closed (#61369)

* Explore: Unsync time ranges when a pane is closed

* remove unintentional import

(cherry picked from commit 1e33e56dbd)

* remove unneeded property
This commit is contained in:
Giordano Ricci
2023-01-13 00:51:14 +00:00
committed by GitHub
parent 225534841f
commit 58aa232a1b
2 changed files with 25 additions and 1 deletions
+24 -1
View File
@@ -141,9 +141,10 @@ describe('Explore reducer', () => {
.thenStateShouldEqual({
left: rightItemMock,
right: undefined,
syncedTimes: false,
} as unknown as ExploreState);
});
it('should reset right pane when it is closed ', () => {
it('should reset right pane when it is closed', () => {
const leftItemMock = {
containerWidth: 100,
} as unknown as ExploreItemState;
@@ -164,6 +165,28 @@ describe('Explore reducer', () => {
.thenStateShouldEqual({
left: leftItemMock,
right: undefined,
syncedTimes: false,
} as unknown as ExploreState);
});
it('should unsync time ranges', () => {
const itemMock = {
containerWidth: 100,
} as unknown as ExploreItemState;
const initialState = {
left: itemMock,
right: itemMock,
syncedTimes: true,
} as unknown as ExploreState;
reducerTester<ExploreState>()
.givenReducer(exploreReducer, initialState)
.whenActionIsDispatched(splitCloseAction({ itemId: ExploreId.right }))
.thenStateShouldEqual({
left: itemMock,
right: undefined,
syncedTimes: false,
} as unknown as ExploreState);
});
});
@@ -179,6 +179,7 @@ export const exploreReducer = (state = initialExploreState, action: AnyAction):
return {
...state,
...targetSplit,
syncedTimes: false,
};
}