Tweak create-product-attribute spec (#42854)
* Adds missing aria-label and tabindex HTML attributes to the Help tip element for "Product data" on "Add new product" page. * Escape HTML tags * Added changelog * Update comment * Amend method for selecting "New attribute" placeholder. * Restore use of `getByRole()` and select first instance (two are being matched, in some cases). * Use last match (in some test runs, `getByRole()` is unexpectedly matching more than 1 heading. --------- Co-authored-by: Sagar Tamang <mi5t4n@gmail.com>
This commit is contained in:
parent
310de4cc9f
commit
d033a40b26
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Adds missing aria-label and tabindex HTML attributes to the Help tip element for "Product data" on "Add new product" page
|
|
@ -176,7 +176,10 @@ jQuery( function ( $ ) {
|
|||
function change_product_type_tip( content ) {
|
||||
$( '#tiptip_holder' ).removeAttr( 'style' );
|
||||
$( '#tiptip_arrow' ).removeAttr( 'style' );
|
||||
$( '.woocommerce-product-type-tip' ).tipTip( {
|
||||
$( '.woocommerce-product-type-tip' )
|
||||
.attr( 'tabindex', '0' )
|
||||
.attr( 'aria-label', $( '<div />' ).html( content ).text() ) // Remove HTML tags.
|
||||
.tipTip( {
|
||||
attribute: 'data-tip',
|
||||
content: content,
|
||||
fadeIn: 50,
|
||||
|
|
|
@ -73,7 +73,7 @@ test.describe( 'Add product attributes', () => {
|
|||
await expect(
|
||||
page.getByRole( 'heading', {
|
||||
name: 'New attribute',
|
||||
} )
|
||||
} ).first()
|
||||
).toBeVisible();
|
||||
} );
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ test.describe( 'Add product attributes', () => {
|
|||
await test.step( `Expect "${ attributeName }" to appear on the list of saved attributes, and expand it.`, async () => {
|
||||
const heading_attributeName = page.getByRole( 'heading', {
|
||||
name: attributeName,
|
||||
} );
|
||||
} ).last();
|
||||
|
||||
await expect( heading_attributeName ).toBeVisible();
|
||||
await heading_attributeName.click();
|
||||
|
|
Loading…
Reference in New Issue