Draw the data table without Tailwind
<x-table> renders data-md-table with data-md-size and data-md-dense, and table.css moves into material.components on px and spacing tokens, its cell selectors still inside :where() so a caller's cell rule wins (plan step 36). The showcase's layout table follows the hook. A browser test pins 52px rows and 36px dense ones. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
co-authored by
Claude Opus 5
parent
4141ebe7b0
commit
25e1bb4788
@@ -8,14 +8,25 @@ use Livewire\WithPagination;
|
||||
|
||||
it('marks a table for its styles and takes a size', function () {
|
||||
expect((string) $this->blade('<x-table class="min-w-160"><tbody><tr><td>a</td></tr></tbody></x-table>'))
|
||||
->toContain('<table data-table data-size="sm" class="min-w-160">')
|
||||
->and((string) $this->blade('<x-table size="xs" />'))->toContain('data-size="xs"')
|
||||
->and((string) $this->blade('<x-table size="huge" />'))->toContain('data-size="sm"');
|
||||
->toContain('<table data-md-table data-md-size="sm" class="min-w-160">')
|
||||
->and((string) $this->blade('<x-table size="xs" />'))->toContain('data-md-size="xs"')
|
||||
->and((string) $this->blade('<x-table size="huge" />'))->toContain('data-md-size="sm"');
|
||||
});
|
||||
|
||||
it('tightens a table only when the caller asks for it', function () {
|
||||
expect((string) $this->blade('<x-table />'))->not->toContain('data-dense')
|
||||
->and((string) $this->blade('<x-table dense />'))->toContain('data-dense');
|
||||
expect((string) $this->blade('<x-table />'))->not->toContain('data-md-dense')
|
||||
->and((string) $this->blade('<x-table dense />'))->toContain('data-md-dense');
|
||||
});
|
||||
|
||||
it('draws 52px rows, 36px dense ones, from its stylesheet in the components layer', function () {
|
||||
$css = (string) file_get_contents(__DIR__.'/../../../resources/css/components/table.css');
|
||||
|
||||
expect($css)->toContain('@layer material.components')
|
||||
->toMatch('/\\[data-md-table\\] \\{\\s*--cell-x: 12px;\\s*--cell-y: var\\(--md-sys-measurement-space200\\);/')
|
||||
->toMatch('/\\[data-md-table\\]\\[data-md-dense\\] \\{\\s*--cell-y: var\\(--md-sys-measurement-space100\\);/')
|
||||
->toContain('[data-md-table] :where(tbody tr[aria-selected=\'true\'])')
|
||||
->and((string) file_get_contents(__DIR__.'/../../../resources/css/components.css'))->toContain("@import './components/table.css';")
|
||||
->and((string) file_get_contents(__DIR__.'/../../../resources/css/tailwind.css'))->not->toContain('table.css');
|
||||
});
|
||||
|
||||
it('sorts by its column, ascending first and then flipping', function () {
|
||||
|
||||
Reference in New Issue
Block a user