Make Homescreen Default to Single Column Layout (https://github.com/woocommerce/woocommerce-admin/pull/7969)

* Add database migration deleting layout option

* Remove calls to update the option

* Remove unused variable

* Add changelog

* Remove unused var (lint failure)

* Increase e2e test timeout to 1000

* Fix test: navigate to homescreen

Co-authored-by: Moon <moon.kyong@automattic.com>
This commit is contained in:
Adrian Duffell 2021-11-30 05:04:34 +08:00 committed by GitHub
parent b19ca6b4d1
commit b9b4c82dca
8 changed files with 16 additions and 15 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: Fix
Ensure homescreen defaults to single column layout. #7969

View File

@ -76,7 +76,6 @@ export const Tasks: React.FC< TasksProps > = ( { query } ) => {
const taskListsFinished = false;
updateOptions( {
woocommerce_task_list_prompt_shown: true,
woocommerce_default_homepage_layout: 'two_columns',
} );
}, [ taskLists, isResolving ] );

View File

@ -147,7 +147,6 @@ describe( 'Task', () => {
);
expect( updateOptions ).toHaveBeenCalledWith( {
woocommerce_task_list_prompt_shown: true,
woocommerce_default_homepage_layout: 'two_columns',
} );
} );

View File

@ -3,7 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import { useEffect } from '@wordpress/element';
import { useDispatch, useSelect } from '@wordpress/data';
import { useSelect } from '@wordpress/data';
import { ONBOARDING_STORE_NAME, OPTIONS_STORE_NAME } from '@woocommerce/data';
/**
@ -30,7 +30,6 @@ const taskDashboardSelect = ( select ) => {
};
const TaskDashboard = ( { query, twoColumns } ) => {
const { updateOptions } = useDispatch( OPTIONS_STORE_NAME );
const {
keepCompletedTaskList,
isResolving: isResolvingOptions,
@ -119,16 +118,6 @@ const TaskDashboard = ( { query, twoColumns } ) => {
'Get ready to start selling',
'woocommerce-admin'
) }
onComplete={ () =>
updateOptions( {
woocommerce_default_homepage_layout: 'two_columns',
} )
}
onHide={ () =>
updateOptions( {
woocommerce_default_homepage_layout: 'two_columns',
} )
}
/>
) }
</>

View File

@ -310,6 +310,13 @@ function wc_admin_update_290_update_apperance_task_option() {
delete_option( 'woocommerce_task_list_appearance_complete' );
}
/**
* Delete the old woocommerce_default_homepage_layout option.
*/
function wc_admin_update_290_delete_default_homepage_layout_option() {
delete_option( 'woocommerce_default_homepage_layout' );
}
/**
* Update DB Version.
*/

View File

@ -54,6 +54,5 @@ export class PaymentsSetup extends BasePage {
async enableCashOnDelivery() {
await this.page.waitForSelector( '.woocommerce-task-payment-cod' );
await this.clickButtonWithText( 'Enable' );
await waitForTimeout( 500 );
}
}

View File

@ -77,6 +77,9 @@ const testAdminPaymentSetupTask = () => {
await waitForTimeout( 1000 );
await homeScreen.clickOnTaskList( 'Set up payments' );
await paymentsSetup.enableCashOnDelivery();
await homeScreen.navigate();
await homeScreen.isDisplayed();
await waitForTimeout( 1000 );
await homeScreen.clickOnTaskList( 'Set up payments' );
await paymentsSetup.isDisplayed();
await paymentsSetup.methodHasBeenSetup( 'cod' );

View File

@ -71,6 +71,7 @@ class Install {
),
'2.9.0' => array(
'wc_admin_update_290_update_apperance_task_option',
'wc_admin_update_290_delete_default_homepage_layout_option',
'wc_admin_update_290_db_version',
),
'3.0.0' => array(