Revert changes on required fields label

This commit is contained in:
Gabriel Manussakis 2024-08-27 15:28:22 -03:00
parent 788a44e42f
commit 9eb689d7af
No known key found for this signature in database
GPG Key ID: 947CCD7D22B2FD1B
5 changed files with 30 additions and 48 deletions

View File

@ -749,11 +749,11 @@ test.describe( 'Shopper → Additional Checkout Fields', () => {
// Check text inputs in edit mode match the expected values.
const govIdInput = checkoutPageObject.page.getByLabel(
'Government ID * required',
'Government ID *',
{ exact: true }
);
const confirmGovIdInput = checkoutPageObject.page.getByLabel(
'Confirm government ID * required',
'Confirm government ID *',
{ exact: true }
);
await expect( govIdInput ).toHaveValue( '54321' );
@ -805,16 +805,13 @@ test.describe( 'Shopper → Additional Checkout Fields', () => {
// Check text inputs in edit mode match the expected values.
const shippingGovIdInput = checkoutPageObject.page.getByLabel(
'Government ID * required',
'Government ID *',
{ exact: true }
);
const shippingConfirmGovIdInput =
checkoutPageObject.page.getByLabel(
'Confirm government ID * required',
{
exact: true,
}
);
checkoutPageObject.page.getByLabel( 'Confirm government ID *', {
exact: true,
} );
await expect( shippingGovIdInput ).toHaveValue( '12345' );
await expect( shippingConfirmGovIdInput ).toHaveValue( '12345' );

View File

@ -17,10 +17,7 @@ jQuery( function( $ ) {
field.find( 'label' ).append(
'&nbsp;<abbr class="required" title="' +
wc_address_i18n_params.i18n_required_text +
'" aria-hidden="true">*</abbr>' +
'&nbsp;<span class="screen-reader-text">' +
wc_address_i18n_params.i18n_required_text +
'</span>'
'">*</abbr>'
);
}
} else {

View File

@ -237,7 +237,7 @@ function wc_set_loop_prop( $prop, $value = '' ) {
}
/**
* Set the current visbility for a product in the woocommerce_loop global.
* Set the current visibility for a product in the woocommerce_loop global.
*
* @since 4.4.0
* @param int $product_id Product it to cache visibility for.
@ -2879,7 +2879,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
}
$args['class'][] = 'validate-required';
$required = '&nbsp;<abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '" aria-hidden="true">*</abbr>&nbsp;<span class="screen-reader-text">' . esc_html__( 'required', 'woocommerce' ) . '</span>';
$required = '&nbsp;<abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '">*</abbr>';
} else {
$required = '&nbsp;<span class="optional">(' . esc_html__( 'optional', 'woocommerce' ) . ')</span>';
}
@ -3805,7 +3805,7 @@ function wc_empty_cart_message() {
// This adds the cart-empty classname to the notice to preserve backwards compatibility (for styling purposes etc).
$notice = str_replace( 'class="woocommerce-info"', 'class="cart-empty woocommerce-info"', $notice );
// Return the notice within a consistent wrapper element. This is targetted by some scripts such as cart.js.
// Return the notice within a consistent wrapper element. This is targeted by some scripts such as cart.js.
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<div class="wc-empty-cart-message">' . $notice . '</div>';
}

View File

@ -249,20 +249,16 @@ test.describe.serial(
).toBeVisible();
await page
.getByRole( 'textbox', { name: 'First name required' } )
.getByRole( 'textbox', { name: 'First name *' } )
.fill( customer.billing.us.first_name );
await page
.getByRole( 'textbox', { name: 'Last name required' } )
.getByRole( 'textbox', { name: 'Last name *' } )
.fill( customer.billing.us.last_name );
await page
.getByRole( 'textbox', {
name: 'Street address required',
} )
.getByRole( 'textbox', { name: 'Street address *' } )
.fill( customer.billing.us.address );
await page
.getByRole( 'textbox', {
name: 'Town / City required',
} )
.getByRole( 'textbox', { name: 'Town / City *' } )
.type( customer.billing.us.city );
await page
.locator( '#billing_country' )
@ -271,13 +267,13 @@ test.describe.serial(
.locator( '#billing_state' )
.selectOption( customer.billing.us.state );
await page
.getByRole( 'textbox', { name: 'ZIP Code required' } )
.getByRole( 'textbox', { name: 'ZIP Code *' } )
.type( customer.billing.us.zip );
await page
.getByLabel( 'Phone * required' )
.getByLabel( 'Phone *' )
.fill( customer.billing.us.phone );
await page
.getByLabel( 'Email address * required' )
.getByLabel( 'Email address *' )
.fill( customer.billing.us.email );
await expect(
@ -986,29 +982,25 @@ test.describe.serial(
).toBeVisible();
await page
.getByRole( 'textbox', { name: 'First name required' } )
.getByRole( 'textbox', { name: 'First name *' } )
.fill( customer.billing.us.first_name );
await page
.getByRole( 'textbox', { name: 'Last name required' } )
.getByRole( 'textbox', { name: 'Last name *' } )
.fill( customer.billing.us.last_name );
await page
.getByRole( 'textbox', {
name: 'Street address required',
} )
.getByRole( 'textbox', { name: 'Street address *' } )
.fill( customer.billing.us.address );
await page
.getByRole( 'textbox', {
name: 'Town / City required',
} )
.getByRole( 'textbox', { name: 'Town / City *' } )
.type( customer.billing.us.city );
await page
.getByRole( 'textbox', { name: 'ZIP Code required' } )
.getByRole( 'textbox', { name: 'ZIP Code *' } )
.type( customer.billing.us.zip );
await page
.getByLabel( 'Phone * required' )
.getByLabel( 'Phone *' )
.fill( customer.billing.us.phone );
await page
.getByLabel( 'Email address * required' )
.getByLabel( 'Email address *' )
.fill( customer.billing.us.email );
await expect(

View File

@ -365,27 +365,23 @@ test.describe(
await test.step( 'Complete the checkout form', async () => {
await page
.getByRole( 'textbox', { name: 'First name required' } )
.getByRole( 'textbox', { name: 'First name *' } )
.fill( 'Lisa' );
await page
.getByRole( 'textbox', { name: 'Last name required' } )
.getByRole( 'textbox', { name: 'Last name *' } )
.fill( 'Simpson' );
await page
.getByRole( 'textbox', { name: 'Street address' } )
.getByRole( 'textbox', { name: 'Street address *' } )
.fill( '123 Evergreen Terrace' );
await page
.getByRole( 'textbox', { name: 'Town / City required' } )
.getByRole( 'textbox', { name: 'Town / City *' } )
.fill( 'Springfield' );
await page.locator( '#billing_state' ).selectOption( 'OR' );
await page
.getByRole( 'textbox', { name: 'ZIP Code *' } )
.fill( '97403' );
await page
.getByLabel( 'Phone * required' )
.fill( '555 555-5555' );
await page
.getByLabel( 'Email address * required' )
.fill( guestEmail );
await page.getByLabel( 'Phone *' ).fill( '555 555-5555' );
await page.getByLabel( 'Email address *' ).fill( guestEmail );
await page.getByText( 'Cash on delivery' ).click();