Skip to content

Commit

Permalink
Playwright Utils: Change preference update method in setIsFixedToolbar (
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored and sethrubenstein committed Jul 13, 2023
1 parent f5c205d commit a9fcef3
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ import type { Editor } from './index';
*/
export async function setIsFixedToolbar( this: Editor, isFixed: boolean ) {
await this.page.evaluate( ( _isFixed ) => {
const { select, dispatch } = window.wp.data;
const isCurrentlyFixed =
select( 'core/edit-post' ).isFeatureActive( 'fixedToolbar' );
if ( isCurrentlyFixed !== _isFixed ) {
dispatch( 'core/edit-post' ).toggleFeature( 'fixedToolbar' );
}
window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-post', 'fixedToolbar', _isFixed );
}, isFixed );
}

0 comments on commit a9fcef3

Please sign in to comment.