Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add publication ID in publicationSelect component. #9076

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import PropTypes from 'prop-types';
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';
import { useCallback } from '@wordpress/element';

/**
Expand Down Expand Up @@ -130,7 +130,13 @@ export default function PublicationSelect( props ) {
( { publicationId, displayName } ) => (
// eslint-disable-next-line sitekit/acronym-case
<Option key={ publicationId } value={ publicationId }>
{ displayName }
{ sprintf(
/* translators: 1: Publication display name, 2: Publication ID */
__( '%1$s (%2$s)', 'google-site-kit' ),
displayName,
// eslint-disable-next-line sitekit/acronym-case
publicationId
) }
</Option>
)
) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ describe( 'PublicationSelect', () => {
// eslint-disable-next-line sitekit/acronym-case
publications[ index ].publicationId
);

expect( listItem.textContent ).toEqual(
// eslint-disable-next-line sitekit/acronym-case
`${ publications[ index ].displayName } (${ publications[ index ].publicationId })`
);
} );
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ export default function SetupMain() {

<div>
<p>
This is just added as a placeholder component to assist with
testing.
{ __(
'Select your preferred publication to connect with Site Kit',
'google-site-kit'
) }
</p>
<PublicationSelect />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe( 'SetupMain', () => {
// TODO: Adjust the tests once #8800 is implemented.
expect(
getByText(
/This is just added as a placeholder component to assist with testing./i
/Select your preferred publication to connect with Site Kit/i
)
).toBeInTheDocument();
} );
Expand Down
Loading