feat: rebuild the header controls as icon buttons

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>
This commit is contained in:
chrnxandClaude Opus 5 committed 2026-08-13 19:41:24 -05:00
1 parent f55d9d9b45
commit a142ece51d
16 files changed
+316 -156

No files matched your search

+25 -16
View File
@@ -547,12 +547,12 @@ test.describe( 'site navigation shell', () => {
expect( themeBox.x ).toBeGreaterThanOrEqual( 0 );
expect( themeBox.x + themeBox.width ).toBeLessThanOrEqual( width );
for ( const name of [ 'Light', 'Dark', 'System' ] ) {
const radio = header.getByRole( 'radio', { name, exact: true } );
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.locator( '..' ), width );
await expectContainedTarget( radio, width );
}
await expectNoHorizontalOverflow( page, header );
} );
@@ -566,17 +566,20 @@ test.describe( 'site navigation shell', () => {
await page.setViewportSize( { width, height: 844 } );
await page.goto( '/' );
if ( scenario === 'long translated labels' ) {
await page.locator( '[data-chrnx-theme-panel] label' ).evaluateAll( ( labels ) => {
const translations = [
'Helles Erscheinungsbild verwenden',
'Dunkles Erscheinungsbild verwenden',
'Automatisch dem Farbschema des Betriebssystems folgen',
];
labels.forEach( ( label, index ) => {
const text = Array.from( label.childNodes ).find( ( node ) => node.nodeType === 3 );
text.nodeValue = ` ${ translations[ index ] }`;
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%';
@@ -650,7 +653,7 @@ test.describe( 'site navigation shell', () => {
const themePanel = header.locator( '[data-chrnx-theme-panel]' );
await expect( nav ).toBeVisible();
await expect( themePanel ).toBeVisible();
await expect( header.getByRole( 'radio', { name: 'System', exact: true } ) ).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();
@@ -791,7 +794,9 @@ test.describe( 'site navigation shell', () => {
await page.goto( '/' );
header = page.getByRole( 'banner' );
let themeButton = header.locator( '[data-chrnx-theme-button]' );
let checkedTheme = header.locator( '[data-chrnx-theme-panel] input:checked' );
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 } );
@@ -818,7 +823,9 @@ test.describe( 'site navigation shell', () => {
await page.setViewportSize( { width: 600, height: 844 } );
await page.goto( '/' );
header = page.getByRole( 'banner' );
checkedTheme = header.locator( '[data-chrnx-theme-panel] input:checked' );
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 } );
@@ -832,7 +839,9 @@ test.describe( 'site navigation shell', () => {
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] input:checked' );
const checkedTheme = header.locator(
'[data-chrnx-theme-panel] [data-chrnx-theme-value][aria-pressed="true"]',
);
await menuButton.click();
await journal.focus();
+32 -15
View File
@@ -47,25 +47,31 @@ test.describe( 'real theme preference shell', () => {
await page.goto( '/' );
const groups = page.locator( '[data-chrnx-theme-toggle]' );
await expect( groups.first() ).toHaveAccessibleName( 'Color theme' );
await groups.first().getByRole( 'radio', { name: 'Light', exact: true } ).check();
await groups.first().getByRole( 'button', { name: 'Light', exact: true } ).click();
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'light' );
await expect
.poll( () => page.evaluate( ( key ) => localStorage.getItem( key ), preferenceKey ) )
.toBe( 'light' );
await page.reload();
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'light' );
await expect( page.getByRole( 'radio', { name: 'Light', exact: true } ) ).toBeChecked();
await page.getByRole( 'radio', { name: 'Dark', exact: true } ).check();
await expect( page.getByRole( 'button', { name: 'Light', exact: true } ) ).toHaveAttribute(
'aria-pressed',
'true',
);
await page.getByRole( 'button', { name: 'Dark', exact: true } ).click();
await page.reload();
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
await expect( page.getByRole( 'radio', { name: 'Dark', exact: true } ) ).toBeChecked();
await expect( page.getByRole( 'button', { name: 'Dark', exact: true } ) ).toHaveAttribute(
'aria-pressed',
'true',
);
const instances = await page.locator( '[data-chrnx-theme-toggle]' ).count();
if ( instances > 1 ) {
await expect( page.getByRole( 'radio', { name: 'Dark', exact: true } ) ).toHaveCount(
await expect( page.getByRole( 'button', { name: 'Dark', exact: true } ) ).toHaveCount(
instances,
);
for ( const radio of await page.getByRole( 'radio', { name: 'Dark', exact: true } ).all() ) {
await expect( radio ).toBeChecked();
for ( const radio of await page.getByRole( 'button', { name: 'Dark', exact: true } ).all() ) {
await expect( radio ).toHaveAttribute( 'aria-pressed', 'true' );
}
}
} );
@@ -85,7 +91,10 @@ test.describe( 'real theme preference shell', () => {
await page.reload();
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', saved );
const savedName = saved[ 0 ].toUpperCase() + saved.slice( 1 );
await expect( page.getByRole( 'radio', { name: savedName, exact: true } ) ).toBeChecked();
await expect( page.getByRole( 'button', { name: savedName, exact: true } ) ).toHaveAttribute(
'aria-pressed',
'true',
);
await page.emulateMedia( { colorScheme: saved } );
await page.emulateMedia( { colorScheme: operatingSystem } );
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', saved );
@@ -102,7 +111,7 @@ test.describe( 'real theme preference shell', () => {
await page.emulateMedia( { colorScheme: 'light' } );
await page.reload();
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
await page.getByRole( 'radio', { name: 'System', exact: true } ).check();
await page.getByRole( 'button', { name: 'System', exact: true } ).click();
await expect
.poll( () => page.evaluate( ( key ) => localStorage.getItem( key ), preferenceKey ) )
.toBeNull();
@@ -110,7 +119,10 @@ test.describe( 'real theme preference shell', () => {
await page.emulateMedia( { colorScheme: 'dark' } );
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
await page.reload();
await expect( page.getByRole( 'radio', { name: 'System', exact: true } ) ).toBeChecked();
await expect( page.getByRole( 'button', { name: 'System', exact: true } ) ).toHaveAttribute(
'aria-pressed',
'true',
);
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
await expect
.poll( () => page.evaluate( ( key ) => localStorage.getItem( key ), preferenceKey ) )
@@ -139,7 +151,7 @@ test.describe( 'real theme preference shell', () => {
await expect( trigger ).toHaveAttribute( 'aria-expanded', 'false' );
await trigger.click();
await page.getByRole( 'radio', { name: 'System', exact: true } ).focus();
await page.getByRole( 'button', { name: 'System', exact: true } ).focus();
await page.getByText( 'Made in Sinaloa, shared from home.', { exact: true } ).click();
await expect( panel ).toBeHidden();
await expect( trigger ).toBeVisible();
@@ -176,16 +188,21 @@ test.describe( 'real theme preference shell', () => {
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
} );
test( 'native radios expose state, keyboard interaction, status, and 44px targets', async ( {
test( 'native toggle buttons expose state, keyboard interaction, status, and 44px targets', async ( {
page,
} ) => {
await page.goto( '/' );
const light = page.getByRole( 'radio', { name: 'Light', exact: true } );
const light = page.getByRole( 'button', { name: 'Light', exact: true } );
await light.focus();
await page.keyboard.press( 'ArrowRight' );
await expect( page.getByRole( 'radio', { name: 'Dark', exact: true } ) ).toBeChecked();
await expect( page.getByRole( 'button', { name: 'Dark', exact: true } ) ).toHaveAttribute(
'aria-pressed',
'true',
);
await expect( page.locator( '[data-chrnx-theme-status]' ) ).toHaveText( 'Dark theme active' );
for ( const label of await page.locator( '[data-chrnx-theme-toggle] label' ).all() ) {
for ( const label of await page
.locator( '[data-chrnx-theme-toggle] [data-chrnx-theme-value]' )
.all() ) {
const box = await label.boundingBox();
expect( box.width ).toBeGreaterThanOrEqual( 44 );
expect( box.height ).toBeGreaterThanOrEqual( 44 );
+20 -16
View File
@@ -46,11 +46,11 @@ function shellMarkup() {
<div data-part="theme" class="chrnx-theme-control">
<button hidden type="button" data-chrnx-theme-button
aria-controls="chrnx-theme-panel" aria-expanded="false">Theme</button>
<fieldset id="chrnx-theme-panel" data-chrnx-theme-panel data-chrnx-theme-toggle>
<label><input type="radio" name="theme" value="light"> Light</label>
<label><input type="radio" name="theme" value="dark"> Dark</label>
<label><input type="radio" name="theme" value="system" checked> System</label>
</fieldset>
<div id="chrnx-theme-panel" role="group" aria-label="Color theme" data-chrnx-theme-panel data-chrnx-theme-toggle>
<button type="button" data-chrnx-theme-value="light" aria-pressed="false">Light</button>
<button type="button" data-chrnx-theme-value="dark" aria-pressed="false">Dark</button>
<button type="button" data-chrnx-theme-value="system" aria-pressed="true">System</button>
</div>
</div>
</header>
<button data-outside>Outside</button>
@@ -72,8 +72,10 @@ function controls() {
theme: document.querySelector( '[data-part="theme"]' ),
themeButton: document.querySelector( '[data-chrnx-theme-button]' ),
themePanel: document.querySelector( '[data-chrnx-theme-panel]' ),
checkedRadio: document.querySelector( '[data-chrnx-theme-panel] input:checked' ),
firstRadio: document.querySelector( '[data-chrnx-theme-panel] input' ),
checkedRadio: document.querySelector(
'[data-chrnx-theme-panel] [data-chrnx-theme-value][aria-pressed="true"]',
),
firstRadio: document.querySelector( '[data-chrnx-theme-panel] [data-chrnx-theme-value]' ),
outside: document.querySelector( '[data-outside]' ),
outsideContent: document.querySelector( '[data-outside-content]' ),
};
@@ -104,10 +106,10 @@ function visibleFocusableElements() {
if ( element.hidden || element.closest( '[hidden]' ) ) {
return false;
}
if ( element.type !== 'radio' || element.checked ) {
if ( ! element.dataset.chrnxThemeValue ) {
return true;
}
return ! document.querySelector( `input[type="radio"][name="${ element.name }"]:checked` );
return element.getAttribute( 'aria-pressed' ) === 'true';
} );
}
@@ -331,7 +333,7 @@ describe( 'coordinated CHRNX header shell', () => {
initialize( { document, media: createMedia( true ) } );
const control = controls();
control[ buttonName ].click();
control[ panelName ].querySelector( 'input, a' ).focus();
control[ panelName ].querySelector( 'input, a, button' ).focus();
press( control[ panelName ], 'Escape' );
expect( control[ panelName ].hidden ).toBe( true );
expect( document.activeElement ).toBe( control[ buttonName ] );
@@ -435,9 +437,11 @@ describe( 'coordinated CHRNX header shell', () => {
const media = createMedia( true );
initialize( { document, media } );
const control = controls();
const currentRadio = control.themePanel.querySelector( `input[value="${ value }"]` );
control.checkedRadio.checked = false;
currentRadio.checked = true;
const currentRadio = control.themePanel.querySelector(
`[data-chrnx-theme-value="${ value }"]`,
);
control.checkedRadio.setAttribute( 'aria-pressed', 'false' );
currentRadio.setAttribute( 'aria-pressed', 'true' );
control.themeButton.focus();
media.change( false );
@@ -450,8 +454,8 @@ describe( 'coordinated CHRNX header shell', () => {
const media = createMedia( true );
initialize( { document, media } );
const control = controls();
control.themePanel.querySelectorAll( 'input[type="radio"]' ).forEach( ( radio ) => {
radio.checked = false;
control.themePanel.querySelectorAll( '[data-chrnx-theme-value]' ).forEach( ( radio ) => {
radio.setAttribute( 'aria-pressed', 'false' );
} );
control.themeButton.focus();
@@ -562,7 +566,7 @@ describe( 'coordinated CHRNX header shell', () => {
test.each( [
[ 'brand', '.chrnx-site-brand' ],
[ 'navigation link', '[data-part="nav"] a' ],
[ 'theme radio', '[data-chrnx-theme-panel] input' ],
[ 'theme button', '[data-chrnx-theme-panel] [data-chrnx-theme-value]' ],
] )( 'fails closed without the required %s', ( _name, selector ) => {
const { initialize } = require( modulePath );
document.querySelectorAll( selector ).forEach( ( element ) => element.remove() );
+15 -12
View File
@@ -16,17 +16,18 @@ function createMedia( matches = false ) {
function toggleMarkup() {
document.body.innerHTML = `
<fieldset class="chrnx-theme-toggle" data-chrnx-theme-toggle
<div class="chrnx-theme-toggle" role="group" aria-label="Color theme" data-chrnx-theme-toggle
data-group="theme-a"
data-status-light="Light theme active"
data-status-dark="Dark theme active"
data-status-system-light="Light theme active, following system preference"
data-status-system-dark="Dark theme active, following system preference">
<legend>Color theme</legend>
<label><input type="radio" name="theme-a" value="light">Light</label>
<label><input type="radio" name="theme-a" value="dark">Dark</label>
<label><input type="radio" name="theme-a" value="system" checked>System</label>
<span class="chrnx-theme-toggle__legend">Color theme</span>
<button type="button" data-chrnx-theme-value="light" aria-pressed="false">Light</button>
<button type="button" data-chrnx-theme-value="dark" aria-pressed="false">Dark</button>
<button type="button" data-chrnx-theme-value="system" aria-pressed="true">System</button>
<output data-chrnx-theme-status aria-live="polite">Following system theme</output>
</fieldset>`;
</div>`;
}
describe( 'theme preference helpers', () => {
@@ -85,7 +86,7 @@ describe( 'theme preference helpers', () => {
const media = createMedia( true );
expect( () => initialize( { document, storage: denied, media } ) ).not.toThrow();
expect( document.documentElement.dataset.theme ).toBe( 'dark' );
const light = document.querySelector( 'input[value="light"]' );
const light = document.querySelector( '[data-chrnx-theme-value="light"]' );
expect( () => light.click() ).not.toThrow();
expect( document.documentElement.dataset.theme ).toBe( 'light' );
} );
@@ -99,7 +100,7 @@ describe( 'theme preference helpers', () => {
expect( document.documentElement.dataset.theme ).toBe( 'light' );
media.change( true );
expect( document.documentElement.dataset.theme ).toBe( 'dark' );
document.querySelector( 'input[value="light"]' ).click();
document.querySelector( '[data-chrnx-theme-value="light"]' ).click();
media.change( false );
expect( document.documentElement.dataset.theme ).toBe( 'light' );
} );
@@ -117,10 +118,10 @@ describe( 'theme preference helpers', () => {
storage: { getItem: () => null, setItem: jest.fn(), removeItem: jest.fn() },
media,
} );
document.querySelector( 'input[name="theme-a"][value="light"]' ).click();
document.querySelector( '[data-group="theme-a"] [data-chrnx-theme-value="light"]' ).click();
expect(
[ ...document.querySelectorAll( 'input[value="light"]' ) ].every(
( input ) => input.checked,
[ ...document.querySelectorAll( '[data-chrnx-theme-value="light"]' ) ].every(
( button ) => button.getAttribute( 'aria-pressed' ) === 'true',
),
).toBe( true );
expect(
@@ -131,7 +132,9 @@ describe( 'theme preference helpers', () => {
expect( document.querySelector( '[data-chrnx-theme-status]' ).textContent ).toBe(
'Light theme active',
);
expect( document.querySelector( 'fieldset' ).textContent ).toContain( 'Color theme' );
expect( document.querySelector( '[data-chrnx-theme-toggle]' ).textContent ).toContain(
'Color theme',
);
} );
test( 'applies data-theme and color-scheme together', () => {
+49 -7
View File
@@ -119,13 +119,13 @@ class BlockRenderingTest extends WP_UnitTestCase {
$this->assertNotEmpty( $theme_control[1] );
$this->assertSame( 1, substr_count( $output, 'id="' . $theme_control[1] . '"' ) );
$this->assertMatchesRegularExpression(
'/<fieldset[^>]+id="' . preg_quote( $theme_control[1], '/' ) . '"[^>]+data-chrnx-theme-toggle[^>]+data-chrnx-theme-panel/',
'/<div[^>]+id="' . preg_quote( $theme_control[1], '/' ) . '"[^>]+role="group"[^>]+data-chrnx-theme-toggle[^>]+data-chrnx-theme-panel/s',
$output
);
$this->assertSame( 3, substr_count( $output, 'type="radio"' ) );
$this->assertSame( 3, substr_count( $output, 'data-chrnx-theme-value="' ) );
foreach ( array( 'light', 'dark', 'system' ) as $value ) {
$this->assertMatchesRegularExpression(
'/<input[^>]+type="radio"[^>]+value="' . $value . '"/',
'/<button[^>]+data-chrnx-theme-value="' . $value . '"[^>]+aria-pressed="(?:true|false)"/s',
$output
);
}
@@ -358,6 +358,41 @@ class BlockRenderingTest extends WP_UnitTestCase {
$this->assertStringContainsString( 'href="#chrnx-main"', $output );
}
/** Navigation falls back to the built-in pages and prefers an assigned menu. */
public function test_navigation_links_prefer_an_assigned_menu_over_the_builtin_fallback() {
$this->assertTrue( function_exists( 'chrnx_get_navigation_links' ) );
$fallback = chrnx_get_navigation_links( 'chrnx-primary' );
$this->assertCount( 5, $fallback );
$this->assertSame( 'Journal', $fallback[0]['label'] );
$this->assertSame( home_url( '/journal/' ), $fallback[0]['url'] );
$menu_id = wp_create_nav_menu( 'Prod nav ' . wp_unique_id() );
$this->assertIsInt( $menu_id );
wp_update_nav_menu_item(
$menu_id,
0,
array(
'menu-item-title' => 'Notas',
'menu-item-url' => home_url( '/notas/' ),
'menu-item-status' => 'publish',
)
);
$locations = get_nav_menu_locations();
$locations['chrnx-primary'] = $menu_id;
set_theme_mod( 'nav_menu_locations', $locations );
$assigned = chrnx_get_navigation_links( 'chrnx-primary' );
$this->assertCount( 1, $assigned );
$this->assertSame( 'Notas', $assigned[0]['label'] );
$this->assertSame( home_url( '/notas/' ), $assigned[0]['url'] );
// An empty location must not leave the header without navigation.
$locations['chrnx-primary'] = 0;
set_theme_mod( 'nav_menu_locations', $locations );
$this->assertCount( 5, chrnx_get_navigation_links( 'chrnx-primary' ) );
}
/** Topic art is an exact fixed mapping and rejects arbitrary paths. */
public function test_topic_art_uses_only_the_fixed_mapping() {
$expected = array(
@@ -722,7 +757,7 @@ class BlockRenderingTest extends WP_UnitTestCase {
);
$this->assertStringContainsString( '>Silicon Ranch</h2>', $output );
$this->assertStringContainsString( 'alter-ego-podcasts.png', $output );
$this->assertStringContainsString( 'alter-ego-podcasts-768.webp', $output );
$this->assertStringNotContainsString( '>Podcasts</h2>', $output );
$this->assertSame( 1, substr_count( $output, 'class="chrnx-character-stage"' ) );
}
@@ -771,7 +806,11 @@ class BlockRenderingTest extends WP_UnitTestCase {
$this->assertSame( 1, substr_count( $output, '<article' ) );
$this->assertStringContainsString( 'Only Story', $output );
$this->assertStringContainsString( 'aria-hidden="true"', $output );
$this->assertStringNotContainsString( 'placeholder', strtolower( $output ) );
// A card without media now shows the shared placeholder, which must stay
// decorative and keep its topic class so the accent still varies.
$this->assertStringContainsString( 'placeholder-post', $output );
$this->assertMatchesRegularExpression( '/<picture[^>]*aria-hidden="true"/', $output );
$this->assertStringContainsString( 'is-topic-code', $output );
}
/** Primed editorial cards reuse relationship caches instead of querying once per fallback. */
@@ -871,8 +910,11 @@ class BlockRenderingTest extends WP_UnitTestCase {
$output = $this->render_for_post( 'chrnx/related-posts', $current );
$this->assertStringContainsString( 'chrnx-related-card__fallback', $output );
$this->assertMatchesRegularExpression( '/class="[^"]*chrnx-related-card__fallback[^"]*" aria-hidden="true"/', $output );
$this->assertStringNotContainsString( '<img', $output );
// The fallback is the shared placeholder image now, still decorative and
// still carrying its topic class for the accent underneath it.
$this->assertMatchesRegularExpression( '/<picture[^>]*aria-hidden="true"/', $output );
$this->assertMatchesRegularExpression( '/<img[^>]*class="[^"]*chrnx-related-card__fallback[^"]*is-topic-research/', $output );
$this->assertStringContainsString( 'placeholder-post', $output );
}
/** Provide strict Related Stories limit inputs and their expected card counts. */
+8 -7
View File
@@ -48,7 +48,7 @@ class ThemePreferenceTest extends WP_UnitTestCase {
$this->assertStringContainsString( 'document.documentElement.dataset.theme=t', $output );
}
/** Toggle uses a labeled native radio group with a live status. */
/** Toggle uses a labeled group of native toggle buttons with a live status. */
public function test_toggle_renders_accessible_native_controls() {
do_action( 'init' );
$output = render_block(
@@ -61,12 +61,13 @@ class ThemePreferenceTest extends WP_UnitTestCase {
)
);
$this->assertStringContainsString( '<fieldset', $output );
$this->assertStringContainsString( '<legend', $output );
$this->assertSame( 3, substr_count( $output, 'type="radio"' ) );
$this->assertStringContainsString( 'value="light"', $output );
$this->assertStringContainsString( 'value="dark"', $output );
$this->assertStringContainsString( 'value="system"', $output );
$this->assertStringContainsString( 'role="group"', $output );
$this->assertStringContainsString( 'aria-labelledby="chrnx-theme-legend-', $output );
$this->assertSame( 3, substr_count( $output, 'data-chrnx-theme-value="' ) );
$this->assertSame( 1, substr_count( $output, 'aria-pressed="true"' ) );
$this->assertStringContainsString( 'data-chrnx-theme-value="light"', $output );
$this->assertStringContainsString( 'data-chrnx-theme-value="dark"', $output );
$this->assertStringContainsString( 'data-chrnx-theme-value="system"', $output );
$this->assertStringContainsString( 'aria-live="polite"', $output );
$this->assertStringContainsString( 'data-status-system-light="Light theme active, following system preference"', $output );
$this->assertStringContainsString( 'data-status-system-dark="Dark theme active, following system preference"', $output );