Skip to content

Commit

Permalink
feat(stage-wizard): wizard panel hidden by default (#5134)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcasimir authored Nov 20, 2023
1 parent 350ed69 commit 437476e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions packages/compass-aggregations/src/modules/side-panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ describe('side-panel module', function () {
fakeLocalStorage.restore();
});

it('starts with an open state', function () {
expect(store.getState().sidePanel.isPanelOpen).to.equal(true);
it('starts with an closed state', function () {
expect(store.getState().sidePanel.isPanelOpen).to.equal(false);
});

it('toggles the side panel', function () {
store.dispatch(toggleSidePanel() as any);
expect(store.getState().sidePanel.isPanelOpen).to.equal(false);
store.dispatch(toggleSidePanel() as any);
expect(store.getState().sidePanel.isPanelOpen).to.equal(true);
store.dispatch(toggleSidePanel() as any);
expect(store.getState().sidePanel.isPanelOpen).to.equal(false);
});

it('persists the last state', function () {
const store1 = configureStore();
expect(store1.getState().sidePanel.isPanelOpen).to.equal(true);
expect(store1.getState().sidePanel.isPanelOpen).to.equal(false);

store1.dispatch(toggleSidePanel() as any);
expect(store1.getState().sidePanel.isPanelOpen).to.equal(false);
expect(store1.getState().sidePanel.isPanelOpen).to.equal(true);

const store2 = configureStore();
expect(store2.getState().sidePanel.isPanelOpen).to.equal(false);
expect(store2.getState().sidePanel.isPanelOpen).to.equal(true);
});
});
});
10 changes: 5 additions & 5 deletions packages/compass-aggregations/src/stores/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ const configureStore = (options: ConfigureStoreOptions) => {
// side panel)
sidePanel: {
isPanelOpen:
// The panel is shown by default if THE FEATURE IS ENABLED IN
// PREFERENCES and initial state in localStorage is not set or
// `"true"` (not `"false"`)
// if the feature is enabled in preferences, the state of the
// panel is fetched and then kept in sync with a localStorage entry.
// The initial state, if the localStorage entry is not set,
// should be 'hidden'.
preferencesAccess.getPreferences().enableStageWizard &&
localStorage.getItem(INITIAL_PANEL_OPEN_LOCAL_STORAGE_KEY) !==
'false',
localStorage.getItem(INITIAL_PANEL_OPEN_LOCAL_STORAGE_KEY) === 'true',
},
},
applyMiddleware(
Expand Down

0 comments on commit 437476e

Please sign in to comment.