declarations("[data-md-color='{$color}']"))->toBe([ '--md-color' => "var(--md-sys-color-{$roles[0]})", '--md-on-color' => "var(--md-sys-color-{$roles[1]})", '--md-container' => "var(--md-sys-color-{$roles[2]})", '--md-on-container' => "var(--md-sys-color-{$roles[3]})", ]); })->with([ 'primary' => ['primary', ['primary', 'on-primary', 'primary-container', 'on-primary-container']], 'secondary' => ['secondary', ['secondary', 'on-secondary', 'secondary-container', 'on-secondary-container']], 'tertiary' => ['tertiary', ['tertiary', 'on-tertiary', 'tertiary-container', 'on-tertiary-container']], 'error' => ['error', ['error', 'on-error', 'error-container', 'on-error-container']], 'success' => ['success', ['success', 'on-success', 'success-container', 'on-success-container']], 'warning' => ['warning', ['warning', 'on-warning', 'warning-container', 'on-warning-container']], 'info' => ['info', ['info', 'on-info', 'info-container', 'on-info-container']], ]); it('keeps the generic variables on the element that names the colour', function () { $css = (string) file_get_contents(__DIR__.'/../../../resources/css/components/color.css'); foreach (['--md-color', '--md-on-color', '--md-container', '--md-on-container'] as $property) { expect($css)->toMatch('/@property '.preg_quote($property, '/')."\\s*\\{\\s*syntax: '\\*';\\s*inherits: false;\\s*\\}/"); } }); it('imports the table from every stylesheet that reads it', function () { $readers = collect(glob(__DIR__.'/../../../resources/css/components/*.css')) ->reject(fn (string $file): bool => basename($file) === 'color.css') ->filter(fn (string $file): bool => preg_match('/var\(--md-(?:on-)?(?:color|container)\b/', (string) file_get_contents($file)) === 1); expect($readers)->not->toBeEmpty(); foreach ($readers as $file) { expect(str_contains((string) file_get_contents($file), "@import './color.css';"))->toBeTrue(basename($file).' reads the colour table without importing it'); } });