style: add Related Stories layouts
This commit is contained in:
4 files changed
+388
-3
No files matched your search
@@ -24,3 +24,40 @@ test( 'Related Stories owns one exact local progressive controller', async () =>
|
||||
assert.equal( Object.hasOwn( metadata, 'viewScriptModule' ), false );
|
||||
await readFile( 'assets/js/related-posts.js', 'utf8' );
|
||||
} );
|
||||
|
||||
test( 'Related Stories CSS owns responsive grid and rail contracts', async () => {
|
||||
const css = await readFile( 'blocks/related-posts/style.css', 'utf8' );
|
||||
|
||||
for ( const selector of [
|
||||
'.chrnx-related-posts.is-layout-adaptive',
|
||||
'.chrnx-related-posts.is-layout-grid',
|
||||
'.chrnx-related-posts.is-layout-carousel',
|
||||
] ) {
|
||||
assert.match( css, new RegExp( selector.replaceAll( '.', '\\.' ) ) );
|
||||
}
|
||||
assert.match( css, /@media \(max-width: 900px\)/ );
|
||||
assert.match( css, /@media \(min-width: 901px\)/ );
|
||||
assert.match( css, /overflow-x:\s*auto/ );
|
||||
assert.match( css, /scroll-snap-type:\s*x mandatory/ );
|
||||
assert.match( css, /scroll-snap-align:\s*start/ );
|
||||
assert.match( css, /flex:\s*0 0 calc\(100% - clamp\(3rem, 12vw, 7rem\)\)/ );
|
||||
assert.match( css, /grid-template-columns:\s*repeat\(3, minmax\(0, 1fr\)\)/ );
|
||||
assert.match( css, /\[hidden\][^{]*\{[^}]*display:\s*none\s*!important/s );
|
||||
assert.match( css, /min-width:\s*45px/ );
|
||||
assert.match( css, /min-height:\s*45px/ );
|
||||
assert.match( css, /html\[data-theme="dark"\][^{]*\{[^}]*--chrnx-related-focus-ring:\s*var\(--wp--preset--color--green\)/s );
|
||||
assert.match( css, /html\[data-theme="light"\][^{]*\{[^}]*--chrnx-related-focus-ring:\s*var\(--wp--preset--color--light-green\)/s );
|
||||
assert.match( css, /:focus-visible[^}]*var\(--chrnx-related-focus-ring\)/s );
|
||||
assert.match( css, /@media \(prefers-reduced-motion: reduce\)[^{]*\{[\s\S]*scroll-behavior:\s*auto/ );
|
||||
|
||||
assert.doesNotMatch( css, /animation(?:-\w+)?:|autoplay/i );
|
||||
assert.doesNotMatch( css, /scrollbar-width:\s*none|::-webkit-scrollbar|-ms-overflow-style/i );
|
||||
assert.doesNotMatch(
|
||||
css,
|
||||
/(?:^|[},])\s*(?:html|body|\.wp-site-blocks)[^{]*\{[^}]*overflow-x:\s*hidden/is,
|
||||
);
|
||||
assert.doesNotMatch(
|
||||
css,
|
||||
/\.chrnx-related-card[^{]*\{[^}]*(?:width|flex-basis):\s*\d+(?:\.\d+)?px/is,
|
||||
);
|
||||
} );
|
||||
Reference in new issue
Block a user