Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Remove compatibility notice from Mini Cart block (#6803)
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhtungdu authored Aug 1, 2022
1 parent 33dfd70 commit 279d667
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 63 deletions.
2 changes: 0 additions & 2 deletions assets/js/blocks/mini-cart/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
import type { ReactElement } from 'react';
import { formatPrice } from '@woocommerce/price-format';
import { CartCheckoutCompatibilityNotice } from '@woocommerce/editor-components/compatibility-notices';
import { PanelBody, ExternalLink, SelectControl } from '@wordpress/components';
import { getSetting } from '@woocommerce/settings';
import { __ } from '@wordpress/i18n';
Expand Down Expand Up @@ -108,7 +107,6 @@ const Edit = ( { attributes, setAttributes }: Props ): ReactElement => {
<QuantityBadge count={ productCount } />
</button>
</Noninteractive>
<CartCheckoutCompatibilityNotice blockName="mini-cart" />
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useCompatibilityNotice } from './use-compatibility-notice';
import WooImage from './woo-image';

interface CartCheckoutCompatibilityNoticeProps {
blockName: 'cart' | 'checkout' | 'mini-cart';
blockName: 'cart' | 'checkout';
}

export function CartCheckoutCompatibilityNotice( {
Expand Down
60 changes: 0 additions & 60 deletions tests/e2e/specs/backend/mini-cart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
goToSiteEditor,
useTheme,
waitForCanvas,
addBlockToFSEArea,
} from '../../utils.js';

const block = {
Expand All @@ -30,8 +29,6 @@ const block = {
insertButton: "//button//span[text()='Mini Cart']",
insertButtonDisabled:
"//button[@aria-disabled]//span[text()='Mini Cart']",
compatibilityNoticeTitle:
"//h1[contains(text(), 'Compatibility notice')]",
},
};

Expand All @@ -40,14 +37,6 @@ if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 3 ) {
test.only( `skipping ${ block.name } tests`, () => {} );
}

const removeDismissedCompatibilityNoticesFromLocalStorage = async () => {
await page.evaluate( () => {
window.localStorage.removeItem(
'wc-blocks_dismissed_compatibility_notices'
);
} );
};

const addBlockToWidgetsArea = async () => {
await closeModalIfExists();
await openWidgetsEditorBlockInserter();
Expand All @@ -58,10 +47,6 @@ const addBlockToWidgetsArea = async () => {

describe( `${ block.name } Block`, () => {
describe( 'in widget editor', () => {
beforeAll( async () => {
await removeDismissedCompatibilityNoticesFromLocalStorage();
} );

beforeEach( async () => {
await openWidgetEditor();
} );
Expand All @@ -73,28 +58,6 @@ describe( `${ block.name } Block`, () => {
);
} );

it( 'the compatibility notice appears', async () => {
await addBlockToWidgetsArea();
const compatibilityNoticeTitle = await page.$x(
block.selectors.compatibilityNoticeTitle
);
expect( compatibilityNoticeTitle.length ).toBe( 1 );
} );

it( "after the compatibility notice is dismissed, it doesn't appear again", async () => {
await page.evaluate( () => {
window.localStorage.setItem(
'wc-blocks_dismissed_compatibility_notices',
'["mini-cart"]'
);
} );
await addBlockToWidgetsArea();
const compatibilityNoticeTitle = await page.$x(
block.selectors.compatibilityNoticeTitle
);
expect( compatibilityNoticeTitle.length ).toBe( 0 );
} );

it( 'can only be inserted once', async () => {
await addBlockToWidgetsArea();
const miniCartButton = await page.$x(
Expand All @@ -113,7 +76,6 @@ describe( `${ block.name } Block`, () => {
await goToSiteEditor(
process.env.GUTENBERG_EDITOR_CONTEXT || 'core'
);
await removeDismissedCompatibilityNoticesFromLocalStorage();
await waitForCanvas();
} );

Expand All @@ -122,28 +84,6 @@ describe( `${ block.name } Block`, () => {
await expect( canvas() ).toMatchElement( block.class );
} );

it( 'the compatibility notice appears', async () => {
await addBlockToFSEArea( block.name );
const compatibilityNoticeTitle = await page.$x(
block.selectors.compatibilityNoticeTitle
);
expect( compatibilityNoticeTitle.length ).toBe( 1 );
} );

it( "after the compatibility notice is dismissed, it doesn't appear again", async () => {
await page.evaluate( () => {
window.localStorage.setItem(
'wc-blocks_dismissed_compatibility_notices',
'["mini-cart"]'
);
} );
await addBlockToFSEArea( block.name );
const compatibilityNoticeTitle = await page.$x(
block.selectors.compatibilityNoticeTitle
);
expect( compatibilityNoticeTitle.length ).toBe( 0 );
} );

it( 'can only be inserted once', async () => {
await insertBlock( block.name );
await searchForFSEBlock( block.name );
Expand Down

0 comments on commit 279d667

Please sign in to comment.