Fix panel toggle for Gutenberg 9.1

[MAILPOET-3154]
This commit is contained in:
Pavel Dohnal
2020-10-07 11:08:51 +02:00
committed by Veljko V
parent eb75c0c6c5
commit 14b6b88f9b
2 changed files with 6 additions and 16 deletions

View File

@ -46,23 +46,13 @@ describe('Toggle Sidebar Panel Reducer', () => {
const action = {
type: 'TOGGLE_SIDEBAR_PANEL',
id: 'nice-panel',
toggleTo: 'opened',
toggleTo: true,
};
reducer(initialState, action);
let finalState = reducer(initialState, action);
expect(finalState.sidebar.openedPanels).to.include('nice-panel');
action.toggleTo = 'closed';
action.toggleTo = false;
finalState = reducer(initialState, action);
expect(finalState.sidebar.openedPanels).to.not.include('nice-panel');
});
it('Should throw an error for unexpected toggleTo value', () => {
const action = {
type: 'TOGGLE_SIDEBAR_PANEL',
id: 'nice-panel',
toggleTo: 'nonsense',
};
expect(() => (reducer(initialState, action)))
.to.throw('Unexpected toggleTo value "nonsense"');
});
});