Plan step 37: all.css replaces the two interim import lists with one entry for an application that wants everything — the foundation, every layout stylesheet and every component stylesheet, grouped under the same block comments components.css used, plus a Layout block. It also directly imports the three files nothing imported by name before (layout/spacing.css, layout/visibility.css, components/selection.css), so every file under components/ and layout/ is now one @import away. Every test that read a block of components.css or layout.css now reads the matching block of all.css through one shared helper (allCssBlock(), in tests/Pest.php so it loads for any test run) instead of repeating the same substr() search in each file. StylesheetsTest.php's shape, Tailwind-free and breakpoint checks, previously run twice (once for the foundation, once for the layout tree), now run once over the whole tree all.css reaches, since every component and layout stylesheet is plain CSS after step 36; a new test asserts all.css imports everything under components/ and layout/ exactly once. The Workbench imports all.css in place of layout.css and components.css. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
61 lines
3.2 KiB
PHP
61 lines
3.2 KiB
PHP
<?php
|
|
|
|
it('lays its children side by side in a div, with nothing set but itself', function () {
|
|
$root = layoutRoot((string) $this->blade('<x-row><span>One</span><span>Two</span></x-row>'));
|
|
|
|
expect($root)->toMatchArray(['<' => 'div', 'data-md-row' => 'data-md-row'])
|
|
->not->toHaveKeys(['data-md-gap', 'data-md-align', 'data-md-justify', 'data-md-wrap', 'data-md-stack-below']);
|
|
});
|
|
|
|
it('spaces its children with a spacing token only, and with none for anything else', function () {
|
|
expect(layoutRoot((string) $this->blade('<x-row gap="space100" />'))['data-md-gap'])->toBe('space100')
|
|
->and(layoutRoot((string) $this->blade('<x-row gap="tight" />'))['data-md-gap'])->toBe('none');
|
|
});
|
|
|
|
it('aligns its children across it and places them along it', function () {
|
|
foreach (['center', 'start', 'end', 'stretch', 'baseline'] as $align) {
|
|
expect(layoutRoot((string) $this->blade('<x-row :align="$align" />', ['align' => $align]))['data-md-align'])->toBe($align);
|
|
}
|
|
|
|
foreach (['start', 'center', 'end', 'between'] as $justify) {
|
|
expect(layoutRoot((string) $this->blade('<x-row :justify="$justify" />', ['justify' => $justify]))['data-md-justify'])->toBe($justify);
|
|
}
|
|
|
|
expect(layoutRoot((string) $this->blade('<x-row align="middle" justify="around" />')))->not->toHaveKeys(['data-md-align', 'data-md-justify']);
|
|
});
|
|
|
|
it('wraps only when asked', function () {
|
|
expect(layoutRoot((string) $this->blade('<x-row wrap />')))->toHaveKey('data-md-wrap')
|
|
->and(layoutRoot((string) $this->blade('<x-row :wrap="false" />')))->not->toHaveKey('data-md-wrap');
|
|
});
|
|
|
|
it('stacks below one of M3\'s breakpoints, and never below compact', function () {
|
|
foreach (['medium', 'expanded', 'large', 'extra-large'] as $breakpoint) {
|
|
expect(layoutRoot((string) $this->blade('<x-row :stack-below="$b" />', ['b' => $breakpoint]))['data-md-stack-below'])->toBe($breakpoint);
|
|
}
|
|
|
|
foreach (['compact', 'tablet', '600'] as $breakpoint) {
|
|
expect(layoutRoot((string) $this->blade('<x-row :stack-below="$b" />', ['b' => $breakpoint])))->not->toHaveKey('data-md-stack-below');
|
|
}
|
|
});
|
|
|
|
it('takes the element, the visibility props and the caller\'s class and style', function () {
|
|
expect(layoutRoot((string) $this->blade('<x-row as="nav" hide-from="expanded" class="toolbar-row" style="min-height: 3rem" aria-label="Filters" />')))
|
|
->toMatchArray([
|
|
'<' => 'nav',
|
|
'data-md-hide-from' => 'expanded',
|
|
'class' => 'toolbar-row',
|
|
'style' => 'min-height: 3rem;',
|
|
'aria-label' => 'Filters',
|
|
]);
|
|
});
|
|
|
|
it('draws the row from a stylesheet in the layout layer, stacking at the breakpoint in px', function () {
|
|
$css = (string) file_get_contents(__DIR__.'/../../../resources/css/layout/row.css');
|
|
|
|
expect($css)->toContain('@layer material.layout')
|
|
->toContain("@media (width < 840px) {\n [data-md-row][data-md-stack-below='expanded'] {\n flex-direction: column;")
|
|
->toContain("[data-md-row][data-md-stack-below='expanded']:not([data-md-align]) {\n align-items: stretch;")
|
|
->and((string) file_get_contents(__DIR__.'/../../../resources/css/all.css'))->toContain("@import './layout/row.css';");
|
|
});
|