Decode breadcrumb correctly (https://github.com/woocommerce/woocommerce-admin/pull/3653)
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:
parent
8e0a6a18fd
commit
387bf188a4
|
@ -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 /> }
|
||||
|
|
|
@ -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 & Privacy',
|
||||
];
|
||||
|
||||
describe( 'Header', () => {
|
||||
test( 'should render decoded breadcrumb name', () => {
|
||||
const header = shallow( <Header sections={ encodedBreadcrumb } isEmbedded={ true } />, {
|
||||
disableLifecycleMethods: true,
|
||||
} );
|
||||
expect( header.text().includes( 'Accounts & Privacy' ) ).toBe( false );
|
||||
expect( header.text().includes( 'Accounts & Privacy' ) ).toBe( true );
|
||||
} );
|
||||
} );
|
Loading…
Reference in New Issue