Skip to content

Commit

Permalink
Mobile Web: Ensure that sidebar is closed on the first visit
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Oct 11, 2019
1 parent 401ed23 commit 4c68cb2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/e2e-tests/specs/sidebar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* WordPress dependencies
*/
import {
findSidebarPanelWithTitle,
clearLocalStorage,
createNewPost,
findSidebarPanelWithTitle,
observeFocusLoss,
openDocumentSettingsSidebar,
pressKeyWithModifier,
Expand All @@ -21,6 +22,7 @@ describe( 'Sidebar', () => {

it( 'should have sidebar visible at the start with document sidebar active on desktop', async () => {
await setBrowserViewport( 'large' );
await clearLocalStorage();
await createNewPost();
const { nodesCount, content, height, width } = await page.$$eval( ACTIVE_SIDEBAR_TAB_SELECTOR, ( nodes ) => {
const firstNode = nodes[ 0 ];
Expand All @@ -45,13 +47,15 @@ describe( 'Sidebar', () => {

it( 'should have the sidebar closed by default on mobile', async () => {
await setBrowserViewport( 'small' );
await clearLocalStorage();
await createNewPost();
const sidebar = await page.$( SIDEBAR_SELECTOR );
expect( sidebar ).toBeNull();
} );

it( 'should close the sidebar when resizing from desktop to mobile', async () => {
await setBrowserViewport( 'large' );
await clearLocalStorage();
await createNewPost();

const sidebars = await page.$$( SIDEBAR_SELECTOR );
Expand All @@ -66,6 +70,7 @@ describe( 'Sidebar', () => {

it( 'should reopen sidebar the sidebar when resizing from mobile to desktop if the sidebar was closed automatically', async () => {
await setBrowserViewport( 'large' );
await clearLocalStorage();
await createNewPost();
await setBrowserViewport( 'small' );

Expand Down

0 comments on commit 4c68cb2

Please sign in to comment.