The theme switch was three labelled radios that wrapped the header onto a second line with long translations. It is three SVG buttons now, with search and menu sharing the same language: no resting outline, a filled chip for the active choice. Radios gave arrow-key roving for free, so the group reimplements it rather than losing it. The first chip colour put accent on accent and failed WCAG AA; the label carries full contrast instead. Mobile targets sit at 45px because a floor of exactly 44 rounds to 43.99997 in Firefox. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
940 lines
41 KiB
JavaScript
940 lines
41 KiB
JavaScript
import { expect, test } from '@playwright/test';
|
|
import { injectAxe } from 'axe-playwright';
|
|
|
|
const destinations = [
|
|
[ 'Journal', '/journal/' ],
|
|
[ 'Projects', '/projects/' ],
|
|
[ 'Music', '/music/' ],
|
|
[ 'Podcasts', '/podcasts/' ],
|
|
[ 'About', '/about/' ],
|
|
];
|
|
|
|
const reviewViewports = [
|
|
{ width: 375, height: 812 },
|
|
{ width: 768, height: 1024 },
|
|
{ width: 1440, height: 900 },
|
|
{ width: 2560, height: 1440 },
|
|
];
|
|
|
|
async function expectTargetSize( locator ) {
|
|
const box = await locator.boundingBox();
|
|
expect( box.width ).toBeGreaterThanOrEqual( 44 );
|
|
expect( box.height ).toBeGreaterThanOrEqual( 44 );
|
|
}
|
|
|
|
async function getHomeURL( page ) {
|
|
return page.getByRole( 'banner' ).getByRole( 'link', { name: 'CHRNX' } ).getAttribute( 'href' );
|
|
}
|
|
|
|
async function getBox( locator ) {
|
|
const box = await locator.boundingBox();
|
|
expect( box ).not.toBeNull();
|
|
return box;
|
|
}
|
|
|
|
async function getContentBox( locator ) {
|
|
return locator.evaluate( ( element ) => {
|
|
const box = element.getBoundingClientRect();
|
|
const style = window.getComputedStyle( element );
|
|
const paddingLeft = Number.parseFloat( style.paddingLeft );
|
|
const paddingRight = Number.parseFloat( style.paddingRight );
|
|
return {
|
|
x: box.x + paddingLeft,
|
|
width: box.width - paddingLeft - paddingRight,
|
|
};
|
|
} );
|
|
}
|
|
|
|
function expectNoOverlap( boxes ) {
|
|
for ( let first = 0; first < boxes.length; first += 1 ) {
|
|
for ( let second = first + 1; second < boxes.length; second += 1 ) {
|
|
const a = boxes[ first ];
|
|
const b = boxes[ second ];
|
|
const overlaps =
|
|
a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y;
|
|
expect( overlaps ).toBe( false );
|
|
}
|
|
}
|
|
}
|
|
|
|
async function expectNoHorizontalOverflow( page, header ) {
|
|
expect( await header.evaluate( ( element ) => element.scrollWidth <= element.clientWidth ) ).toBe(
|
|
true,
|
|
);
|
|
expect(
|
|
await page.evaluate(
|
|
() => document.documentElement.scrollWidth <= document.documentElement.clientWidth,
|
|
),
|
|
).toBe( true );
|
|
}
|
|
|
|
function parseColor( value ) {
|
|
const channels = value.match( /[\d.]+/g ).map( Number );
|
|
if ( value.startsWith( 'color(srgb' ) ) {
|
|
return channels.slice( 0, 3 ).map( ( channel ) => channel * 255 );
|
|
}
|
|
return channels.slice( 0, 3 );
|
|
}
|
|
|
|
function contrastRatio( first, second ) {
|
|
const luminance = ( color ) => {
|
|
const channels = parseColor( color ).map( ( channel ) => {
|
|
const normalized = channel / 255;
|
|
return normalized <= 0.04045 ? normalized / 12.92 : ( ( normalized + 0.055 ) / 1.055 ) ** 2.4;
|
|
} );
|
|
return 0.2126 * channels[ 0 ] + 0.7152 * channels[ 1 ] + 0.0722 * channels[ 2 ];
|
|
};
|
|
const lighter = Math.max( luminance( first ), luminance( second ) );
|
|
const darker = Math.min( luminance( first ), luminance( second ) );
|
|
return ( lighter + 0.05 ) / ( darker + 0.05 );
|
|
}
|
|
|
|
function firstComputedColor( value ) {
|
|
return value.match( /(?:rgba?\([^)]*\)|color\(srgb[^)]*\))/ )?.[ 0 ] ?? '';
|
|
}
|
|
|
|
function colorAlpha( value ) {
|
|
if ( value === 'transparent' ) {
|
|
return 0;
|
|
}
|
|
const slashAlpha = value.match( /\/\s*([\d.]+)\s*\)$/ );
|
|
if ( slashAlpha ) {
|
|
return Number.parseFloat( slashAlpha[ 1 ] );
|
|
}
|
|
const channels = value.match( /[\d.]+/g )?.map( Number ) ?? [];
|
|
return value.startsWith( 'rgba(' ) && channels.length >= 4 ? channels[ 3 ] : 1;
|
|
}
|
|
|
|
async function expectContainedTarget( locator, viewportWidth ) {
|
|
const box = await getBox( locator );
|
|
expect( box.x ).toBeGreaterThanOrEqual( 0 );
|
|
expect( box.x + box.width ).toBeLessThanOrEqual( viewportWidth );
|
|
expect( box.width ).toBeGreaterThanOrEqual( 44 );
|
|
expect( box.height ).toBeGreaterThanOrEqual( 44 );
|
|
}
|
|
|
|
test.describe( 'site navigation shell', () => {
|
|
for ( const theme of [ 'light', 'dark' ] ) {
|
|
test( `${ theme } navigation and footer expose the integrated editorial treatment`, async ( {
|
|
page,
|
|
} ) => {
|
|
await page.setViewportSize( { width: 1280, height: 800 } );
|
|
await page.goto( '/' );
|
|
await page.evaluate( ( value ) => localStorage.setItem( 'chrnx-theme', value ), theme );
|
|
await page.goto( '/music/' );
|
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', theme );
|
|
|
|
const header = page.getByRole( 'banner' );
|
|
const footer = page.getByRole( 'contentinfo' );
|
|
const headerNav = header.getByRole( 'navigation', { name: 'Primary navigation' } );
|
|
const footerNav = footer.getByRole( 'navigation', { name: 'Footer navigation' } );
|
|
for ( const nav of [ headerNav, footerNav ] ) {
|
|
const current = nav.getByRole( 'link', { name: 'Music', exact: true } );
|
|
await expect( nav.locator( '[aria-current="page"]' ) ).toHaveCount( 1 );
|
|
await expect( current ).toHaveAttribute( 'aria-current', 'page' );
|
|
const currentStyle = await current.evaluate( ( element ) => {
|
|
const style = window.getComputedStyle( element );
|
|
const marker = window.getComputedStyle( element, '::after' );
|
|
const surface = window.getComputedStyle( element.closest( 'header, footer' ) );
|
|
return {
|
|
color: style.color,
|
|
decoration: style.textDecorationLine,
|
|
fontFamily: style.fontFamily,
|
|
fontWeight: Number.parseInt( style.fontWeight, 10 ),
|
|
fontSize: Number.parseFloat( style.fontSize ),
|
|
letterSpacing: Number.parseFloat( style.letterSpacing ),
|
|
markerContent: marker.content,
|
|
markerWidth: Number.parseFloat( marker.width ),
|
|
markerHeight: Number.parseFloat( marker.height ),
|
|
markerOpacity: Number.parseFloat( marker.opacity ),
|
|
surface: surface.backgroundColor,
|
|
};
|
|
} );
|
|
expect( currentStyle.decoration ).toBe( 'none' );
|
|
expect( currentStyle.fontFamily ).toContain( 'Zen Maru Gothic' );
|
|
expect( currentStyle.fontWeight ).toBe( 500 );
|
|
expect( currentStyle.fontSize ).toBeLessThanOrEqual( 16 );
|
|
expect( currentStyle.letterSpacing ).toBeGreaterThan( 0 );
|
|
expect( contrastRatio( currentStyle.color, currentStyle.surface ) ).toBeGreaterThanOrEqual(
|
|
4.5,
|
|
);
|
|
expect( currentStyle.markerContent ).not.toBe( 'none' );
|
|
expect( currentStyle.markerWidth ).toBeGreaterThan( 0 );
|
|
expect( currentStyle.markerHeight ).toBeGreaterThanOrEqual( 2 );
|
|
expect( currentStyle.markerOpacity ).toBe( 1 );
|
|
|
|
const hover = nav.getByRole( 'link', { name: 'Projects', exact: true } );
|
|
await hover.hover();
|
|
const hoverStyle = await hover.evaluate( ( element ) => {
|
|
const style = window.getComputedStyle( element );
|
|
const marker = window.getComputedStyle( element, '::after' );
|
|
const surface = window.getComputedStyle( element.closest( 'header, footer' ) );
|
|
return {
|
|
color: style.color,
|
|
decoration: style.textDecorationLine,
|
|
markerOpacity: Number.parseFloat( marker.opacity ),
|
|
surface: surface.backgroundColor,
|
|
};
|
|
} );
|
|
expect( hoverStyle.decoration ).toBe( 'none' );
|
|
expect( hoverStyle.markerOpacity ).toBe( 1 );
|
|
expect( contrastRatio( hoverStyle.color, hoverStyle.surface ) ).toBeGreaterThanOrEqual(
|
|
4.5,
|
|
);
|
|
}
|
|
|
|
await page.goto( '/' );
|
|
await expect( page.locator( 'header [aria-current], footer [aria-current]' ) ).toHaveCount(
|
|
0,
|
|
);
|
|
await page.goto( '/music/' );
|
|
const footerStyle = await footer.evaluate( ( element ) => {
|
|
const style = window.getComputedStyle( element );
|
|
const innerStyle = window.getComputedStyle(
|
|
element.querySelector( '.chrnx-site-footer__inner' ),
|
|
);
|
|
const siteStyle = window.getComputedStyle(
|
|
element.querySelector( '.chrnx-site-footer__site' ),
|
|
);
|
|
const creditStyle = window.getComputedStyle(
|
|
element.querySelector( '.chrnx-site-footer__credit' ),
|
|
);
|
|
const lineStyle = window.getComputedStyle(
|
|
element.querySelector( '.chrnx-site-footer__line' ),
|
|
);
|
|
return {
|
|
background: style.backgroundColor,
|
|
borderStyle: style.borderTopStyle,
|
|
borderWidth: Number.parseFloat( style.borderTopWidth ),
|
|
borderColor: style.borderTopColor,
|
|
paddingTop: Number.parseFloat( innerStyle.paddingTop ),
|
|
paddingBottom: Number.parseFloat( innerStyle.paddingBottom ),
|
|
siteFamily: siteStyle.fontFamily,
|
|
siteWeight: Number.parseInt( siteStyle.fontWeight, 10 ),
|
|
siteSize: Number.parseFloat( siteStyle.fontSize ),
|
|
creditFamily: creditStyle.fontFamily,
|
|
creditSize: Number.parseFloat( creditStyle.fontSize ),
|
|
lineFamily: lineStyle.fontFamily,
|
|
};
|
|
} );
|
|
expect( colorAlpha( footerStyle.background ) ).toBe( 1 );
|
|
expect( footerStyle.borderStyle ).not.toBe( 'none' );
|
|
expect( footerStyle.borderWidth ).toBeGreaterThanOrEqual( 1 );
|
|
expect( colorAlpha( footerStyle.borderColor ) ).toBeGreaterThan( 0 );
|
|
expect( footerStyle.paddingTop ).toBeGreaterThanOrEqual( 24 );
|
|
expect( footerStyle.paddingBottom ).toBeGreaterThanOrEqual( 24 );
|
|
expect( footerStyle.siteFamily ).toContain( 'Zen Maru Gothic' );
|
|
expect( footerStyle.siteWeight ).toBeGreaterThanOrEqual( 700 );
|
|
expect( footerStyle.siteSize ).toBeGreaterThan( footerStyle.creditSize );
|
|
expect( footerStyle.creditFamily ).toMatch( /monospace|Menlo|Monaco|Consolas/ );
|
|
expect( footerStyle.lineFamily ).toBe( footerStyle.creditFamily );
|
|
} );
|
|
}
|
|
|
|
for ( const theme of [ 'light', 'dark' ] ) {
|
|
test( `${ theme } footer site link has hover and focus affordances`, async ( { page } ) => {
|
|
await page.setViewportSize( { width: 1280, height: 800 } );
|
|
await page.goto( '/' );
|
|
await page.evaluate( ( value ) => localStorage.setItem( 'chrnx-theme', value ), theme );
|
|
await page.goto( '/music/' );
|
|
|
|
const siteLink = page.locator( '.chrnx-site-footer__site a' );
|
|
const resting = await siteLink.evaluate( ( element ) => {
|
|
const style = window.getComputedStyle( element );
|
|
const marker = window.getComputedStyle( element, '::after' );
|
|
return {
|
|
color: style.color,
|
|
decoration: style.textDecorationLine,
|
|
markerContent: marker.content,
|
|
markerOpacity: Number.parseFloat( marker.opacity ),
|
|
};
|
|
} );
|
|
expect( resting.decoration ).toBe( 'none' );
|
|
expect( resting.markerContent ).not.toBe( 'none' );
|
|
expect( resting.markerOpacity ).toBe( 0 );
|
|
|
|
await siteLink.hover();
|
|
const hovered = await siteLink.evaluate( ( element ) => {
|
|
const style = window.getComputedStyle( element );
|
|
const marker = window.getComputedStyle( element, '::after' );
|
|
const footer = window.getComputedStyle( element.closest( 'footer' ) );
|
|
return {
|
|
color: style.color,
|
|
decoration: style.textDecorationLine,
|
|
markerHeight: Number.parseFloat( marker.height ),
|
|
markerOpacity: Number.parseFloat( marker.opacity ),
|
|
surface: footer.backgroundColor,
|
|
};
|
|
} );
|
|
expect( hovered.color ).not.toBe( resting.color );
|
|
expect( hovered.decoration ).toBe( 'none' );
|
|
expect( hovered.markerHeight ).toBeGreaterThanOrEqual( 2 );
|
|
expect( hovered.markerOpacity ).toBe( 1 );
|
|
expect( contrastRatio( hovered.color, hovered.surface ) ).toBeGreaterThanOrEqual( 4.5 );
|
|
|
|
await page.mouse.move( 0, 0 );
|
|
await siteLink.focus();
|
|
const focused = await siteLink.evaluate( ( element ) => {
|
|
const style = window.getComputedStyle( element );
|
|
const marker = window.getComputedStyle( element, '::after' );
|
|
const footer = window.getComputedStyle( element.closest( 'footer' ) );
|
|
return {
|
|
color: style.color,
|
|
boxShadow: style.boxShadow,
|
|
markerOpacity: Number.parseFloat( marker.opacity ),
|
|
surface: footer.backgroundColor,
|
|
targetHeight: element.getBoundingClientRect().height,
|
|
};
|
|
} );
|
|
expect( focused.color ).not.toBe( resting.color );
|
|
expect( focused.boxShadow ).not.toBe( 'none' );
|
|
expect( focused.markerOpacity ).toBe( 1 );
|
|
expect( contrastRatio( focused.color, focused.surface ) ).toBeGreaterThanOrEqual( 4.5 );
|
|
expect( focused.targetHeight ).toBeGreaterThanOrEqual( 44 );
|
|
} );
|
|
}
|
|
|
|
test( 'desktop has a stable accessible header, approved local brand, and compact footer', async ( {
|
|
page,
|
|
}, testInfo ) => {
|
|
await page.setViewportSize( { width: 1280, height: 800 } );
|
|
await page.goto( '/' );
|
|
const skip = page.getByRole( 'link', { name: 'Skip to content' } );
|
|
await page.keyboard.press( testInfo.project.name === 'webkit' ? 'Alt+Tab' : 'Tab' );
|
|
await expect( skip ).toBeFocused();
|
|
await expect( skip ).toHaveAttribute( 'href', '#chrnx-main' );
|
|
await skip.press( 'Enter' );
|
|
await expect( page.locator( '#chrnx-main' ) ).toBeFocused();
|
|
|
|
const header = page.getByRole( 'banner' );
|
|
const nav = header.getByRole( 'navigation', { name: 'Primary navigation' } );
|
|
await expect( header ).toBeVisible();
|
|
await expect( nav ).toBeVisible();
|
|
await expect( header.getByRole( 'search' ) ).toBeVisible();
|
|
await expect( header.locator( '[data-chrnx-theme-toggle]' ) ).toBeVisible();
|
|
const brand = header.getByRole( 'img', { name: 'CHRNX' } );
|
|
await expect( brand ).toBeVisible();
|
|
const brandSource = await brand.getAttribute( 'src' );
|
|
expect( new URL( brandSource, page.url() ).origin ).toBe( new URL( page.url() ).origin );
|
|
expect( new URL( brandSource, page.url() ).pathname ).toMatch(
|
|
/\/wp-content\/themes\/chrnx\/assets\/icons\/chrnx-wordmark\.svg$/,
|
|
);
|
|
|
|
expect( await header.getByRole( 'navigation' ).count() ).toBe( 1 );
|
|
const homeURL = await getHomeURL( page );
|
|
for ( const [ name, path ] of destinations ) {
|
|
const link = nav.getByRole( 'link', { name, exact: true } );
|
|
await expect( link ).toHaveAttribute( 'href', new URL( path.slice( 1 ), homeURL ).href );
|
|
}
|
|
await expect( header.locator( '[data-chrnx-menu-toggle]' ) ).toBeHidden();
|
|
const compactSearch = header.locator( '[data-chrnx-search-button]' );
|
|
await expect( compactSearch ).toBeVisible();
|
|
await expect( compactSearch ).toHaveAccessibleName( 'Open search' );
|
|
await expect( header.getByRole( 'searchbox' ) ).toBeHidden();
|
|
await expectTargetSize( compactSearch );
|
|
await compactSearch.click();
|
|
await expect( header.getByRole( 'searchbox' ) ).toBeVisible();
|
|
await expect( header.getByRole( 'searchbox' ) ).toBeFocused();
|
|
await expect( compactSearch ).toHaveAccessibleName( 'Search' );
|
|
await page.keyboard.press( 'Escape' );
|
|
await expect( compactSearch ).toBeFocused();
|
|
await expect( header.getByRole( 'searchbox' ) ).toBeHidden();
|
|
await compactSearch.click();
|
|
await header.getByRole( 'searchbox' ).fill( 'portable cats' );
|
|
await compactSearch.click();
|
|
await expect( page ).toHaveURL( new RegExp( `[?&]s=portable(?:\\+|%20)cats(?:&|$)` ) );
|
|
const before = await header.boundingBox();
|
|
await page.evaluate( () => window.scrollTo( 0, document.body.scrollHeight ) );
|
|
const after = await header.boundingBox();
|
|
expect( after.y ).toBe( 0 );
|
|
expect( after.height ).toBe( before.height );
|
|
|
|
const footer = page.getByRole( 'contentinfo' );
|
|
await expect( footer ).toBeVisible();
|
|
expect(
|
|
await footer
|
|
.locator( '.chrnx-site-footer__inner' )
|
|
.evaluate( ( element ) => window.getComputedStyle( element ).display ),
|
|
).toBe( 'flex' );
|
|
await expect( footer.getByRole( 'navigation', { name: 'Footer navigation' } ) ).toBeVisible();
|
|
await expect( footer.getByText( 'Made in Sinaloa, shared from home.' ) ).toBeVisible();
|
|
await expect(
|
|
footer.locator( 'form, a[href*="facebook"], a[href*="spotify"], a[href*="youtube"]' ),
|
|
).toHaveCount( 0 );
|
|
} );
|
|
|
|
test( 'visible keyboard focus and minimum target sizes survive layout', async ( { page } ) => {
|
|
await page.setViewportSize( { width: 1280, height: 800 } );
|
|
await page.goto( '/' );
|
|
const journal = page
|
|
.getByRole( 'banner' )
|
|
.getByRole( 'link', { name: 'Journal', exact: true } );
|
|
await journal.focus();
|
|
expect(
|
|
await journal.evaluate( ( element ) => window.getComputedStyle( element ).outlineStyle ),
|
|
).not.toBe( 'none' );
|
|
await expectTargetSize( journal );
|
|
await expectTargetSize(
|
|
page.getByRole( 'banner' ).getByRole( 'button', { name: 'Open search' } ),
|
|
);
|
|
} );
|
|
|
|
test( 'mobile navigation follows normal Tab order and Escape restores the trigger', async ( {
|
|
page,
|
|
}, testInfo ) => {
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
const open = header.locator( '[data-chrnx-menu-toggle]' );
|
|
const compactSearch = header.locator( '[data-chrnx-search-button]' );
|
|
const theme = header.locator( '[data-chrnx-theme-button]' );
|
|
const focusKey = testInfo.project.name === 'webkit' ? 'Alt+Tab' : 'Tab';
|
|
await compactSearch.focus();
|
|
await page.keyboard.press( focusKey );
|
|
await expect( theme ).toBeFocused();
|
|
await page.keyboard.press( focusKey );
|
|
await expect( open ).toBeFocused();
|
|
await expect( open ).toBeVisible();
|
|
await expect( open ).toHaveAccessibleName( 'Open primary navigation' );
|
|
await expectTargetSize( open );
|
|
await open.click();
|
|
await expect( open ).toHaveAccessibleName( 'Close primary navigation' );
|
|
const nav = header.getByRole( 'navigation', { name: 'Primary navigation' } );
|
|
await expect( nav ).toBeVisible();
|
|
const homeURL = await getHomeURL( page );
|
|
for ( const [ name, path ] of destinations ) {
|
|
await expect( nav.getByRole( 'link', { name, exact: true } ) ).toHaveAttribute(
|
|
'href',
|
|
new URL( path.slice( 1 ), homeURL ).href,
|
|
);
|
|
}
|
|
await open.focus();
|
|
for ( const [ name ] of destinations ) {
|
|
await page.keyboard.press( focusKey );
|
|
await expect( nav.getByRole( 'link', { name, exact: true } ) ).toBeFocused();
|
|
}
|
|
await nav.getByRole( 'link', { name: 'Music', exact: true } ).focus();
|
|
await page.keyboard.press( 'Escape' );
|
|
await expect( open ).toBeFocused();
|
|
await expect( open ).toHaveAccessibleName( 'Open primary navigation' );
|
|
await expect( nav ).toBeHidden();
|
|
await expect( compactSearch ).toHaveAccessibleName( 'Open search' );
|
|
await expectTargetSize( compactSearch );
|
|
await compactSearch.click();
|
|
await expect( header.getByRole( 'searchbox' ) ).toBeVisible();
|
|
await page.setViewportSize( { width: 1280, height: 800 } );
|
|
await expect( open ).toBeHidden();
|
|
await expect( nav ).toBeVisible();
|
|
await expect( open ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
} );
|
|
|
|
for ( const width of [ 375, 599 ] ) {
|
|
test( `compact mobile header keeps one closed bar at ${ width }px`, async ( { page } ) => {
|
|
await page.setViewportSize( { width, height: 844 } );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
const brandLink = header.getByRole( 'link', { name: 'CHRNX home' } );
|
|
const brand = header.getByRole( 'img', { name: 'CHRNX' } );
|
|
const search = header.getByRole( 'button', { name: 'Open search', exact: true } );
|
|
const theme = header.getByRole( 'button', { name: 'Choose color theme', exact: true } );
|
|
const menu = header.getByRole( 'button', {
|
|
name: 'Open primary navigation',
|
|
exact: true,
|
|
} );
|
|
|
|
await expect( search ).toHaveCount( 1 );
|
|
await expect( theme ).toHaveCount( 1 );
|
|
await expect( menu ).toHaveCount( 1 );
|
|
await expect( search ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
await expect( theme ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
await expect( menu ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
|
|
const boxes = await Promise.all(
|
|
[ brandLink, search, theme, menu ].map( ( locator ) => getBox( locator ) ),
|
|
);
|
|
const [ brandBox, ...controlBoxes ] = boxes;
|
|
for ( const box of controlBoxes ) {
|
|
expect( box.width ).toBeGreaterThanOrEqual( 44 );
|
|
expect( box.width ).toBeLessThanOrEqual( 45 );
|
|
expect( box.height ).toBeGreaterThanOrEqual( 44 );
|
|
expect( box.height ).toBeLessThanOrEqual( 45 );
|
|
}
|
|
for ( const box of boxes.slice( 1 ) ) {
|
|
expect( Math.abs( box.y - brandBox.y ) ).toBeLessThanOrEqual( 1 );
|
|
}
|
|
expectNoOverlap( boxes );
|
|
|
|
const headerBox = await getBox( header );
|
|
expect( headerBox.height ).toBeGreaterThanOrEqual( 68 );
|
|
expect( headerBox.height ).toBeLessThanOrEqual( 76 );
|
|
await expectNoHorizontalOverflow( page, header );
|
|
|
|
const imageGeometry = await brand.evaluate( ( image ) => {
|
|
const imageBox = image.getBoundingClientRect();
|
|
const linkBox = image.parentElement.getBoundingClientRect();
|
|
return {
|
|
renderedRatio: imageBox.width / imageBox.height,
|
|
intrinsicRatio:
|
|
Number.parseFloat( image.getAttribute( 'width' ) ) /
|
|
Number.parseFloat( image.getAttribute( 'height' ) ),
|
|
fits:
|
|
imageBox.left >= linkBox.left &&
|
|
imageBox.right <= linkBox.right &&
|
|
imageBox.top >= linkBox.top &&
|
|
imageBox.bottom <= linkBox.bottom,
|
|
};
|
|
} );
|
|
expect( imageGeometry.fits ).toBe( true );
|
|
expect( Math.abs( imageGeometry.renderedRatio - imageGeometry.intrinsicRatio ) ).toBeLessThan(
|
|
0.02,
|
|
);
|
|
} );
|
|
|
|
test( `compact mobile header exposes one usable panel at ${ width }px`, async ( { page } ) => {
|
|
await page.setViewportSize( { width, height: 844 } );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
const inner = header.locator( '.chrnx-site-header__inner' );
|
|
const searchButton = header.locator( '[data-chrnx-search-button]' );
|
|
const themeButton = header.locator( '[data-chrnx-theme-button]' );
|
|
const menuButton = header.locator( '[data-chrnx-menu-toggle]' );
|
|
const searchPanel = header.locator( '[data-chrnx-search-panel]' );
|
|
const themePanel = header.locator( '[data-chrnx-theme-panel]' );
|
|
const nav = header.getByRole( 'navigation', { name: 'Primary navigation' } );
|
|
|
|
await searchButton.click();
|
|
await expect( searchButton ).toHaveAccessibleName( 'Search' );
|
|
await expect( searchButton ).toHaveAttribute( 'aria-expanded', 'true' );
|
|
await expect( menuButton ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
await expect( themeButton ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
await expect( searchPanel ).toBeVisible();
|
|
await expect( nav ).toBeHidden();
|
|
await expect( themePanel ).toBeHidden();
|
|
const innerBox = await getContentBox( inner );
|
|
const searchBox = await getBox( searchPanel );
|
|
const searchTriggerBox = await getBox( searchButton );
|
|
expect( Math.abs( searchBox.x - innerBox.x ) ).toBeLessThanOrEqual( 1 );
|
|
expect( Math.abs( searchBox.width - innerBox.width ) ).toBeLessThanOrEqual( 1 );
|
|
expect( searchBox.y ).toBeGreaterThanOrEqual( searchTriggerBox.y + searchTriggerBox.height );
|
|
await expectNoHorizontalOverflow( page, header );
|
|
|
|
await menuButton.click();
|
|
await expect( menuButton ).toHaveAccessibleName( 'Close primary navigation' );
|
|
await expect( menuButton ).toHaveAttribute( 'aria-expanded', 'true' );
|
|
await expect( searchButton ).toHaveAccessibleName( 'Open search' );
|
|
await expect( searchButton ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
await expect( themeButton ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
await expect( searchPanel ).toBeHidden();
|
|
await expect( nav ).toBeVisible();
|
|
await expect( themePanel ).toBeHidden();
|
|
const navBox = await getBox( nav );
|
|
const menuTriggerBox = await getBox( menuButton );
|
|
expect( Math.abs( navBox.x - innerBox.x ) ).toBeLessThanOrEqual( 1 );
|
|
expect( Math.abs( navBox.width - innerBox.width ) ).toBeLessThanOrEqual( 1 );
|
|
expect( navBox.y ).toBeGreaterThanOrEqual( menuTriggerBox.y + menuTriggerBox.height );
|
|
await expectNoHorizontalOverflow( page, header );
|
|
|
|
await themeButton.click();
|
|
await expect( themeButton ).toHaveAccessibleName( 'Choose color theme' );
|
|
await expect( themeButton ).toHaveAttribute( 'aria-expanded', 'true' );
|
|
await expect( menuButton ).toHaveAccessibleName( 'Open primary navigation' );
|
|
await expect( menuButton ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
await expect( searchButton ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
await expect( searchPanel ).toBeHidden();
|
|
await expect( nav ).toBeHidden();
|
|
await expect( themePanel ).toBeVisible();
|
|
const themeBox = await getBox( themePanel );
|
|
expect( themeBox.x ).toBeGreaterThanOrEqual( 0 );
|
|
expect( themeBox.x + themeBox.width ).toBeLessThanOrEqual( width );
|
|
for ( const name of [ 'Light', 'Dark', 'System' ] ) {
|
|
const radio = header.getByRole( 'button', { name, exact: true } );
|
|
await expect( radio ).toBeVisible();
|
|
const radioBox = await getBox( radio );
|
|
expect( radioBox.width ).toBeGreaterThan( 0 );
|
|
expect( radioBox.height ).toBeGreaterThan( 0 );
|
|
await expectContainedTarget( radio, width );
|
|
}
|
|
await expectNoHorizontalOverflow( page, header );
|
|
} );
|
|
}
|
|
|
|
for ( const scenario of [ 'long translated labels', '200% root text' ] ) {
|
|
test( `compact mobile header contains theme controls with ${ scenario }`, async ( {
|
|
page,
|
|
} ) => {
|
|
const width = 375;
|
|
await page.setViewportSize( { width, height: 844 } );
|
|
await page.goto( '/' );
|
|
if ( scenario === 'long translated labels' ) {
|
|
await page
|
|
.locator( '[data-chrnx-theme-panel] [data-chrnx-theme-value]' )
|
|
.evaluateAll( ( buttons ) => {
|
|
const translations = [
|
|
'Helles Erscheinungsbild verwenden',
|
|
'Dunkles Erscheinungsbild verwenden',
|
|
'Automatisch dem Farbschema des Betriebssystems folgen',
|
|
];
|
|
// The label is the accessible name only; icons carry the layout.
|
|
buttons.forEach( ( button, index ) => {
|
|
button.querySelector( '.chrnx-screen-reader-text' ).textContent =
|
|
translations[ index ];
|
|
} );
|
|
} );
|
|
} else {
|
|
await page.evaluate( () => {
|
|
document.documentElement.style.fontSize = '200%';
|
|
} );
|
|
}
|
|
|
|
const header = page.getByRole( 'banner' );
|
|
const panel = header.locator( '[data-chrnx-theme-panel]' );
|
|
await header.locator( '[data-chrnx-theme-button]' ).click();
|
|
await expect( panel ).toBeVisible();
|
|
const contained = [ panel, ...( await panel.locator( 'label, input[type="radio"]' ).all() ) ];
|
|
for ( const control of contained ) {
|
|
const box = await getBox( control );
|
|
expect( box.x ).toBeGreaterThanOrEqual( 0 );
|
|
expect( box.x + box.width ).toBeLessThanOrEqual( width );
|
|
}
|
|
for ( const label of await panel.locator( 'label' ).all() ) {
|
|
await expectContainedTarget( label, width );
|
|
}
|
|
await expectNoHorizontalOverflow( page, header );
|
|
} );
|
|
}
|
|
|
|
for ( const colorScheme of [ 'light', 'dark' ] ) {
|
|
test( `compact mobile header has contrasting rounded ${ colorScheme } focus halos`, async ( {
|
|
page,
|
|
} ) => {
|
|
await page.emulateMedia( { colorScheme } );
|
|
await page.setViewportSize( { width: 375, height: 844 } );
|
|
await page.goto( '/' );
|
|
await page.evaluate( ( theme ) => {
|
|
document.documentElement.dataset.theme = theme;
|
|
document.documentElement.style.colorScheme = theme;
|
|
}, colorScheme );
|
|
const header = page.getByRole( 'banner' );
|
|
for ( const selector of [
|
|
'[data-chrnx-search-button]',
|
|
'[data-chrnx-theme-button]',
|
|
'[data-chrnx-menu-toggle]',
|
|
] ) {
|
|
const control = header.locator( selector );
|
|
await control.focus();
|
|
const colors = await control.evaluate( ( element ) => {
|
|
const controlStyle = window.getComputedStyle( element );
|
|
const headerStyle = window.getComputedStyle( element.closest( 'header' ) );
|
|
return {
|
|
boxShadow: controlStyle.boxShadow,
|
|
borderRadius: Number.parseFloat( controlStyle.borderRadius ),
|
|
outline: controlStyle.outlineColor,
|
|
outlineStyle: controlStyle.outlineStyle,
|
|
background: headerStyle.backgroundColor,
|
|
};
|
|
} );
|
|
const halo = firstComputedColor( colors.boxShadow );
|
|
expect( colors.boxShadow ).not.toBe( 'none' );
|
|
expect( halo ).not.toBe( '' );
|
|
expect( colors.borderRadius ).toBeGreaterThan( 0 );
|
|
expect( colors.outlineStyle ).not.toBe( 'none' );
|
|
expect( colorAlpha( colors.outline ) ).toBe( 0 );
|
|
expect( contrastRatio( halo, colors.background ) ).toBeGreaterThanOrEqual( 3 );
|
|
}
|
|
} );
|
|
}
|
|
|
|
test( 'compact mobile header stops at the exact 599px boundary', async ( { page } ) => {
|
|
for ( const width of [ 600, 1280 ] ) {
|
|
await page.setViewportSize( { width, height: 800 } );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
const nav = header.getByRole( 'navigation', { name: 'Primary navigation' } );
|
|
const themePanel = header.locator( '[data-chrnx-theme-panel]' );
|
|
await expect( nav ).toBeVisible();
|
|
await expect( themePanel ).toBeVisible();
|
|
await expect( header.getByRole( 'button', { name: 'System', exact: true } ) ).toBeVisible();
|
|
await expect( header.locator( '[data-chrnx-menu-toggle]' ) ).toBeHidden();
|
|
await expect( header.locator( '[data-chrnx-theme-button]' ) ).toBeHidden();
|
|
await expect( header.getByRole( 'button', { name: 'Open search' } ) ).toBeVisible();
|
|
await expect( header.getByRole( 'searchbox' ) ).toBeHidden();
|
|
await expectNoHorizontalOverflow( page, header );
|
|
|
|
const headerBox = await getBox( header );
|
|
if ( width === 600 ) {
|
|
expect( headerBox.height ).toBeGreaterThan( 100 );
|
|
} else {
|
|
expect( headerBox.height ).toBeGreaterThanOrEqual( 65 );
|
|
expect( headerBox.height ).toBeLessThanOrEqual( 75 );
|
|
}
|
|
}
|
|
} );
|
|
|
|
test( 'resize never leaves focus inside hidden navigation', async ( { page } ) => {
|
|
await page.setViewportSize( { width: 1280, height: 800 } );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
const nav = header.getByRole( 'navigation', { name: 'Primary navigation' } );
|
|
const journal = nav.getByRole( 'link', { name: 'Journal', exact: true } );
|
|
const toggle = header.locator( '[data-chrnx-menu-toggle]' );
|
|
await journal.focus();
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await expect( nav ).toBeHidden();
|
|
await expect( toggle ).toBeFocused();
|
|
await toggle.click();
|
|
await journal.focus();
|
|
await page.setViewportSize( { width: 1280, height: 800 } );
|
|
await expect( nav ).toBeVisible();
|
|
await expect( journal ).toBeFocused();
|
|
} );
|
|
|
|
test( 'mobile panels exclude each other while retained search submits on its active click', async ( {
|
|
page,
|
|
} ) => {
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
const searchButton = header.locator( '[data-chrnx-search-button]' );
|
|
const searchInput = header.getByRole( 'searchbox' );
|
|
const searchPanel = header.locator( '[data-chrnx-search-panel]' );
|
|
const themeButton = header.locator( '[data-chrnx-theme-button]' );
|
|
const themePanel = header.locator( '[data-chrnx-theme-panel]' );
|
|
const menuButton = header.locator( '[data-chrnx-menu-toggle]' );
|
|
const nav = header.getByRole( 'navigation', { name: 'Primary navigation' } );
|
|
|
|
await searchButton.click();
|
|
await searchInput.fill( 'retained cats' );
|
|
await themeButton.click();
|
|
await expect( searchPanel ).toBeHidden();
|
|
await expect( themePanel ).toBeVisible();
|
|
await expect( nav ).toBeHidden();
|
|
await menuButton.click();
|
|
await expect( searchPanel ).toBeHidden();
|
|
await expect( themePanel ).toBeHidden();
|
|
await expect( nav ).toBeVisible();
|
|
|
|
await searchButton.click();
|
|
await expect( searchPanel ).toBeVisible();
|
|
await expect( searchInput ).toHaveValue( 'retained cats' );
|
|
await expect( searchInput ).toBeFocused();
|
|
await expect( themePanel ).toBeHidden();
|
|
await expect( nav ).toBeHidden();
|
|
await searchButton.click();
|
|
await expect( page ).toHaveURL( new RegExp( `[?&]s=retained(?:\\+|%20)cats(?:&|$)` ) );
|
|
} );
|
|
|
|
test( 'real Tab order crosses all mobile controls without a focus trap', async ( {
|
|
page,
|
|
}, testInfo ) => {
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
const searchButton = header.locator( '[data-chrnx-search-button]' );
|
|
const themeButton = header.locator( '[data-chrnx-theme-button]' );
|
|
const menuButton = header.locator( '[data-chrnx-menu-toggle]' );
|
|
const nav = header.getByRole( 'navigation', { name: 'Primary navigation' } );
|
|
const links = destinations.map( ( [ name ] ) =>
|
|
nav.getByRole( 'link', { name, exact: true } ),
|
|
);
|
|
const firstMainLink = page.locator( 'main#chrnx-main a[href]' ).first();
|
|
const focusKey = testInfo.project.name === 'webkit' ? 'Alt+Tab' : 'Tab';
|
|
const reverseFocusKey = testInfo.project.name === 'webkit' ? 'Alt+Shift+Tab' : 'Shift+Tab';
|
|
|
|
await searchButton.focus();
|
|
await page.keyboard.press( focusKey );
|
|
await expect( themeButton ).toBeFocused();
|
|
await page.keyboard.press( focusKey );
|
|
await expect( menuButton ).toBeFocused();
|
|
await menuButton.press( 'Enter' );
|
|
for ( const link of links ) {
|
|
await page.keyboard.press( focusKey );
|
|
await expect( link ).toBeFocused();
|
|
}
|
|
await page.keyboard.press( focusKey );
|
|
await expect( firstMainLink ).toBeFocused();
|
|
|
|
await links[ 0 ].focus();
|
|
await page.keyboard.press( reverseFocusKey );
|
|
await expect( menuButton ).toBeFocused();
|
|
} );
|
|
|
|
test( 'desktop Search focus returns to its visible trigger when mobile closes the panel', async ( {
|
|
page,
|
|
} ) => {
|
|
await page.setViewportSize( { width: 600, height: 844 } );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
const searchButton = header.locator( '[data-chrnx-search-button]' );
|
|
const searchInput = header.getByRole( 'searchbox' );
|
|
const searchPanel = header.locator( '[data-chrnx-search-panel]' );
|
|
|
|
await searchButton.click();
|
|
await expect( searchInput ).toBeFocused();
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await expect( searchPanel ).toBeHidden();
|
|
await expect( searchInput ).toBeHidden();
|
|
await expect( searchButton ).toBeVisible();
|
|
await expect( searchButton ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
await expect( searchButton ).toBeFocused();
|
|
} );
|
|
|
|
test( 'resize sends focus only from controls that become hidden', async ( { page } ) => {
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await page.goto( '/' );
|
|
let header = page.getByRole( 'banner' );
|
|
const searchButton = header.locator( '[data-chrnx-search-button]' );
|
|
const searchInput = header.getByRole( 'searchbox' );
|
|
|
|
await searchButton.click();
|
|
await expect( searchInput ).toBeFocused();
|
|
await page.setViewportSize( { width: 600, height: 844 } );
|
|
await expect( searchButton ).toBeFocused();
|
|
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await page.goto( '/' );
|
|
header = page.getByRole( 'banner' );
|
|
let themeButton = header.locator( '[data-chrnx-theme-button]' );
|
|
let checkedTheme = header.locator(
|
|
'[data-chrnx-theme-panel] [data-chrnx-theme-value][aria-pressed="true"]',
|
|
);
|
|
await expect( themeButton ).toBeVisible();
|
|
await themeButton.focus();
|
|
await page.setViewportSize( { width: 600, height: 844 } );
|
|
await expect( checkedTheme ).toBeFocused();
|
|
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await page.goto( '/' );
|
|
header = page.getByRole( 'banner' );
|
|
let menuButton = header.locator( '[data-chrnx-menu-toggle]' );
|
|
let journal = header.getByRole( 'link', { name: 'Journal', exact: true } );
|
|
await expect( menuButton ).toBeVisible();
|
|
await menuButton.focus();
|
|
await page.setViewportSize( { width: 600, height: 844 } );
|
|
await expect( journal ).toBeFocused();
|
|
|
|
await page.goto( '/' );
|
|
header = page.getByRole( 'banner' );
|
|
journal = header.getByRole( 'link', { name: 'Journal', exact: true } );
|
|
menuButton = header.locator( '[data-chrnx-menu-toggle]' );
|
|
await journal.focus();
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await expect( menuButton ).toBeFocused();
|
|
|
|
await page.setViewportSize( { width: 600, height: 844 } );
|
|
await page.goto( '/' );
|
|
header = page.getByRole( 'banner' );
|
|
checkedTheme = header.locator(
|
|
'[data-chrnx-theme-panel] [data-chrnx-theme-value][aria-pressed="true"]',
|
|
);
|
|
themeButton = header.locator( '[data-chrnx-theme-button]' );
|
|
await checkedTheme.focus();
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await expect( themeButton ).toBeFocused();
|
|
} );
|
|
|
|
test( 'visible navigation and theme controls retain focus across resize', async ( { page } ) => {
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
const menuButton = header.locator( '[data-chrnx-menu-toggle]' );
|
|
const themeButton = header.locator( '[data-chrnx-theme-button]' );
|
|
const journal = header.getByRole( 'link', { name: 'Journal', exact: true } );
|
|
const checkedTheme = header.locator(
|
|
'[data-chrnx-theme-panel] [data-chrnx-theme-value][aria-pressed="true"]',
|
|
);
|
|
|
|
await menuButton.click();
|
|
await journal.focus();
|
|
await page.setViewportSize( { width: 600, height: 844 } );
|
|
await expect( journal ).toBeFocused();
|
|
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await page.goto( '/' );
|
|
await themeButton.click();
|
|
await checkedTheme.focus();
|
|
await page.setViewportSize( { width: 600, height: 844 } );
|
|
await expect( checkedTheme ).toBeFocused();
|
|
} );
|
|
|
|
test( 'mobile header states pass automated WCAG checks', async ( { page }, testInfo ) => {
|
|
test.skip(
|
|
testInfo.project.name !== 'chromium',
|
|
'One engine is sufficient for deterministic axe rules.',
|
|
);
|
|
await page.setViewportSize( reviewViewports[ 0 ] );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
const triggers = [
|
|
null,
|
|
header.locator( '[data-chrnx-search-button]' ),
|
|
header.locator( '[data-chrnx-theme-button]' ),
|
|
header.locator( '[data-chrnx-menu-toggle]' ),
|
|
];
|
|
const tags = [ 'wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa' ];
|
|
|
|
for ( const trigger of triggers ) {
|
|
if ( trigger ) {
|
|
await trigger.click();
|
|
}
|
|
await injectAxe( page );
|
|
const violations = await page.evaluate( async ( runOnly ) => {
|
|
const result = await globalThis.axe.run( document, {
|
|
runOnly: { type: 'tag', values: runOnly },
|
|
} );
|
|
return result.violations.map( ( violation ) => ( {
|
|
id: violation.id,
|
|
impact: violation.impact,
|
|
nodes: violation.nodes.map( ( node ) => node.target ),
|
|
} ) );
|
|
}, tags );
|
|
expect( violations ).toEqual( [] );
|
|
}
|
|
} );
|
|
|
|
test( 'approved review viewports have no horizontal overflow and preserve the breakpoint', async ( {
|
|
page,
|
|
} ) => {
|
|
for ( const viewport of reviewViewports ) {
|
|
await page.setViewportSize( viewport );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
await expectNoHorizontalOverflow( page, header );
|
|
if ( viewport.width <= 599 ) {
|
|
await expect( header.locator( '[data-chrnx-menu-toggle]' ) ).toBeVisible();
|
|
await expect( header.locator( '[data-chrnx-theme-button]' ) ).toBeVisible();
|
|
} else {
|
|
await expect( header.locator( '[data-chrnx-menu-toggle]' ) ).toBeHidden();
|
|
await expect( header.locator( '[data-chrnx-theme-button]' ) ).toBeHidden();
|
|
await expect(
|
|
header.getByRole( 'navigation', { name: 'Primary navigation' } ),
|
|
).toBeVisible();
|
|
await expect( header.locator( '[data-chrnx-theme-panel]' ) ).toBeVisible();
|
|
}
|
|
}
|
|
} );
|
|
|
|
test.describe( 'without JavaScript', () => {
|
|
test.use( { javaScriptEnabled: false } );
|
|
|
|
test( 'navigation and named search remain fully usable', async ( { page } ) => {
|
|
await page.setViewportSize( { width: 390, height: 844 } );
|
|
await page.goto( '/' );
|
|
const header = page.getByRole( 'banner' );
|
|
await expect(
|
|
header.getByRole( 'navigation', { name: 'Primary navigation' } ),
|
|
).toBeVisible();
|
|
const search = header.getByRole( 'searchbox', { name: 'Search' } );
|
|
const submit = header.getByRole( 'button', { name: 'Search', exact: true } );
|
|
await expect( search ).toBeVisible();
|
|
await expect( submit ).toBeVisible();
|
|
await expect( header.getByRole( 'img', { name: 'CHRNX' } ) ).toBeVisible();
|
|
await expect( header.locator( '.chrnx-theme-noscript' ) ).toBeVisible();
|
|
await expect( submit ).toHaveAttribute( 'aria-expanded', 'true' );
|
|
await expectNoHorizontalOverflow( page, header );
|
|
await search.fill( 'no js cats' );
|
|
await submit.click();
|
|
await expect( page ).toHaveURL( new RegExp( `[?&]s=no(?:\\+|%20)js(?:\\+|%20)cats(?:&|$)` ) );
|
|
} );
|
|
} );
|
|
} );
|