Skip to content
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 @@ -35,7 +35,7 @@ export interface TileShellProps {
className?: string;
/** Tile title, shown as the heading element that `titleAs` sets. */
title: ReactNode;
/** Heading element of the title, `h3` by default, or `h4` for a tile under an `h3` heading. */
/** Heading element of the title, `h3` by default. */
titleAs?: 'h3' | 'h4';
/** Label at the end of the header, such as a column name. */
headerLabel?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,32 @@ describe( 'LatestPostPerformance', () => {
] );
} );

it( 'should render the titles of the tiles as headings one level below the heading of the section', async () => {
provideLatestPostKeywordReport( registry );

const { getAllByRole, waitForRegistry } = render(
<LatestPostPerformance />,
{ registry }
);

await waitForRegistry();

expect(
getAllByRole( 'heading', { level: 3 } ).map(
( heading ) => heading.textContent
)
).toEqual( [ 'Latest post performance since published' ] );
expect(
getAllByRole( 'heading', { level: 4 } ).map(
( heading ) => heading.textContent
)
).toEqual( [
'Visitor breakdown',
'Traffic sources',
'Engagement & outcomes',
] );
} );

it( 'should request the top keyword for the post URL on the reference site, and should keep the Analytics rows, when the reference site URL differs from the home URL', async () => {
provideSiteInfo( registry, {
homeURL: 'https://example.com/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const LatestPostTile: FC< LatestPostTileProps > = ( { title, children } ) => {
baseClassName="googlesitekit-table-tile"
className="googlesitekit-traffic-overview__latest-post-tile"
title={ title }
titleAs="h4"
>
{ children }
</TileShell>
Expand Down
Loading