When viewing the Accounts & Privacy tab in WooCommerce Settings, the page title in the breadcrumbs includes an "&".
Now "decodeEntities" method is used to correct the breadcrumb.
This commit is contained in:
Fernando 2020-02-05 11:35:50 -08:00 committed by GitHub
parent 8e0a6a18fd
commit 387bf188a4
2 changed files with 27 additions and 1 deletions

View File

@ -130,7 +130,7 @@ class Header extends Component {
) : (
section
);
return <span key={ i }>{ sectionPiece }</span>;
return <span key={ i }>{ decodeEntities( sectionPiece ) }</span>;
} ) }
</h1>
{ window.wcAdminFeatures[ 'activity-panels' ] && <ActivityPanel /> }

View File

@ -0,0 +1,26 @@
/**
* External dependencies
*
* @format
*/
import { shallow } from 'enzyme';
/**
* Internal dependencies
*/
import Header from '../index.js';
const encodedBreadcrumb = [
[ 'admin.php?page=wc-settings', 'Settings' ],
'Accounts &amp; Privacy',
];
describe( 'Header', () => {
test( 'should render decoded breadcrumb name', () => {
const header = shallow( <Header sections={ encodedBreadcrumb } isEmbedded={ true } />, {
disableLifecycleMethods: true,
} );
expect( header.text().includes( 'Accounts &amp; Privacy' ) ).toBe( false );
expect( header.text().includes( 'Accounts & Privacy' ) ).toBe( true );
} );
} );